c++11 with ROS on OSX
Hi all,
we have some packages developed with c++11 features, which was no problem on Ubuntu. We'd like to use it on osx now as well, which seems to be harder than we thought. From what I understood so far, clang (shipped with the latest version of Xcode) does support c++11, when using the -stdlib=libc++
flag. However, this causes issues (especially std::string) when linking against libstdc++, which is the case for all homebrew-built libraries and for ROS by default as well. Linking is fine, but runtime crashes occur whenever std objects are passed between the libraries.
As libstdc++ seems not to be further developed, the cleanest solution would probably be to get homebrew to use libc++. There is a discussion about it here: https://github.com/mxcl/homebrew/issues/9314 . However, it seems like this is not going to move forward soon.
We could now start fixing the homebrew dependencies to use libc++, but that would most likely cause issues with some other libs built against libstdc++ ...
Any idea or thought to work around this? Or am I missing anything? I'd dislike porting back all our c++11 code.
Thanks a lot, Markus
This is probably out of the scope of ROS answers, this will involve setting up your system to build using `libc++` for everything. As @joq pointed out, we haven't committed to explicitly supporting c++11 in ROS, but it sounds like to me it works on Linux? Anyways if you find out how to manage this on OS X or find more details into what is causing the issues let me know.
I thought it would be worth discussing it here as well. c++11 works fine for us under linux since gcc 4.6 if I remember it correct. I just checked, it links to libstdc++. However, it seems quite old on osx. I'll let you know when I find something out,but I'm almost giving up on this for near future.