Fabian
Fabian

Reputation: 159

linking boost on Windows asks for versioned lib

We have a large cmake based C++ project for Linux where we build boost ourselves via cmake exernal project.

The project used to build also on Windows for the classical Intel compiler. But I have no access to this old running configuration.

I use Intel oneAPI 2023.0 with LLVM based icx compiler (clang 15?) and a current MSVC community edition.

I built boost (1.81.0) without a target (as I still struggle with openAPI target) with --layout=system, hence lib names like libboost_atomic.a

In our C++ we do not let CMake search for boost but add the boost libs via target_link_libraries().

When I compile our application with icx I get a link error

Linking CXX executable ....\bin\cfs.exe LINK: command "C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin\icx.exe /nologo @CMakeFiles\cfs.dir\objects1 /Qoption,link, /machine:x64 /INCREMENTAL:NO /Qoption,link,/subsystem:console -Qiopenmp /Qoption,link,/LIBPATH:C:\PROGRA~2\Intel\oneAPI\compile r\latest\windows\bin\intel64\ifort.exe /Qoption,link,/LIBPATH:C:\Users\fabia\code\master\release_icx\lib [....] ....\lib\libboost_log_setup.lib ....\lib\libboost_serialization.lib [.....] /link /out:....\bin\cfs.exe /implib:. ...\bin\cfs.lib /pdb:C:\Users\fabia\code\master\release_icx\bin\cfs.pdb /version:0.0 /MANIFEST /MANIFESTFILE:....\bin\cfs.exe .manifest"

I get

fatal error LNK1104: file "libboost_serialization-clangw16-mt-x64-1_81.lib" not found.

I have no idea where the string clangw16-mt-x64-1_81 comes from.

Upvotes: 0

Views: 179

Answers (1)

SeshaP-Intel
SeshaP-Intel

Reputation: 137

You can link the libraries present in the boost library path to your project either from the Command Prompt or within the Visual Studio IDE. Please refer to the below link for more details. https://www.boost.org/doc/libs/1_81_0/more/getting_started/windows.html

If you do not find any binaries, you can add the macro BOOST_ALL_NO_LIB which tells the config system not to automatically select which libraries to link. Please refer to the below link for more details. https://www.boost.org/doc/libs/1_81_0/libs/config/doc/html/index.html

Or
You can use the target Boost::disable_autolinking to disable automatic linking. Please refer to the below link for more details. https://cmake.org/cmake/help/latest/module/FindBoost.html

Upvotes: 1

Related Questions