Boost logo

Boost Users :

Subject: Re: [Boost-users] Cannot statically link to Boost.Filesystem
From: Mat Marcus (mat-lists_at_[hidden])
Date: 2008-09-04 01:00:32


On Wed, Sep 3, 2008 at 9:38 PM, Vladimir Prus <vladimir_at_[hidden]> wrote:
> Mat Marcus wrote:
>
>> On Wed, Sep 3, 2008 at 1:28 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
>>> AMDG
>>>
>>> Mat Marcus wrote:
>>>>
>>>> Really? I thought that libary usage-requirements were supposed to
>>>> solve that problem for static libs in boost build.
>>>>
>>>
>>> Boost.Build usage-requrements don't help for direct invocations of g++
>>
>> Heh, sorry, didn't read the top of the thread. My remark came from
>> similar errors that I get when using boost filesystem 1.36.0 with
>> bjam. That is, shouldn't boost filesystem's Jamfile.v2 have a system
>> usage-requirement?
>
> I don't think so. Filesystem's Jamfile has this:
>
> lib boost_filesystem
> :
> $(SOURCES).cpp
> ../../system/build//boost_system
>
> When building shared lib, depenendency of boost_system is embedded in the
> created .so. When building static lib, usage requirements on boost_system
> is added automatically, so any other Boost.Build target that uses boost_filesystem
> will get boost_system as well, no explicit usage requirements necessary.
>
> If this does not work, it's a bug -- but we have a test for this very behaviour
> (library_chain.py), and it works for me on Linux.
>
> - Volodya

Ok, that's interesting. So then I guess this is a bug report. I have
an executable that gets link errors if it depends on filesystem alone
(workflow involves static libs only). The link errors vanish when I
also make the exe depend on system, or if I manually add a
usage-requirement on system in the filesystem Jamfile (as I did in my
http://easyurl.net/boost_135_patches ):

diff -wur --unidirectional-new-file -x status -x adobe_information -x
bin.v2 ../diffable_boost_1_35_0/libs/filesystem/build/Jamfile.v2
../boost_libraries/libs/filesystem/build/Jamfile.v2
--- ../diffable_boost_1_35_0/libs/filesystem/build/Jamfile.v2 2007-11-15
14:26:15.000000000 -0800
+++ ../boost_libraries/libs/filesystem/build/Jamfile.v2 2008-04-22
09:56:22.265625000 -0700
@@ -11,6 +11,7 @@
 project boost/filesystem
     : source-location ../src
     : usage-requirements # pass these requirement to dependents (i.e. users)
+ <library>/boost/system
       <link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
       <link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
     ;

I suppose that if it works for you and not for me, it could mean that
something else is wrong or unusual in my project hierarchy. Sorry if
I'm missing something too obvious. If it would be of any use to view
the hierarchy,

the leaf Jamfile is:

http://stlab.adobe.com:8080/@md=d&cd=//adobe_source_libraries/test/md5/&cdf=//adobe_source_libraries/test/md5/Jamfile.v2&c=7Bq@//adobe_source_libraries/test/md5/Jamfile.v2?ac=64&rev1=1

the intermediate JF:

http://stlab.adobe.com:8080/@md=d&cd=//adobe_source_libraries/test/&cdf=//adobe_source_libraries/test/Jamfile.v2&sr=3532&c=IyR@//adobe_source_libraries/test/Jamfile.v2

the root JF:

http://stlab.adobe.com:8080/@md=d&cd=//adobe_source_libraries/&cdf=//adobe_source_libraries/Jamfile.v2&sr=3632&c=hFO@//adobe_source_libraries/Jamfile.v2

 - Mat


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