Adding libc++ support to boost.

Hello, I want to add support for libc++, the c++ standard library attached to clang, to boost. Fixes required should not be attached to clang, as clang can use various standard libraries. Is there a standard way I should add the library, or just add the macro where needed. The best macro to use for detecting libc++ is _LIBCPP_VERSION. Hopefully the changes required will be minimal. One place where libc++ needs to be mentioned in is detail/container_fwd.hpp, as forward declarations simply don't work. Can I just attach _LIBCPP_VERSION to: #if defined(BOOST_DETAIL_NO_CONTAINER_FWD) \ || ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) \ && (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \ || BOOST_WORKAROUND(__BORLANDC__, > 0x551) \ || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \ || (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) Or is there a better / more offical way libc++ should be worked in? Chris

On 02/10/11 14:27, Christopher Jefferson wrote:
Hello,
I want to add support for libc++, the c++ standard library attached to clang, to boost. Fixes required should not be attached to clang, as clang can use various standard libraries. Is there a standard way I should add the library, or just add the macro where needed.
The best macro to use for detecting libc++ is _LIBCPP_VERSION. Hopefully the changes required will be minimal.
The following instructions for installing libc++: http://libcxx.llvm.org/ are Mac OS X 10.6 oriented. To install on linux, you'll need to make some changes to those instructions: http://llvm.org/bugs/show_bug.cgi?id=9153 Also, the following modification needs to be made for use of std::cout in libcxx to be useful on linux: http://llvm.org/bugs/show_bug.cgi?id=8992#c7 HTH. -Larry

On 10 Feb 2011, at 21:01, Larry Evans wrote:
On 02/10/11 14:27, Christopher Jefferson wrote:
Hello,
I want to add support for libc++, the c++ standard library attached to clang, to boost. Fixes required should not be attached to clang, as clang can use various standard libraries. Is there a standard way I should add the library, or just add the macro where needed.
The best macro to use for detecting libc++ is _LIBCPP_VERSION. Hopefully the changes required will be minimal.
The following instructions for installing libc++:
are Mac OS X 10.6 oriented. To install on linux, you'll need to make some changes to those instructions:
http://llvm.org/bugs/show_bug.cgi?id=9153
Also, the following modification needs to be made for use of std::cout in libcxx to be useful on linux:
Thanks, I am already happily running libc++ on mac, and running the boost regression tester (which is failing in lots of ways, which I want to fix). Chris

On 02/10/11 15:12, Christopher Jefferson wrote: [snip]
Thanks, I am already happily running libc++ on mac, and running the boost regression tester (which is failing in lots of ways, which I want to fix).
This may be related. When compiling the attached, I get: /home/evansl/download/llvm/svn/build/Debug+Asserts/bin/clang++ -c -std=gnu++0x -stdlib=libc++ -D__GXX_EXPERIMENTAL_CXX0X__ -I/home/evansl/prog_dev/boost-svn/ro/sandbox/rw/variadic_templates -I/home/evansl/prog_dev/boost-svn/ro/sandbox/ro/switch -I/home/evansl/prog_dev/boost-svn/ro/trunk -DTEMPLATE_DEPTH=300 boost_test_impl_debug.cpp -MMD -o /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/clangxx/clang/boost_test_impl_debug.o In file included from boost_test_impl_debug.cpp:1: /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/impl/debug.ipp:737:34: error: no viable conversion from 'unit_test::readwrite_property<std::string>' to 'key_type' (aka 'std::__1::basic_string<char>') s_info.m_dbg_starter_reg[s_info.p_dbg] = s; ^~~~~~~~~~~~ In file included from boost_test_impl_debug.cpp:1: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/impl/debug.ipp:21: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/detail/global_typedef.hpp:18: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/utils/basic_cstring/basic_cstring.hpp:21: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/utils/basic_cstring/bcs_char_traits.hpp:25: /usr/include/c++/v1/string:1032:5: note: candidate constructor not viable: no known conversion from 'unit_test::readwrite_property<std::string>' to 'const std::__1::basic_string<char> &' for 1st argument basic_string(const basic_string& __str); ^ /usr/include/c++/v1/string:1036:5: note: candidate constructor not viable: no known conversion from 'unit_test::readwrite_property<std::string>' to 'std::__1::basic_string<char> &&' for 1st argument basic_string(basic_string&& __str); ^ /usr/include/c++/v1/string:1040:31: note: candidate constructor not viable: no known conversion from 'unit_test::readwrite_property<std::string>' to 'const_pointer' (aka 'const char *') for 1st argument _LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s); ^ /usr/include/c++/v1/string:1060:5: note: candidate constructor not viable: no known conversion from 'unit_test::readwrite_property<std::string>' to 'initializer_list<value_type>' for 1st argument basic_string(initializer_list<value_type> __il); ^ In file included from boost_test_impl_debug.cpp:1: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/impl/debug.ipp:56: /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/utils/class_properties.hpp:59:5: note: candidate function operator read_access_t() const { return value; } ^ In file included from boost_test_impl_debug.cpp:1: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/impl/debug.ipp:61: /usr/include/c++/v1/map:798:40: note: passing argument to parameter '__k' here mapped_type& operator[](key_type&& __k); ^ In file included from boost_test_impl_debug.cpp:1: /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/impl/debug.ipp:886:56: error: no viable conversion from 'unit_test::readwrite_property<std::string>' to 'key_type' (aka 'std::__1::basic_string<char>') dbg_starter starter = s_info.m_dbg_starter_reg[s_info.p_dbg]; ^~~~~~~~~~~~ In file included from boost_test_impl_debug.cpp:1: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/impl/debug.ipp:21: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/detail/global_typedef.hpp:18: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/utils/basic_cstring/basic_cstring.hpp:21: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/utils/basic_cstring/bcs_char_traits.hpp:25: /usr/include/c++/v1/string:1032:5: note: candidate constructor not viable: no known conversion from 'unit_test::readwrite_property<std::string>' to 'const std::__1::basic_string<char> &' for 1st argument basic_string(const basic_string& __str); ^ /usr/include/c++/v1/string:1036:5: note: candidate constructor not viable: no known conversion from 'unit_test::readwrite_property<std::string>' to 'std::__1::basic_string<char> &&' for 1st argument basic_string(basic_string&& __str); ^ /usr/include/c++/v1/string:1040:31: note: candidate constructor not viable: no known conversion from 'unit_test::readwrite_property<std::string>' to 'const_pointer' (aka 'const char *') for 1st argument _LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s); ^ /usr/include/c++/v1/string:1060:5: note: candidate constructor not viable: no known conversion from 'unit_test::readwrite_property<std::string>' to 'initializer_list<value_type>' for 1st argument basic_string(initializer_list<value_type> __il); ^ In file included from boost_test_impl_debug.cpp:1: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/impl/debug.ipp:56: /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/utils/class_properties.hpp:59:5: note: candidate function operator read_access_t() const { return value; } ^ In file included from boost_test_impl_debug.cpp:1: In file included from /home/evansl/prog_dev/boost-svn/ro/trunk/boost/test/impl/debug.ipp:61: /usr/include/c++/v1/map:798:40: note: passing argument to parameter '__k' here mapped_type& operator[](key_type&& __k); ^ 2 errors generated.

AMDG On 2/10/2011 12:27 PM, Christopher Jefferson wrote:
I want to add support for libc++, the c++ standard library attached to clang, to boost. Fixes required should not be attached to clang, as clang can use various standard libraries. Is there a standard way I should add the library, or just add the macro where needed.
You should add a header in boost/config/stdlib/ for libc++ and update boost/config/select_stdlib_config.hpp. Other than that, patches should be applied as needed.
The best macro to use for detecting libc++ is _LIBCPP_VERSION. Hopefully the changes required will be minimal.
One place where libc++ needs to be mentioned in is detail/container_fwd.hpp, as forward declarations simply don't work. Can I just attach _LIBCPP_VERSION to:
#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) \ || ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) \ && (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \ || BOOST_WORKAROUND(__BORLANDC__,> 0x551) \ || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \ || (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
Or is there a better / more offical way libc++ should be worked in?
In Christ, Steven Watanabe

On Thu, Feb 10, 2011 at 4:10 PM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
On 2/10/2011 12:27 PM, Christopher Jefferson wrote:
I want to add support for libc++, the c++ standard library attached to clang, to boost. Fixes required should not be attached to clang, as clang can use various standard libraries. Is there a standard way I should add the library, or just add the macro where needed.
You should add a header in boost/config/stdlib/ for libc++ and update boost/config/select_stdlib_config.hpp. Other than that, patches should be applied as needed.
Yep, that's the place to start. Please be careful with changes to boost/config/select_stdlib_config.hpp, since changes to it cause massive amounts of recompilation. --Beman

On 02/10/11 14:27, Christopher Jefferson wrote:
Hello,
I want to add support for libc++, the c++ standard library attached to clang, to boost. Fixes required should not be attached to clang, as clang can use various standard libraries. Is there a standard way I should add the library, or just add the macro where needed.
The best macro to use for detecting libc++ is _LIBCPP_VERSION. Hopefully the changes required will be minimal.
Unfortunately, libc++, as of a few weeks ago, was having problems with a simple hello world program: http://llvm.org/bugs/show_bug.cgi?id=8992#c7 A partial solution for linux was proposed here: http://article.gmane.org/gmane.comp.compilers.clang.devel/13110 However, that wouldn't handle microsoft's standard lib, as indicated here: http://article.gmane.org/gmane.comp.compilers.clang.devel/13151 I'd guess Howard would appreciate feedback on how to do solve the microsoft problem (as well as any other platform) on that thread. -regards, Larry

On 17 Feb 2011, at 12:19, Larry Evans wrote:
On 02/10/11 14:27, Christopher Jefferson wrote:
Hello,
I want to add support for libc++, the c++ standard library attached to clang, to boost. Fixes required should not be attached to clang, as clang can use various standard libraries. Is there a standard way I should add the library, or just add the macro where needed.
The best macro to use for detecting libc++ is _LIBCPP_VERSION. Hopefully the changes required will be minimal.
Unfortunately, libc++, as of a few weeks ago, was having problems with a simple hello world program:
While libc++'s support for linux and windows is poor, on Mac OS X it is complete and works great. I am already compiling large c++ programs using a bug-fixed boost, using clang and libc++ on the mac. So far I have only found one issue in libc++, already fixed, and one issue in clang, which should be fixed soon. If people want to work on getting libc++ working on linux and windows, that is great. Once they work, the configuration for libc++ in boost might need extending, based on operating system. Chris
participants (4)
-
Beman Dawes
-
Christopher Jefferson
-
Larry Evans
-
Steven Watanabe