Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile Boost with an older std of C++? (C++03 in particular)

I am working in a project dependent of Boost (http://kratos-wiki.cimne.upc.edu/index.php/Main_Page), this project currently only supports C++03. With the last update of gcc++ (v.5) the C++11 has become the default std, technically I solved the problem modifying the CXX_FLAGS adding:

-std=c++03

The problem comes with the Boost library, which I am not able to compile with the C++03 std (I think, I don't know how to check with which std I have compiled). I tried employing the following command to compile Boost:

./b2 install stage --with-python --with-serialization cxxflags="-std=c++03"

I have tried too modify the Jamroot file, adding the following lines:

  <toolset>gcc:<cxxflags>-std=gnu++03
  <toolset>clang:<cxxflags>-std=c++03

But the problem persist, when I compile the whole project I obtain the following kind of warning (several times):

/usr/local/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")

That's why I suspect that my changes do not take effect.

Thank you very much for your help

like image 902
user5288 Avatar asked Dec 27 '15 12:12

user5288


1 Answers

I think you can safely ignore those warnings for now. I am compiling boost 1_60_0 with gcc 5.2.1 and std=c++11, and I get the same warnings. There is a ticket on it, but meanwhile it hasn't caused me any problems at this time. I commented out the two [#pragma warning] lines in the boost code, so I don't get a lot of distracting output in my build:

boost/type_traits/detail/template_arity_spec.hpp line 13:

// noisy: # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")

boost/type_traits/detail/bool_trait_def.hpp line 18:

// noisy: # pragma message ("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")

UPDATE The problem still exists in boost 1.61.0. I used the same exact fix again.

like image 188
moodboom Avatar answered Sep 19 '22 21:09

moodboom