I have a rather interesting situation and I'm wondering if any one has some
ideas.
I am building a linux shared library which uses boost and xerces, I have an
application which I compile and run fine using gcc 4.1 which uses
stdlibc++.so.6.
I also have a requirement to create an interface for Labview 8.6 which is
built using gcc 3.3
which uses stdlibc++.so.5.
After some investigation I found that Labview would crash on any std::string
concatenation because it was dynamically using the old stdlib(5). In a
simplified test tool I statically linked the stdc++ lib using this really
great page:
http://www.trilithium.com/johan/2005/06/static-libstdc/
Everything worked great until I started adding my cots (boost and xerces)
into the mix. For xerces I simply modified the xerces make file to
statically link stdlib and (using gdb was able determine that) I get past
all my xerces calls.
However when I make call to boost lexical cast it still tries to use the
dynamic std library 5:
#0 0x00cab1a7 in std::string::data () from /usr/lib/libstdc++.so.5
#1 0x0362b479 in boost::detail::lexical_cast
(arg=@0x0, buf=0x0, src_len=0)
at /usr/include/boost/boost_1_38_0/boost/lexical_cast.hpp:1149
#2 0x0362b500 in boost::detail::lexical_cast
(arg=Cannot access memory at address 0x8
) at /usr/include/boost/boost_1_38_0/boost/lexical_cast.hpp:1159
Above is the stack trace immediately preceding my segmentation fault.
One: I thought that lexical cast was built into hpp files and was compiled
at my application compile time is that correct?
Two: does any one know how to make the symbols from a .a (static library)
file look in the encapsulating so's symbol table before the applications
symbol table? Or can anyone point me at some information on symbol lookup
precedence.
Three: I'm considering including all of the generated object files from the
included boost .a files in my make file rather than including the
staticboost libraries themselves. Seem like a good idea? Any pitfalls?
Four: any other Ideas?
Below is the meat of my make file:
g++ -g -static-libgcc -nodefaultlibs -fPIC -shared -fno-gnu-linker
-Wl,-soname,libEXPO.so -o libEXPO.so ${APIOBJECTS} ${DETAILOBJECTS}
${OBJECTS} -L. -L../../../utl/CommonObjects/XML/
-L../../../utl/CommonObjects/Exceptions
${COTS_EXPO_BOOST_LIBDIR_38}/libboost_thread-gcc41-mt-1_38.a
${COTS_EXPO_BOOST_LIBDIR_38}/libboost_filesystem-gcc41-mt-1_38.a
${COTS_EXPO_BOOST_LIBDIR_38}/libboost_system-gcc41-mt-1_38.a
${COTS_EXPO_BOOST_LIBDIR_38}/libboost_regex-gcc41-mt-1_38.a
${COTS_EXPO_BOOST_LIBDIR_38}/libboost_date_time-gcc41-mt-1_38.a
./libxerces-c.so.26 -lXML -lExceptions -lc /lib/libpthread.so.
--
View this message in context: http://www.nabble.com/Statically-linking-libstdc%2B%2B.so.6-and-boost-tp2344...
Sent from the Boost - Users mailing list archive at Nabble.com.