Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile fails on src/economy.cpp:702:20: error: expected expression #6880

Closed
andythenorth opened this issue Aug 7, 2018 · 8 comments
Closed
Labels
OS: MacOS This issue is related to a Mac OS problem
Milestone

Comments

@andythenorth
Copy link
Contributor

andythenorth commented Aug 7, 2018

[SRC] Compiling economy.cpp
src/economy.cpp:702:20: error: expected expression
                c->cur_economy = {};
$ clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.2)

@andythenorth
Copy link
Contributor Author

selected ./configure output (LordAro asked for just flags)

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1
using CFLAGS_BUILD...  -fno-strict-aliasing -Wall -W -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-multichar -Wno-self-assign -Wno-parentheses -Wno-sign-compare -DOSX -D_FORTIFY_SOURCE=2 -O1 
using CXXFLAGS_BUILD...  
using LDFLAGS_BUILD...  -rdynamic 
using CFLAGS...  -O2 -fomit-frame-pointer  -fno-strict-aliasing -Wall -W -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-multichar -Wno-self-assign -Wno-parentheses -Wno-sign-compare -DOSX -D_FORTIFY_SOURCE=2 -DWITH_SSE -isystem/opt/local/include -DNO_QUICKTIME -DUNIX -DWITH_COCOA -DENABLE_COCOA_QUARTZ -DWITH_ZLIB   -DWITH_LZMA -I/usr/local/Cellar/xz/5.2.4/include  -DWITH_LZO -D_SQ64 -I/Users/andy2/workspace/OpenTTD.OpenTTD/src/3rdparty/squirrel/include -DWITH_PNG -I/usr/local/Cellar/libpng/1.6.35/include/libpng16  -DWITH_FREETYPE -I/usr/local/opt/freetype/include/freetype2  -DWITH_ICONV -DENABLE_NETWORK -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\"Documents/OpenTTD\" -DWITH_SHARED_DIR -DSHARED_DIR=\"/Library/Application\ Support/OpenTTD\" -DGLOBAL_DATA_DIR=\"/usr/local/share/games/openttd\" 
using CXXFLAGS...  
using LDFLAGS... -lstdc++ -lc -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -lz  -L/usr/local/Cellar/xz/5.2.4/lib -llzma  -llzo2 -L/usr/local/Cellar/libpng/1.6.35/lib -lpng16 -lz  -L/usr/local/opt/freetype/lib -lfreetype    -rdynamic -framework Cocoa 

@andythenorth
Copy link
Contributor Author

andythenorth commented Aug 7, 2018

$ clang -v
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0

@andythenorth
Copy link
Contributor Author

andythenorth commented Aug 7, 2018

$ clang -v | head -n1 | sed s@[^0-9]@@g | cut -c 1-2
Apple LLVM version 9.1.0 (clang-902.0.39.2)

@andythenorth
Copy link
Contributor Author

clang -v 2>&1 | head -n1 | sed s@[^0-9]@@g | cut -c 1-2
91

@andythenorth
Copy link
Contributor Author

andythenorth commented Aug 8, 2018

Workaround / fix, thanks to lethosor and michicc

CC=clang CXX=clang++ LDFLAGS="-liconv" ./configure

Then the build works. My mac OS is 10.13.6. lethosor has 10.13 also, and can build clean from OpenTTD master around 27c4f55

@lethosor
Copy link

lethosor commented Aug 9, 2018

I'm building exactly 27c4f55. For reference, here is andythenorth's linker command (without the LDFLAGS above) and here is mine. The only notable difference is the -liconv near the end of mine. It's worth noting that I did not modify LDFLAGS myself at all (just ran ./configure and make), so something odd is causing -liconv not to be added properly on some machines.

@glx22
Copy link
Contributor

glx22 commented Aug 9, 2018

maybe you should compare the output of your ./configure runs

@TrueBrain TrueBrain added the OS: MacOS This issue is related to a Mac OS problem label Aug 11, 2018
LordAro added a commit to LordAro/OpenTTD that referenced this issue Sep 24, 2018
@andythenorth
Copy link
Contributor Author

New fun.

Apple upgraded clang. Apple LLVM version 10.0.0 (clang-1000.11.45.2)

This now fails again, same error as originally posted in the issue. Also fails on LordAro's fixed branch.

nielsm suggested adding 'CXXFLAGS=-std=c++11' to configure flags, which works.

Currently I'm not sure all of the following flags are needed, but it compiles, and I need to sleep :P
CC=clang CXX=clang++ CXXFLAGS=-std=c++11 LDFLAGS="-liconv" ./configure

LordAro added a commit to LordAro/OpenTTD that referenced this issue Sep 30, 2018
LordAro added a commit to LordAro/OpenTTD that referenced this issue Nov 25, 2018
LordAro added a commit to LordAro/OpenTTD that referenced this issue Jan 5, 2019
@LordAro LordAro added this to the 1.9.0 milestone Jan 23, 2019
nielsmh pushed a commit to nielsmh/OpenTTD that referenced this issue Mar 11, 2019
ticky pushed a commit to ticky/OpenTTD that referenced this issue Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: MacOS This issue is related to a Mac OS problem
Projects
None yet
Development

No branches or pull requests

5 participants