C++11 on Mountain Lion and lower?

Chris Jones jonesc at hep.phy.cam.ac.uk
Tue Dec 3 06:23:19 PST 2013


Hi,

I am not an expert, but based on the discussion in

https://trac.macports.org/ticket/39975

my understanding is there is no easy way to enable c++11 on systems 
older than 10.9 using the current MacPorts release. You need to use the 
libc++ runtime by default everywhere, not, libstdc++, and this is only 
the case on Mavericks.

MacPorts base in the trunk has the option to force the use of libc++ 
instead of libstdc++. See comment 19 in the above. This though requires 
the user to, use trunk, manually edit macports.conf then rebuild all 
their ports. I don't know if its the plan to ever do this by default on 
OSX10.8 or older...

Chris

In 03/12/13 14:09, Clemens Lang wrote:
> Hi,
>
> does anybody know how I can compile C++11 code on Mountain Lion and
> lower without using libc++?
>
> The problem I face is that rethinkdb uses std::move (and probably other
> features) from C++11. To do this, it checks for the clang compiler and
> passes -stdlib=libc++ in CXXFLAGS if it detects clang on OS X.
>
> Rethinkdb also uses protobuf-cpp, which requires linking against
> libprotobuf.dylib. However, libprotobuf is built against libstdc++. This
> leads to the following problem when rethinkdb tries to use protobuf:
>
>> Error: Unable to compile sample protobuf file. Try running ./configure with the --fetch protoc option
>> Undefined symbols for architecture x86_64:
>>    "google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))", referenced from:
>>        protobuf_AddDesc_mk_2fgen_2fprotoc_2ftest_2eproto() in test-umpU92.o
>>    "google::protobuf::DescriptorPool::FindFileByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
>>        protobuf_AssignDesc_mk_2fgen_2fprotoc_2ftest_2eproto() in test-umpU92.o
>
> So the problem is that the linker is looking for the symbol in
> libprotobuf that was compiled against libc++ (see the usage of
> std::__1::basic_string, which is specific to libc++), but cannot find
> the symbol, because libprotobuf has been compiled against libstdc++.
>
> Any ideas how to fix this? Should I just pass --fetch protoc --static
> protoc to have rethinkdb compile a local version of protobuf?
>



More information about the macports-dev mailing list