|
Hi,
I'm required to compile Boost with clang on OSX and C++11 support. I have used the following commands to attempt a build: ./bootstrap.sh -toolchain=clang ./bjam toolset=clang cxxflags="-std=c++0x11stdlib=libc++" threading=multi variant=release link=shared runtime-link=shared --layout=system --without-mpi --without-python --universal install --prefix=/opt/local I'm getting errors from the linker: clang-darwin.link.dll bin.v2/libs/program_options/build/clang-darwin-4.2.1/release/threading-multi/libboost_program_options.dylib Undefined symbols for architecture x86_64: "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from: boost::program_options::invalid_syntax::get_template(boost::program_options::invalid_syntax::kind_t) in cmdline.o boost::program_options::detail::cmdline::check_style(int) const in cmdline.o boost::program_options::detail::cmdline::run() in cmdline.o boost::program_options::detail::cmdline::parse_long_option(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) in cmdline.o boost::program_options::detail::cmdline::parse_disguised_long_option(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) in cmdline.o boost::program_options::detail::cmdline::parse_short_option(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&) in cmdline.o boost::program_options::detail::cmdline::finish_option(boost::program_options::basic_option<char>&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, std::__1::vector<boost::function1<std::__1::vector<boost::program_options::basic_option<char>, std::__1::allocator<boost::program_options::basic_option<char> > >, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&>, std::__1::allocator<boost::function1<std::__1::vector<boost::program_options::basic_option<char>, std::__1::allocator<boost::program_options::basic_option<char> > >, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&> > > const&) in cmdline.o Any idea what I am missing? |
|
On Wed, Jun 20, 2012 at 5:19 AM, Jürgen Simon <[hidden email]> wrote:
> I'm required to compile Boost with clang on OSX and C++11 support. I have > used the following commands to attempt a build: > ./bootstrap.sh -toolchain=clang > ./bjam toolset=clang cxxflags="-std=c++0x11stdlib=libc++" threading=multi > variant=release link=shared runtime-link=shared --layout=system > --without-mpi --without-python --universal install --prefix=/opt/local It looks like you have a typo: "-std=c++0x11stdlib=libc++" should probably be either "-std=c++0x -stdlib=libc++" or "-std=c++11 -stdlib=libc++", depending on compiler version. For not-very-recent compiler versions [both GCC & Clang], IMO you should use "-std=c++0x". Recent versions [4.7.x, at least] of GCC also accept "-std=c++11" -- and this produces exactly the same effect as "-std=c++0x", AFAIK, except that your build scripts won`t be backwards-compatible to e.g. GCC 4.5.x. It seems that the latest release of Clang supports "-std=c++11" too: http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_31/final/include/clang/Frontend/LangStandards.def Also FYI, even though I don`t recommend it: old-ish versions of GCC [and maybe Clang too] also support "gnu++0x", which means C++0x with GNU extensions, and current releases of both compilers support both that and "gnu++11", which probably means the same thing but might be closer to the real C++2011 release [rather than using some obsolete things from the pre-standard C++0x]. I hope the above helps... Regards, Abe _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
On Jun 20, 2012, at 10:03 AM, Abe wrote: > On Wed, Jun 20, 2012 at 5:19 AM, Jürgen Simon <[hidden email]> wrote: > >> I'm required to compile Boost with clang on OSX and C++11 support. I have >> used the following commands to attempt a build: > >> ./bootstrap.sh -toolchain=clang >> ./bjam toolset=clang cxxflags="-std=c++0x11stdlib=libc++" threading=multi >> variant=release link=shared runtime-link=shared --layout=system >> --without-mpi --without-python --universal install --prefix=/opt/local > > > It looks like you have a typo: "-std=c++0x11stdlib=libc++" should > probably be either "-std=c++0x -stdlib=libc++" or "-std=c++11 > -stdlib=libc++", depending on compiler version. Ok. I've looked into this a bit, and it appears to me that the problem is that the "-stdlib=libc++" is not getting passed to the linker, so it's trying to link with libstdc++. This works for me: ../../../b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" -- Marshall Marshall Clow Idio Software <mailto:[hidden email]> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
On Jun 20, 2012, at 11:05 AM, Marshall Clow wrote:
> On Jun 20, 2012, at 10:03 AM, Abe wrote: > >> On Wed, Jun 20, 2012 at 5:19 AM, Jürgen Simon <[hidden email]> wrote: >> >>> I'm required to compile Boost with clang on OSX and C++11 support. I have >>> used the following commands to attempt a build: >> >>> ./bootstrap.sh -toolchain=clang >>> ./bjam toolset=clang cxxflags="-std=c++0x11stdlib=libc++" threading=multi >>> variant=release link=shared runtime-link=shared --layout=system >>> --without-mpi --without-python --universal install --prefix=/opt/local >> >> >> It looks like you have a typo: "-std=c++0x11stdlib=libc++" should >> probably be either "-std=c++0x -stdlib=libc++" or "-std=c++11 >> -stdlib=libc++", depending on compiler version. > > > Ok. I've looked into this a bit, and it appears to me that the problem is that the "-stdlib=libc++" is not getting passed to the linker, so it's trying to link with libstdc++. > > This works for me: > ../../../b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" I forgot to credit Howard Hinnant, who did some (most?) of the investigation here. Shame on me. -- Marshall Marshall Clow Idio Software <mailto:[hidden email]> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
|
In reply to this post by Abe Skolnik
Hello,
although the line copied into here was garbled, it was not a typo. I had the right flags but I was missing linkflags. I managed to compile Boost with this. Now I got gtest acting up, but that's a different matter. Thanks, fellas! On 20.06.2012, at 19:03, Abe wrote: > On Wed, Jun 20, 2012 at 5:19 AM, Jürgen Simon <[hidden email]> wrote: > >> I'm required to compile Boost with clang on OSX and C++11 support. I have >> used the following commands to attempt a build: > >> ./bootstrap.sh -toolchain=clang >> ./bjam toolset=clang cxxflags="-std=c++0x11stdlib=libc++" threading=multi >> variant=release link=shared runtime-link=shared --layout=system >> --without-mpi --without-python --universal install --prefix=/opt/local > > > It looks like you have a typo: "-std=c++0x11stdlib=libc++" should > probably be either "-std=c++0x -stdlib=libc++" or "-std=c++11 > -stdlib=libc++", depending on compiler version. > > For not-very-recent compiler versions [both GCC & Clang], IMO you > should use "-std=c++0x". Recent versions [4.7.x, at least] of GCC > also accept "-std=c++11" -- and this produces exactly the same effect > as "-std=c++0x", AFAIK, except that your build scripts won`t be > backwards-compatible to e.g. GCC 4.5.x. > > It seems that the latest release of Clang supports "-std=c++11" too: > > http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_31/final/include/clang/Frontend/LangStandards.def > > > Also FYI, even though I don`t recommend it: old-ish versions of GCC > [and maybe Clang too] also support "gnu++0x", which means C++0x with > GNU extensions, and current releases of both compilers support both > that and "gnu++11", which probably means the same thing but might be > closer to the real C++2011 release [rather than using some obsolete > things from the pre-standard C++0x]. > > I hope the above helps... > > Regards, > > Abe > _______________________________________________ > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build |
| Powered by Nabble | Edit this page |
