Boost logo

Boost-Build :

Subject: Re: [Boost-build] Building and Installing Shared Boost Libraries on Windows
From: Vladimir Prus (vladimir.prus_at_[hidden])
Date: 2016-02-08 01:59:37


Andrey,

On 07-Feb-16 8:48 PM, Andrey Sklyar wrote:
> I built boost 1.60.0 as shared libraries (configuration below). A couple of things seem off, but I'm not sure if it's
> me not understanding Windows or if it's something with the Boost build.
>
> I built the boost library with this configuration:
>
> .\b2 --build-dir=%BUILD_DIR% architecture=x86 address-model=64 runtime-link=shared threading=multi link=shared variant=debug
> .\b2 headers

...

> When I tried to link it, it produced an error that it couldn't find
> libboost_filesystem-vc140-mt-gd-1_60.lib
>
> When I looked at the built artifacts, I saw that the .lib file was actually named
> boost_filesystem-vc140-mt-gd-1_60.lib

The naming is documented at

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

and it say that the import library for a DLL is "boost_..." whereas a static library is "libboost_...".
Therefore, the libraries that you have are import libraries for a DLL, which is what you seem
to want.

> QUESTION 1:
> It seems like, when linking against shared libraries on windows, the linker is looking for link libraries with the "lib"
> prefix, but the Boost build is creating .libs without that prefix. Which should it be?

It seems that when you're building your application, you are not requesting DLL linking. What's your
command line? I think you need to have either /MD or /MDd option on the command line, or select same
under VS project properties (C/C++ -> Code Generation -> Runtime Library)

> **//___^
> QUESTION 2:
> I would like to install (aka copy all of the libs, dlls, etc.) both the release and debug versions of the build. What
> would be the right way to tell Boost build to "install the binaries that resulted from the build in %BUILD_DIR%".

Unlike other build systems, install is not special-cased in Boost.Build, so you can just specify desired properties
when building the 'install' target, e.g.:

.\b2 --build-dir=%BUILD_DIR% architecture=x86 address-model=64 runtime-link=shared threading=multi link=shared
variant=debug install

If you have both variant=debug and variant=release on the command-line, then both variants will be built
and installed.

HTH,
Volodya

-- 
Vladimir Prus
http://vladimirprus.com

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