[Boost.Build] Unexpected MSVC linker error

Hi, I'm using bjam and VC++2008 Express Edition to build date_time library, for example. When I try to link it with my project I have the error: LINK : fatal error LNK1104: cannot open file 'boost_date_time-vc90-mt-gd-1_40.lib' The bjam's command line options are : --layout=tagged toolset=msvc The name of the genereated lib file is "boost_date_time-mt-gd.lib". The error doesn't occur if the "--layout" option is "versioned" or "system". It seems to me that the cause of this behavior is the following text in the file "boost\config\auto_link.hpp": #ifndef BOOST_AUTO_LINK_NOMANGLE # pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") # endif #else # pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # ifdef BOOST_LIB_DIAGNOSTIC # pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") # endif #endif "-" BOOST_LIB_VERSION ".lib" is always added in the "pragma comment" directive, if BOOST_AUTO_LINK_NOMANGLE is undefined, of cause. Is this a bug? How can I workaround it if this is not a bug? Thank you.

Sergey Zubkovsky <sergzub <at> gmail.com> writes:
Hi,
I'm using bjam and VC++2008 Express Edition to build date_time library, for example. When I try to link it with my project I have the error:
LINK : fatal error LNK1104: cannot open file 'boost_date_time-vc90-mt-gd-1_40.lib'
The bjam's command line options are : --layout=tagged toolset=msvc The name of the genereated lib file is "boost_date_time-mt-gd.lib". The error doesn't occur if the "--layout" option is "versioned" or "system".
This error is expected when using the 'tagged' layout. autolink requires that you build Boost using 'versioned' layout. The fact that 'system' works is probably due to the fact that you have already build with 'versioned' layout, so have the libraries already. You can disabled autolinking using BOOST_ALL_NO_LIB macro set to 1. Does this answer your question? - Volodya ________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Vladimir Prus <vladimir <at> codesourcery.com> writes:
Sergey Zubkovsky <sergzub <at> gmail.com> writes:
Hi,
I'm using bjam and VC++2008 Express Edition to build date_time library, for example. When I try to link it with my project I have the error:
LINK : fatal error LNK1104: cannot open file 'boost_date_time-vc90-mt-gd-1_40.lib'
The bjam's command line options are : --layout=tagged toolset=msvc The name of the genereated lib file is "boost_date_time-mt-gd.lib". The error doesn't occur if the "--layout" option is "versioned" or "system".
This error is expected when using the 'tagged' layout. autolink requires that you build Boost using 'versioned' layout. The fact that 'system' works is probably due to the fact that you have already build with 'versioned' layout, so have the libraries already.
You can disabled autolinking using BOOST_ALL_NO_LIB macro set to 1.
Does this answer your question?
- Volodya ________________________________________
Thank you, Vladimir, for your answer!
You can disabled autolinking using BOOST_ALL_NO_LIB macro set to 1.
Yes, this hint solves my problem. And, you are right: 'system' is equal to 'tagged' in this context. It was my inattention. But, "expected" sounds some strange -- I simply change the command line option (it's undocumented, unfortunately) and we have really unexpected linker error. Maybe a conditional #pragma warning would be very useful in this case? PS: Vladimir, can I write to you in Russian? :)

Sergey Zubkovsky wrote:
The bjam's command line options are : --layout=tagged toolset=msvc The name of the genereated lib file is "boost_date_time-mt-gd.lib". The error doesn't occur if the "--layout" option is "versioned" or "system".
This error is expected when using the 'tagged' layout. autolink requires that you build Boost using 'versioned' layout. The fact that 'system' works is probably due to the fact that you have already build with 'versioned' layout, so have the libraries already.
You can disabled autolinking using BOOST_ALL_NO_LIB macro set to 1.
Does this answer your question?
- Volodya ________________________________________
Thank you, Vladimir, for your answer!
You can disabled autolinking using BOOST_ALL_NO_LIB macro set to 1.
Yes, this hint solves my problem. And, you are right: 'system' is equal to 'tagged' in this context. It was my inattention. But, "expected" sounds some strange -- I simply change the command line option (it's undocumented, unfortunately) and we have really unexpected linker error. Maybe a conditional #pragma warning would be very useful in this case?
Unfortunately, when you build your project the compiler does not know how you have built Boost, so I don't think there's any way to emit warning when you have autolink disabled, but Boost is built with layout!=versioned. Or did you have something else in mind?
PS: Vladimir, can I write to you in Russian? :)
Well, I do understand Russian, but I generally prefer to keep all public discussion on public lists. And, you might get prompter reply here, as quite a number of folks know the answer. - Volodya

Vladimir Prus wrote:
Sergey Zubkovsky wrote:
The bjam's command line options are : --layout=tagged toolset=msvc The name of the genereated lib file is "boost_date_time-mt-gd.lib". The error doesn't occur if the "--layout" option is "versioned" or "system".
This error is expected when using the 'tagged' layout. autolink requires that you build Boost using 'versioned' layout. The fact that 'system' works is probably due to the fact that you have already build with 'versioned' layout, so have the libraries already.
You can disabled autolinking using BOOST_ALL_NO_LIB macro set to 1.
Does this answer your question?
- Volodya ________________________________________
Thank you, Vladimir, for your answer!
You can disabled autolinking using BOOST_ALL_NO_LIB macro set to 1.
Yes, this hint solves my problem. And, you are right: 'system' is equal to 'tagged' in this context. It was my inattention. But, "expected" sounds some strange -- I simply change the command line option (it's undocumented, unfortunately) and we have really unexpected linker error. Maybe a conditional #pragma warning would be very useful in this case?
Unfortunately, when you build your project the compiler does not know how you have built Boost, so I don't think there's any way to emit warning when you have autolink disabled, but Boost is built with layout!=versioned.
Or did you have something else in mind?
No, we need to emit a warning when autolink is _enabled_ in a user's project and Boost is build with layout!=versioned. But, you're right. In case when the Boost is build separately I don't see an acceptable way to emit a warning too. In the best way it would be very nice to add some macro definitions that adapt the '#pragma option(lib, ...' accordantly to the '--layout=' value. Also, it would be very useful (for novices like me) to have a mention in the "boost/Jamroot" (--layout option) about BOOST_ALL_NO_LIB and other macros that affect output names. BTW, is there any such macros or other settings? Where can I read about it? Thank you.
PS: Vladimir, can I write to you in Russian? :)
Well, I do understand Russian, but I generally prefer to keep all public discussion on public lists. And, you might get prompter reply here, as quite a number of folks know the answer.
- Volodya

I am using the boost libs that are part of the installer, i am NOT building them from scratch i get the same error: 1>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_40.lib' this doesn't make sense because i have most definitely added the "Additional Library Directories" correctly and the library itself correctly i tried adding the library to the "Ignore Specific Libraries" list to no avail

I am using the boost libs that are part of the installer, i am NOT building them from scratch
i get the same error:
1>LINK : fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_40.lib'
this doesn't make sense because i have most definitely added the "Additional Library Directories" correctly and the library itself correctly
i tried adding the library to the "Ignore Specific Libraries" list to no avail
Sorry to doubt you, but that error message means what it says - no library with that name is in your search path - double check that a library with that specific name exists, and that the "Additional Library Directories" path points to the actual directory containing that file, not the boost root or something else. HTH, John.
participants (4)
-
David M. Cotter
-
John Maddock
-
Sergey Zubkovsky
-
Vladimir Prus