Boost logo

Boost-Build :

Subject: Re: [Boost-build] msvc 10 library names
From: Vladimir Prus (ghost_at_[hidden])
Date: 2011-10-20 05:22:20


On Thursday, October 20, 2011 02:24:08 Bruce Visscher wrote:
> Hello,
>
> I am trying to build libraries for use by Visual Studio 2010. I am
> building from cygwin bash but intend to use the resulting library
> from Visual Studio. For the moment (to reduce the dependencies) I am
> using native threads rather than pthread-win32.
>
> So, I have:
>
> # Configure msvc (default version, searched for in standard locations and
> PATH). using msvc ;
>
> # Configure specific msvc version (searched for in standard locations and
> PATH). using msvc : 10.0 ;
>
> and:
>
> # Configure specific Python version.
> using python : 2.7 : /cygdrive/c/Python27 :
> /cygdrive/c/Python27/include : cygdrive/c/Python27/libs ;
>
> in my user-config.jam.
>
> I built b2.exe using gcc.
>
> When I try to build a trivial console application in VS that uses
> boost::filesystem, I get:
>
> fatal error LNK1104: cannot open file
> 'libboost_filesystem-vc100-mt-gd-1_47.lib'
>
> The build command I use to build the library is:
>
> b2 --build-directory=/tmp/build-boost toolset=msvc threadapi=win32
> --layout=versioned --built-type=complete -q --with-filesystem
> --prefix=/cygdrive/c/Users/visschb install
>
> which creates these libraries and DLLs:
>
> -rwxr-xr-x+ 1 visschb Domain Users 134656 Oct 19 18:07
> ../../bin/cygboost_filesystem-vc100-mt-1_47.dll
> -rwxr-xr-x+ 1 visschb Domain Users 15360 Oct 19 18:07
> ../../bin/cygboost_system-vc100-mt-1_47.dll
> -rwxr-xr-x+ 1 visschb Domain Users 129250 Oct 19 18:07
> ../boost_filesystem-vc100-mt-1_47.lib
> -rwxr-xr-x+ 1 visschb Domain Users 2980 Oct 19 18:07
> ../boost_system-vc100-mt-1_47.lib
> -rwxr-xr-x+ 1 visschb Domain Users 1508074 Oct 19 18:07
> ../libboost_filesystem-vc100-mt-1_47.a

As you notice, you get libraries created with cygwin naming. This
is because you build b2 using cygwin gcc, so it assumes you
are building for cygwin thereafter. You should be able to use

        target-os=windows

to improve on this

> -rwxr-xr-x+ 1 visschb Domain Users 83074 Oct 19 18:07
> ../libboost_system-vc100-mt-1_47.a
>
> The questions I have at this point are:
>
> 1. What is the magic that generates the name
>
> libboost_filesystem-vc100-mt-gd-1_47.lib
>
> when I compile?

boost/config/auto_link.hpp

>
> 2. What does the "-gd-" part of this name mean?

http://www.boost.org/doc/libs/1_47_0/more/getting_started/windows.html#library-naming

>
> 3. How can I get bjam to put "lib" in front of the library name?

You already have it, see libboost_system-vc100-mt-1_47.a. I think that target-os=windows
will also fix the extension.

>
> 4. How can I get bjam to put "lib" in front of the DLL name rather
> than "cyg" (if that is what is required..maybe it doesn't matter)?

See above.

> 5. How can I get bjam to append "-gd-" to the library and DLL names?

See http://www.boost.org/doc/libs/1_47_0/more/getting_started/windows.html#library-naming again,
the third column of the table in particular.

Thanks,

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build: http://boost.org/boost-build2

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk