Project

General

Profile

Building on OSX 10.8 Mountain Lion

Added by Colin Dean over 11 years ago

I'm attempting to build the head of the git as of today on OSX 10.8 and encountering a build error.

g++ -c -pipe -std=c++11 -stdlib=libc++ -std=c++0x -O2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -fPIC -Wall -Wno-parentheses -DCOMMON_LIBRARY -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/macx-g++ -I. -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtCore -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtNetwork.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtNetwork -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include -I. -I.. -I. -I.. -I.tmp/release -F/Users/colin/Source/QtSDK/Desktop/Qt/4.8.1/gcc/lib -o .tmp/release/Hash.o Hash.cpp
cc1plus: error: unrecognized command line option "-std=c++11" 
cc1plus: error: unrecognized command line option "-stdlib=libc++" 
cc1plus: error: unrecognized command line option "-std=c++0x" 
make: *** [.tmp/release/Hash.o] Error 1
make: Leaving directory `/Users/colin/Source/D-LAN/application/Common'

Full output:
https://gist.github.com/3201289

With a few updates, I followed the [[http://dev.d-lan.net/projects/pmp/wiki/Howtos_-_Hack_on_Mac_OS_X|Hack on Mac OS X]] wiki page and hit this when running the new and improved rebuild script.

I think it may be related to the script using my system's g++, which is LLVM-based:

[colin@kid application]$ g++ --version
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

I've installed Protocol Buffers using Homebrew with brew install protobuf protobuf-c and that resolved some earlier compilation issues.

Does QtCreator come with its own g++ that is not in use? I may have to install ye olde gcc to get the kind of g++ that D-LAN expects.


Replies (8)

RE: Building on OSX 10.8 Mountain Lion - Added by Colin Dean over 11 years ago

I noticed in the build settings (Project section > Targets > Build Settings > General > Tool Chain) that it apparently defaults to GCC. I changed this option to Clang, but there's no difference in the output.

RE: Building on OSX 10.8 Mountain Lion - Added by Greg Burri over 11 years ago

Hi,
This how-to is a bit old and I didn't try to recompile D-LAN on Mac OS X for a long time. The "official" Mac OS X developer is in holiday right now, I will suggest him to update the how-to when he comes back.

Actually I suggest you to use Clang 3.1 (from the last XCode maybe!?) and the branch 'master', GCC 4.2 is far too old.

Pay attention about these two things:

Cya.

RE: Building on OSX 10.8 Mountain Lion - Added by Greg Burri over 11 years ago

I advise you to build D-LAN only from Qt Creator (using its toolchain configuration) for the moment. I'm sorry but just a little work has been done for the Mac OS X platform.

RE: Building on OSX 10.8 Mountain Lion - Added by Colin Dean over 11 years ago

Thank you, Greg. I've made a little progress after removing the -f Makefile-Core from the make arguments in the build configuration:

clang++ -c -pipe -std=c++11 -stdlib=libc++ -std=c++0x -g -gdwarf-2 -arch x86_64 -fPIC -Wall -Wno-parentheses -DDEBUG -DCOMMON_LIBRARY -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/unsupported/macx-clang -I. -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtCore -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtNetwork.framework/Versions/4/Headers -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include/QtNetwork -I../../../QtSDK/Desktop/Qt/4.8.1/gcc/include -I. -I.. -I. -I.. -I.tmp/debug -F/Users/colin/Source/QtSDK/Desktop/Qt/4.8.1/gcc/lib -o .tmp/debug/Hash.o Hash.cpp
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
make[1]: *** [.tmp/debug/Hash.o] Error 1
make: *** [sub-Common-make_default-ordered] Error 2
make[1]: Leaving directory `/Users/colin/Source/D-LAN/application/Common'
make: Leaving directory `/Users/colin/Source/D-LAN/application'

Perhaps some part of QtCreator hasn't yet been updated for OSX 10.8. When I commented out the -stdlib=libc++ from Common/common.pri (just for science), I get all kinds of "This version of Mac OS X is unsupported" out of the compilation process from parts of Qt.

https://gist.github.com/3201614

I think for now I'll just sit tight and wait for the Mac dev to return from holiday. This here Ruby dev isn't afraid of C/C++ stuff, but when it comes to build systems, I get a little lost ;-)

RE: Building on OSX 10.8 Mountain Lion - Added by Colin Dean over 11 years ago

Reading up a little, it's clear that the stdlib line has to be there in order to get STL support ;-)

For now, I'm satisfied with blaming Qt Creator and I'll rest on that for the day!

RE: Building on OSX 10.8 Mountain Lion - Added by Colin Dean over 11 years ago

I decided to take another shot tonight, having updated to OSX 10.8.1, QtCreator 4.8.2, and Qt 5.0.0-beta1

https://gist.github.com/3546582

I think this might be a bug in Qt 5.0.0-beta1 - it appears to be missing a header file.

RE: Building on OSX 10.8 Mountain Lion - Added by Colin Dean over 11 years ago

I found that the initializer_list missing is an artifact of commenting out the -stdlib=libc++ in common.pri. I uncommented it and rebuilt, and I'm back to the error I'd been getting originally:

clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)

So, I did a little more research and came across http://www.mail-archive.com/interest@qt-project.org/msg02225.html. The conversation just kinda dies without resolution.

I am running the updated Command Line Tools and restarted QtCreator after installing them.

    (1-8/8)