Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Fix for OS X Mavericks (10.9) compilation and build errors

Francesco Romano edited this page Mar 25, 2014 · 5 revisions

Update

Orocos KDL has been updated to correctly support libc++. KDL_Codyco is being updated to correctly handle the new Orocos KDL version.

A new issue has arose with Xcode 5.1/Clang 5.1. The simulink library can be compiled only under c++11 and libc++, so until proper testing it is strongly advised to not update to Clang 5.1

Original page

Starting from Mac OSX 10.9 (Mavericks) the default C++ standard library changed to libc++ (the LLVM library). This switch has caused (and still causes) a lot of issues because the new library is more stringent on non-standard C++. For example Orocos KDL uses non-standard C++ in the TreeNode class thus it is not possible to build it with libc++ (see related Github issue).

You can (and must) build KDL by explicitly specify the old GNU C++ library. You can do this by adding to CMAKE_CXX_FLAGS and CMAKE_EXE_LINKER_FLAGS the following string: -stdlib=libstdc++.

Currently if you generate an Xcode project or if you generate a Unix Makefile under OS X the above fix is done automatically for you.

One issue still remains. It is not clear if two applications can link (shared linking, not static linking) at the same time the GNU and LLVM C++ library. For sure Homebrew does not allow it. You can check which shared libraries an application (or another shared library) links by issuing the following commands:

otool -L library_name

E.g.

$ otool -L libYARP_OS.dylib 
local/lib/libYARP_OS.dylib:
    libYARP_OS.1.dylib (compatibility version 1.0.0, current version 2.3.60)
    /usr/local/lib/libACE.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
Clone this wiki locally