mercredi 3 mai 2017

Build Boost with C++11 support for selected libraries

I'm trying to build boost (1.65) on linux with C++11 support to link with my other project (also compiled with C++11 support).

However, I get this kind of error (which seems to happen because my boost is not compiled with c++11):

undefined reference to `boost::filesystem::detail::current_path(boost::system::error_code*)'
data_parser.cc:(.text+0xf15): undefined reference to `boost::filesystem::absolute(boost::filesystem::path const&, boost::filesystem::path const&)'
data_parser.cc:(.text+0x142e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
data_parser.cc:(.text+0x1790): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'

Here is my command line:

./b2 --prefix=boost-install --with-filesystem --with-system --with-program_options --with-thread link=static variant=release cxxflags='-std=c++11' install

But I noticed during compilation if I compile without any --with- (so with all libraries), I can see this line:

- C++11 mutex              : yes

and some other lines related to c++11, however as soon as I add a --with- (e.g. --with-thread), all lines relative to c++11 disappear.

I also tried to add #define BOOST_NO_CXX11_SCOPED_ENUMS around #include <boost/filesystem.hpp> but it doesn't change anything.

I have no clue what is going on here, if someone can help me.

Thank you.

Aucun commentaire:

Enregistrer un commentaire