scp-fs2open / PCS2

A tool to convert and edit models for use in FreeSpace 2 and FreeSpace Open
3 stars 11 forks source link

OS X compilation issue #12

Open chief1983 opened 7 years ago

chief1983 commented 7 years ago

Looks like we may need to only use the c++11 standard definition with .cpp files? I tried with an older minimum Mac OS X version but it still uses the most recent framework available so not much else I can do I don't think. Are we currently applying CXXFLAGS to CFLAGS, or the equivalent, with this CMake setup?

CompileC build/src/PCS2.build/Release/pcs2.build/Objects-normal/x86_64/GLee.o src/GLee.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/cliffgordon/scp/PCS2
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch x86_64 -fmessage-length=256 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Release\" -DILUT_USE_OPENGL -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -DUNIX -DHAVE_SYS_TYPES_H -DHAVE_SYS_STAT_H -DHAVE_UNISTD_H -DUSE_SDL -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -mmacosx-version-min=10.9 -Wno-sign-conversion -Wno-infinite-recursion -I/Users/cliffgordon/scp/PCS2/build/src/Release/include -I/Users/cliffgordon/scp/PCS2/src/pugixml -I/Users/cliffgordon/scp/PCS2/src/../res -I/usr/local/include -I/usr/local/include/IL -I/usr/local/lib/wx/include/osx_cocoa-unicode-3.0 -I/usr/local/include/wx-3.0 -I/Users/cliffgordon/Library/Frameworks/SDL.framework/Headers -I/Users/cliffgordon/scp/PCS2/src/fmt -I/Users/cliffgordon/scp/PCS2/build/src/PCS2.build/Release/pcs2.build/DerivedSources/x86_64 -I/Users/cliffgordon/scp/PCS2/build/src/PCS2.build/Release/pcs2.build/DerivedSources -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -F/Users/cliffgordon/scp/PCS2/build/src/Release -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks -F/Users/cliffgordon/Library/Frameworks -DNDEBUG -fPIE -I/usr/local/include/wx-3.0 -std=c++11 -MMD -MT dependencies -MF /Users/cliffgordon/scp/PCS2/build/src/PCS2.build/Release/pcs2.build/Objects-normal/x86_64/GLee.d --serialize-diagnostics /Users/cliffgordon/scp/PCS2/build/src/PCS2.build/Release/pcs2.build/Objects-normal/x86_64/GLee.dia -c /Users/cliffgordon/scp/PCS2/src/GLee.c -o /Users/cliffgordon/scp/PCS2/build/src/PCS2.build/Release/pcs2.build/Objects-normal/x86_64/GLee.o
error: invalid argument '-std=c++11' not allowed with 'C/ObjC'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
niffiwan commented 7 years ago

the cmake setup is probably incorrect, and there's 3rd party files just chucked in with the PCS2 code. i.e. GLee is 3rd party & should be moved to src/glee.

Or maybe it should be changed to be more like fso; and move all 3rd party stuff into ../lib/DIR (including fmt, pugixml & Glee)

niffiwan commented 7 years ago

Maybe @asarium can offer some suggestions on fixing the cmake config?

chief1983 commented 7 years ago

Yeah if that's the way to get per-project compilation options it probably needs to be done. I think older compilers were more lax about this, older LLVM apparently treated it as a warning. Now it's a halting error.

niffiwan commented 7 years ago

ah yes, g++ on 'buntu 16.04 is still treating it as a warning so I didn't worry too much about it before...

countbuggula commented 7 years ago

Benklop's got a fix for it - we're just testing it and if we can get it to work he'll submit the fix.

asarium commented 7 years ago

C++11 is supposed to be handled by the CMake function target_compile_features. Apparently that is currently not used by the PCS2 CMake setup.

niffiwan commented 7 years ago

@countbuggula any news on the fix being tested by Benklop?

chief1983 commented 7 years ago

Since FreeBSD is using a new clang version as well, this is also blocking PCS2 from compiling there. Any word on a solution to getting our third party libs from using the same defines as our C++ code?

chief1983 commented 7 years ago

@countbuggula ping :)

chief1983 commented 7 years ago

Bueller?

countbuggula commented 7 years ago

Well, I changed jobs and no longer have Mac so I need to check with benklop and see what he has. Thanks for the reminder.

On Sat, Jun 3, 2017, 9:47 AM Cliff Gordon notifications@github.com wrote:

Bueller?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scp-fs2open/PCS2/issues/12#issuecomment-305983039, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjTNmMTpBK7XojNBMHewse78eWsUFnvks5sAYAPgaJpZM4LF_TU .

chief1983 commented 6 years ago

After looking into this, it actually seemed to have come from fmt's own CMake config file. fmt avoids setting the CPP11_FLAG argument if a CXX standard is defined within CMake already, so I tested defining one on the command line and that caused this error to stop. A solution therefore might be to permanently define the C++11 standard within our main CMake files and the fmt one should avoid setting it in a way that conflicts with C files.

Goober5000 commented 3 years ago

A solution therefore might be to permanently define the C++11 standard within our main CMake files

I think this has been done. Can this be closed?

chief1983 commented 3 years ago

I haven't tried compiling PCS2 in ages so I can't confirm or deny this is still an issue. I can try it again on my Macbook and see if something similar is still happening. But if we see an actual change has been made to the repo to account for this since it was filed, then we can go ahead and close it out and I'll file a new or reopen this if I run into any issues next time I try compiling it.

Goober5000 commented 3 years ago

I don't actually know for sure whether the change has been made. I thought it had been, but I don't have a Mac to check.

countbuggula commented 3 years ago

I'm following up with Benklop again to see if he remembers submitting any changes.

chief1983 commented 3 years ago

I was thinking more like just looking at the PR history, would myself but lazy since I keep replying to this thread when I'm on my phone

countbuggula commented 3 years ago

From Benklop: "The laptop I was testing on Sat the time very much died, I'm sure if I found a solution I would have submitted it so you'd see it in the commit history"

benklop commented 3 years ago

I do have a mac now too, just a different one. I can try and confirm this issue or its resolution some time this week.

chief1983 commented 3 years ago

Still getting:

CompileC build/src/PCS2.build/Debug/pcs2.build/Objects-normal/x86_64/GLee.o src/GLee.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/cliff/PCS2
    export LANG=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -target x86_64-apple-macos10.15 -fmessage-length=221 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -DCMAKE_INTDIR=\"Debug\" -DILUT_USE_OPENGL -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -DUNIX -DHAVE_SYS_TYPES_H -DHAVE_SYS_STAT_H -DHAVE_UNISTD_H -DUSE_SDL -DBOOST_ALL_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_REGEX_DYN_LINK -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -I/Users/cliff/PCS2/build/src/Debug/include -I/Users/cliff/PCS2/src/pugixml -I/Users/cliff/PCS2/src/../res -I/usr/local/include/IL -I/usr/local/lib/wx/include/osx_cocoa-unicode-3.0 -I/usr/local/include/wx-3.0 -I/Users/cliff/Library/Frameworks/SDL.framework/Headers -I/Users/cliff/PCS2/src/fmt -isystem /usr/local/include -I/Users/cliff/PCS2/build/src/PCS2.build/Debug/pcs2.build/DerivedSources-normal/x86_64 -I/Users/cliff/PCS2/build/src/PCS2.build/Debug/pcs2.build/DerivedSources/x86_64 -I/Users/cliff/PCS2/build/src/PCS2.build/Debug/pcs2.build/DerivedSources -F/Users/cliff/PCS2/build/src/Debug -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks -F/Users/cliff/Library/Frameworks -fPIE -std=c++11 -g -MMD -MT dependencies -MF /Users/cliff/PCS2/build/src/PCS2.build/Debug/pcs2.build/Objects-normal/x86_64/GLee.d --serialize-diagnostics /Users/cliff/PCS2/build/src/PCS2.build/Debug/pcs2.build/Objects-normal/x86_64/GLee.dia -c /Users/cliff/PCS2/src/GLee.c -o /Users/cliff/PCS2/build/src/PCS2.build/Debug/pcs2.build/Objects-normal/x86_64/GLee.o
error: invalid argument '-std=c++11' not allowed with 'C'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

** BUILD FAILED **