statically link project with Boost libs in Cygwin/msvc

View: New views
5 Messages — Rating Filter:   Alert me  

statically link project with Boost libs in Cygwin/msvc

by kokot-san :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I am linking my project statically with boost_rexeg in Cygwin, using toolset msvc. But my executable still looks for boost_regex when I run it. Also, it shows boost_regex when I run depends.exe on it. Is this normal? Coming from Linux, I would expect no dependency on boost_regex (boost_regex does not show for ldd on the binary). How can I remove these dependencies?

Thank you,
Andrej



     
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: statically link project with Boost libs in Cygwin/msvc

by Vladimir Prus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 12 June 2009 Andrej van der Zee wrote:

>
> Hi,
>
> I am linking my project statically with boost_rexeg in Cygwin, using toolset msvc.

What do you mean "statically", exactly? How are you linking to boost_regex?

> But my executable still looks for boost_regex when I run it.
> Also, it shows boost_regex when I run depends.exe on it.
> Is this normal?

Do you have BOOST_ALL_DYN_LINK or BOOST_REGEXP_DYN_LINK in compiler settings,
perchance?

- Volodya

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Parent Message unknown Re: statically link project with Boost libs in Cygwin/msvc

by kokot-san :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

Thanks for your quick reply, as always.

Below the Jamfile for my executable and the ouput of bjam -d2. On Linux it statically links as I expect. On Cygwin/Windows/msvc it holds it dependencies on the boost libs. But I am not sure what to expect, since I am not so proficient on Windows.

Thank you,
Andrej


$ cat Jamfile
project : requirements
   <os>CYGWIN:<define>_WIN32_WINNT=0x0501
   <os>CYGWIN:<library-path>/usr/local/lib
   ;

exe cap2net
   : [ glob *.cpp ]
   /site-config//boost_regex
   /site-config//boost_serialization
   /site-config//boost_date_time
   : <link>static
   : <define>BOOST_REGEX_RECURSIVE
   ;

install $(INSTALL_PATH)/bin : cap2net ;

$ bjam -d2
...patience...
...found 1196 targets...
...updating 2 targets...

file bin\msvc-9.0\debug\link-static\threading-multi\cap2net.exe.rsp

"bin/msvc-9.0/debug/link-static/threading-multi/main.obj"
   
"boost_regex-vc90-mt-gd-1_38.lib"
 
"boost_serialization-vc90-mt-gd-1_38.lib"
 
"boost_date_time-vc90-mt-gd-1_38.lib"
 
msvc.link bin/msvc-9.0/debug/link-static/threading-multi/cap2net.exe

        cmd.exe /S /C call "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 ">nul" "&&" link /NOLOGO /INCREMENTAL:NO /DEBUG /subsystem:console /out:"bin\msvc-9.0\debug\link-static\threading-multi\cap2net.exe" /LIBPATH:"C:\cygwin\usr\local\lib"  @"bin\msvc-9.0\debug\link-static\threading-multi\cap2net.exe.rsp"
   
   Creating library bin\msvc-9.0\debug\link-static\threading-multi\cap2net.lib and object bin\msvc-9.0\debug\link-static\threading-multi\cap2net.exp
msvc.manifest bin/msvc-9.0/debug/link-static/threading-multi/cap2net.exe
       
        if test -e "bin/msvc-9.0/debug/link-static/threading-multi/cap2net.exe.manifest"; then
            cmd.exe /S /C call "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86 ">nul" "&&" mt -nologo -manifest "bin\msvc-9.0\debug\link-static\threading-multi\cap2net.exe.manifest" "-outputresource:bin\msvc-9.0\debug\link-static\threading-multi\cap2net.exe;1"
        fi
   
common.copy /mbrace/bin/cap2net.exe

    cp "bin/msvc-9.0/debug/link-static/threading-multi/cap2net.exe"  "/mbrace/bin/cap2net.exe"

...updated 2 targets...


     
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Re: statically link project with Boost libs in Cygwin/msvc

by Vladimir Prus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 12 June 2009 Andrej van der Zee wrote:

>
> Hi,
>
> Thanks for your quick reply, as always.
>
> Below the Jamfile for my executable and the ouput of bjam -d2.
> On Linux it statically links as I expect. On Cygwin/Windows/msvc
> it holds it dependencies on the boost libs. But I am not sure what
> to expect, since I am not so proficient on Windows.
>
> Thank you,
> Andrej
>
>
> $ cat Jamfile
> project : requirements
>    <os>CYGWIN:<define>_WIN32_WINNT=0x0501
>    <os>CYGWIN:<library-path>/usr/local/lib
>    ;
>
> exe cap2net
>    : [ glob *.cpp ]
>    /site-config//boost_regex
>    /site-config//boost_serialization
>    /site-config//boost_date_time
>    : <link>static
>    : <define>BOOST_REGEX_RECURSIVE
>    ;
>
> install $(INSTALL_PATH)/bin : cap2net ;
>
> $ bjam -d2
> ...patience...
> ...found 1196 targets...
> ...updating 2 targets...
>
> file bin\msvc-9.0\debug\link-static\threading-multi\cap2net.exe.rsp
>
> "bin/msvc-9.0/debug/link-static/threading-multi/main.obj"
>    
> "boost_regex-vc90-mt-gd-1_38.lib"

This is not static library. It is import library for DLL, therefore it's
natural that your library links to DLL. The static library would be named

   "libboost_regex-vc90-mt-gd-1_38.lib"

I think the declarations in site-config have to be appropriately modified. E.g:

        searched-lib boost_regex:
          : <link>shared:<name>boost_regex-vc90-mt-gd-1_38
            <link>static:<name>libboost_regex-vc90-mt-gd-1_38
          ;

Note that using <name> conditionally as above requires that you use shared-lib as
opposed to lib, as otherwise auto-detection of 'this is actually searched lib'
might not work. 'searched-lib' is the recommended spelling anyway now.

Does this help?

- Volodya

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

Parent Message unknown Re: statically link project with Boost libs in Cygwin/msvc

by kokot-san :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

>
> searched-lib boost_regex:
>           :
> <link>shared:<name>boost_regex-vc90-mt-gd-1_38
>            
> <link>static:<name>libboost_regex-vc90-mt-gd-1_38
>
>           ;
>

Thank you, that did it!

Cheers,
Andrej



     
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build