Boost logo

Boost Users :

Subject: [Boost-users] Statically linking and boost
From: Michael Dehmlow (dehmlowm_at_[hidden])
Date: 2009-05-08 12:32:47

I have a rather interesting situation and I'm wondering if any one has some
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

I also have a requirement to create an interface for Labview 8.6 which is
built using gcc 3.3
which uses

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:
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/
#1 0x0362b479 in boost::detail::lexical_cast<int, std::string, false, char>
(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<int, std::string, false, char>
(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

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
${OBJECTS} -L. -L../../../utl/CommonObjects/XML/
./ -lXML -lExceptions -lc /lib/

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at