C++11 on Mountain Lion and lower?

Clemens Lang cal at macports.org
Tue Dec 3 06:38:14 PST 2013


On Tue, Dec 03, 2013 at 03:09:10PM +0100, Clemens Lang wrote:
> 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:
> 
> [...]
>
> 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++.

To follow up: the ML buildbot just succeeded building rethinkdb using
FSF GCC 4.8 (obviously using MacPorts libstdc++). I guess the binaries
will now use both
  - /opt/local/lib/libstdc++.dylib and
  - /usr/lib/libstdc++.dylib,
but I suppose that will cause a lot less problems than mixing libc++ and
libstdc++. Obviously this solution should only be used for ports that do
*not* export a C++ API.

-- 
Clemens Lang



More information about the macports-dev mailing list