I've compiled a Linux package on ubuntu 12.04 which uses boost and on this system i have boost 1.46. I tried to run the compiled release on another system and it complains that it can't find libboost_system.so.1.46.1. That system has boost 1.49 installed. How do I compile so that the program uses whatever version of boot exists instead of the specific version on the development machine.
Asked
Active
Viewed 574 times
1
-
1One option might be statically linking against Boost instead of your current dynamic linking setup. I don't know whether all of the Boost libraries support this. – Jason R Mar 11 '14 at 02:22
-
what compiler/linker options are you using? – harmic Mar 11 '14 at 02:25
-
3Different `boost` versions have different binary interfaces. Barring extreme hanky panky, you cannot do this. – Yakk - Adam Nevraumont Mar 11 '14 at 03:06
-
statically linking the boost library, as Jason R suggests, is the correct way to handle this. – Dave Mar 11 '14 at 04:12
1 Answers
1
You cannot expect your program to work with a different version of the library.
The fact that there are /different/ versions implies that they're /not the same/.
As mentioned, either
- statically link to your specific version, or
- you can ship the shared libraries (as long as you put them in a app-specific location and make sure you find them at runtime). Incidentally, see the second example here: How to compile boost async_client.cpp for the relevant linker options to use a custom library (it assumes the same location is to be used at runtime (
rpath
)