Boost logo

Boost Users :

Subject: Re: [Boost-users] static linkage of filesystem lib under linux
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2008-09-10 10:41:40


Ottmar Buennemeyer wrote:

>
> Hello,
>
> We have problems with using the static filesystem lib under linux.
>
> We use filesystem as static library in a shard library.
> Example:
> libfilesystem.a used for shared library libTestBoostStatic.so
>
> No errors during build of library libTestBoostStatic.so.
>
> Afterwards we use libtest.so in the application UseTestBoostStatic.
> During the linking of the application we get the following error message:
>
> Invoking: GCC C++ Linker
> g++ -L/home/ROSENINSPECTION/AlKeller/src/SDES/Test/TestBoostStatic/Debug -L/usr/lib64 -Wl,-static
> -lboost_filesystem-mt -lboost_regex-mt -Wl,-call_shared -o"UseTestBoostStatic"
> ./UseTestBoostStatic.o -lTestBoostStatic
> /home/ROSENINSPECTION/AlKeller/src/SDES/Test/TestBoostStatic/Debug/libTestBoostStatic.so:
> undefined reference to `boost::filesystem::detail::dir_itr_increment(void*&, void*&,
...
>
> What's wrong with our configuration?

It's impossible to say for sure, as you did not provide the exact linker lines
for the library and the application. You also did not say where the unresolved
function is used.

The most likely reason is wrong order of parameters when linking the application.
You should have:

   g++ -o libTestBoostStatic.so .... a.o b.o c.o -lboost_filesystem

That is, -lboost_filesystem should be after all object files.

- Volodya


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net