
On 6/11/2017 04:51, Alex Luya wrote:
Under ubuntu 16,04 I have built latest boost 1.65.1 like this:
./bootstrap.sh --prefix=/usr/local ./b2 sudo ./b2 install sudo ldconfig
then when building something against boost,I got these errors:
/usr/local/include/boost/serialization/access.hpp: In instantiation of ‘static void boost::serialization::access::serialize(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive; T = std::array<std::__cxx11::basic_string<char>, 10ul>]’: [...] /usr/local/include/boost/archive/basic_text_oarchive.hpp:83:9: required from ‘void boost::archive::basic_text_oarchive<Archive>::save_override(T&) [with T = const std::array<std::__cxx11::basic_string<char>, 10ul>; Archive = boost::archive::text_oarchive]’ /usr/local/include/boost/archive/detail/interface_oarchive.hpp:70:9: required from ‘Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(const T&) [with T = std::array<std::__cxx11::basic_string<char>, 10ul>; Archive = boost::archive::text_oarchive]’ examples/user_code/openpose_recognition.cpp:867:89: required from here /usr/local/include/boost/serialization/access.hpp:116:9: error: ‘struct std::array<std::__cxx11::basic_string<char>, 10ul>’ has no member named ‘serialize’ t.serialize(ar, file_version); ^ compilation terminated due to -Wfatal-errors. Makefile:478: die Regel für Ziel „.build_release/examples/user_code/openpose_recognition.o“ scheiterte make: *** [.build_release/examples/user_code/openpose_recognition.o] Fehler 1 make: *** Auf noch nicht beendete Prozesse wird gewartet …
I think ubuntu is still use default boost that installed by apt-get,
That is not your problem, since you can see in the output that it is using Boost from /usr/local/include, not /usr/include (which is where the system Boost is stored). Having said that, you may need to double-check that your library path also uses /usr/local/lib before /usr/lib otherwise you may experience other problems later on. Another thing to verify is whether you are compiling your application with C++11 or higher options (which the compiler output suggests is the case). If so, you should specify the same options when building Boost. Otherwise, look closely at examples/user_code/openpose_recognition.cpp:867 and see if the code is correct.
so I tried to purge it
sudo apt-get purge libboost1.58-dev
That is never a good idea. You can't remove the system Boost libraries without removing or rebuilding every other system package that depends on it, which will most likely break your system.
How to purge default boost-v1.58 then switch to the built version without any damages? You can't.