Has anyone used libc++ successfully in FreeBSD 10?
I'm working on a project where I recently decided to use the C++11 implementation of smart pointers, which requires LLVM's libc++ library on FreeBSD. After failing to get libc++ to work on my FreeBSD 9.1 system following the instructions at http://lists.freebsd.org/pipermail/freebsd-stable/2012-May/067645.html, I installed the May 15 snapshot of FreeBSD 10 since it is supposed to be built (or rather still being built) on the new C++ stack described at https://wiki.freebsd.org/NewC++Stack. Unfortunately, I'm getting linker errors because apparently libstdc++ is still getting tied up with my code.
For building the software, I'm using scons, and clang++ is being used for compiling the code. The build environment is set up in the sconstruct file as so:
Above, scons is told to use clang++ for compiling the C++ code, the C++11 standard, and the libc++ standard library. I get pages full of errors similar to the error shown below:
I even have /etc/libmap.conf with the following entry:
If I remove the flags for using C++11 and libc++ from my sconstruct file, the code compiles successfully (I haven't added any C++11 features to my code, yet). When I run ldd -a on the finished executable, I'm seeing entries for libstdc++ associated with libraries like Boost:
I'm fairly certain I used libc++ when building and installing the ports for Boost. Why would libstdc++ be associated with Boost on my system? I even made sure to add the following to my /etc/make.conf before installing any ports on my FreeBSD 10 system:
Can anyone tell me how I might be able to remove any dependencies in my code for libstdc++? Or how can I use libstdc++ and libc++ together successfully? What might I be doing wrong?
Any help on this would be greatly appreciated. If I can't get libc++ to work in FreeBSD in the next few days, unfortunately, I'm going to have to go back to a GNU/Linux-based distribution for my system. I really don't want to give up on FreeBSD because of this one issue, but this one issue is definitely a show-stopper.
I'm working on a project where I recently decided to use the C++11 implementation of smart pointers, which requires LLVM's libc++ library on FreeBSD. After failing to get libc++ to work on my FreeBSD 9.1 system following the instructions at http://lists.freebsd.org/pipermail/freebsd-stable/2012-May/067645.html, I installed the May 15 snapshot of FreeBSD 10 since it is supposed to be built (or rather still being built) on the new C++ stack described at https://wiki.freebsd.org/NewC++Stack. Unfortunately, I'm getting linker errors because apparently libstdc++ is still getting tied up with my code.
For building the software, I'm using scons, and clang++ is being used for compiling the code. The build environment is set up in the sconstruct file as so:
Code:
env = Environment(PREFIX = GetOption('prefix'), CXX='clang++', CPPFLAGS='-g -std=c++11 -stdlib=libc++')
Above, scons is told to use clang++ for compiling the C++ code, the C++11 standard, and the libc++ standard library. I get pages full of errors similar to the error shown below:
Code:
undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()'
I even have /etc/libmap.conf with the following entry:
Code:
libsupc++.so.1 libcxxrt.so
If I remove the flags for using C++11 and libc++ from my sconstruct file, the code compiles successfully (I haven't added any C++11 features to my code, yet). When I run ldd -a on the finished executable, I'm seeing entries for libstdc++ associated with libraries like Boost:
Code:
/usr/local/lib/libboost_thread.so.5:
libboost_system.so.5 => /usr/local/lib/libboost_system.so.5 (0x2860d000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x283af000)
libm.so.5 => /lib/libm.so.5 (0x28498000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x284b5000)
libthr.so.3 => /lib/libthr.so.3 (0x28610000)
libc.so.7 => /lib/libc.so.7 (0x284c0000)
I'm fairly certain I used libc++ when building and installing the ports for Boost. Why would libstdc++ be associated with Boost on my system? I even made sure to add the following to my /etc/make.conf before installing any ports on my FreeBSD 10 system:
Code:
CC=clang
CXX=clang++
CPP=clang-cpp
WITH_LIBCPLUSPLUS=yes
Can anyone tell me how I might be able to remove any dependencies in my code for libstdc++? Or how can I use libstdc++ and libc++ together successfully? What might I be doing wrong?
Any help on this would be greatly appreciated. If I can't get libc++ to work in FreeBSD in the next few days, unfortunately, I'm going to have to go back to a GNU/Linux-based distribution for my system. I really don't want to give up on FreeBSD because of this one issue, but this one issue is definitely a show-stopper.