Can't statically link demo program with Boost.Serialization 1.33
Hello,
I am having difficulties statically compiling the demo program at
http://www.boost.org/libs/serialization/example/demo.cpp
on Linux (Linux 2.6.15-1.1831_FC4 #1 SMP Tue Feb 7 13:37:59 EST 2006
x86_64 GNU/Linux) with gcc version 4.0.2 20051125.
When I try:
g++ -o demo -I /path/boost/ -L /path/boost/ -lboost_serialization demo.cpp
it works fine, but I get a program which needs dynamic versions of the
serialization library.
However, I would like to compile against the static versions of
the Boost.Serialization library.
If I try
g++ -static -o demo -I /path/boost/ -L /path/boost/ -lboost_serialization demo.cpp
the linker complains of a lot of undefined references, like
/tmp/ccFAJsqB.o(.gnu.linkonce.r._ZTIN5boost13serialization16void_cast_detail21void_caster_primitiveIK20bus_stop_destinationK8bus_stopEE[typeinfo
for
boost::serialization::void_cast_detail::void_caster_primitive
I'm not an expert in gcc command line switches. But it seems odd to me that you don't have to specify the full library name with the -L switch. There are several verasions of the library built and I don't see how the proper one can be select without explicitly specifying it. gcc doesn't implemant autolink as far as I know. Robert Ramey Demos Rali wrote:
Hello,
I am having difficulties statically compiling the demo program at http://www.boost.org/libs/serialization/example/demo.cpp on Linux (Linux 2.6.15-1.1831_FC4 #1 SMP Tue Feb 7 13:37:59 EST 2006 x86_64 GNU/Linux) with gcc version 4.0.2 20051125.
When I try: g++ -o demo -I /path/boost/ -L /path/boost/ -lboost_serialization demo.cpp
it works fine, but I get a program which needs dynamic versions of the serialization library.
However, I would like to compile against the static versions of the Boost.Serialization library.
If I try g++ -static -o demo -I /path/boost/ -L /path/boost/ -lboost_serialization demo.cpp
the linker complains of a lot of undefined references, like
/tmp/ccFAJsqB.o(.gnu.linkonce.r._ZTIN5boost13serialization16void_cast_detail21void_caster_primitiveIK20bus_stop_destinationK8bus_stopEE[typeinfo for boost::serialization::void_cast_detail::void_caster_primitive
]+0x10): undefined reference to `typeinfo for boost::serialization::void_cast_detail::void_caster' ... I have no difficulties when statically linking against other boost libraries. I built the librairies with gcc, with no exotic options.
Any suggestions would be greatly appreciated.
Thanks a lot.
Fabrizio
participants (2)
-
Demos Rali
-
Robert Ramey