问题
I have downloaded a library that was compiled with a gcc 4.8 before the ABI change in GCC.
On my laptop (latest kubuntu) I have GCC 5.2. And When I installed boost, it seems that it used the new ABI but then I get the following link errors
undefined symbol.....__cxx11....
How can I install boost using old ABI with GCC5 ?
回答1:
To my knowledge, there are no prebuilt Boost packages for the old ABI in the official Kubuntu repositories, so you will have to build Boost yourself. The building process is documented here.
Make sure you're building the same Boost version that was used when your library was built. If there were any Boost configuration macros defined, you will also have to define them the similar way. Otherwise you may encounter ABI incompatibilities between the library and Boost you've built.
In order to switch libstdc++ to the old ABI you will also have to define _GLIBCXX_USE_CXX11_ABI
to 0, as described here. For example:
b2 -j8 variant=release define=_GLIBCXX_USE_CXX11_ABI=0 stage
You will also need to define the macro when you build your own code that uses Boost and the library.
The define
property, along with many others, is documented here.
来源:https://stackoverflow.com/questions/36309021/how-to-compile-boost-with-gcc-5-using-old-abi