[CMake] Boost lib error when linking executable

John Drescher drescherjm at gmail.com
Tue Aug 24 10:08:35 EDT 2010


On Tue, Aug 24, 2010 at 9:57 AM, Oenen, Jodi van
<jodi.vanoenen at tass-safe.com> wrote:
> Hi,
>
> We are migrating an 'old' Make project into the CMake world, and I am encountering a problem during the link phase of one of our executables: the linker cannot open a boost library.
>
> I am using CMake 2.8.2 on WinXP x64, Boost regex library 1.33.1, with Intel C++/Fortran 9.1 compilers (icl/ifort), and Visual Studio 2005 (VS80) for linking. I am not using a FindBOOST module (yet); I'm just replicating the current Make environment for now, i.e. I have hardcoded the boost include directory and the library which should be statically linked into the executable. In the current Make system this works fine.
>
> However, this is what CMake says:
>
> <snip>
> C:\build\src\bsaf>"c:\Program Files (x86)\Microsoft Visual Studio 8\vc\bin\nmake
> .exe" bsaf_exe/fast VERBOSE=TRUE
>
> Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
> Copyright (C) Microsoft Corporation.  All rights reserved.
>
>        cd C:\build
>        "c:\Program Files (x86)\Microsoft Visual Studio 8\vc\bin\nmake.exe" -f s
> rc\bsaf\CMakeFiles\bsaf_exe.dir\build.make /nologo -                   src\bsaf\
> CMakeFiles\bsaf_exe.dir\build
> Linking CXX executable \em64t-win_cmake\bin\bsaf.exe
>        cd C:\build\src\bsaf
>        "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E vs_link_exe C:\PROGR
> A~2\Intel\Compiler\C__~1\9.1\EM64T\Bin\icl.exe  /nologo @C:\DOCUME~1\ADMINI~1\LO
> CALS~1\Temp\nm6860.tmp
> Visual Studio Non-Incremental Link
> LINK:
> C:\PROGRA~2\Intel\Compiler\C__~1\9.1\EM64T\Bin\icl.exe /nologo -nologo -GX -G7 -
> W1 -D_CONSOLE -D_MBCS @CMakeFiles\bsaf_exe.dir\objects1.rsp /Fe\em64t-win_cmake\
> bin\bsaf.exe -link /implib:bsaf.lib -nologo -subsystem:console -incremental:no -
> stack:64000000 /INCREMENTAL:NO /subsystem:console -MACHINE:X64 \em64t-win_cmake\
> lib\bsaf\bsaf.lib \em64t-win_cmake\lib\ulib\saf.lib \em64t-win_cmake\lib\ulib\do
> m.lib \em64t-win_cmake\lib\ulib\domf2c.lib \em64t-win_cmake\lib\ulib\mifparser.l
> ib \em64t-win_cmake\lib\ulib\ffilio.lib \em64t-win_cmake\lib\ulib\errmsg.lib \em
> 64t-win_cmake\lib\ulib\dynmemmgr.lib \em64t-win_cmake\lib\ulib\strings.lib \em64
> t-win_cmake\lib\bsaf\bsaf.lib \em64t-win_cmake\lib\ulib\system.lib \em64t-win_cm
> ake\lib\ulib\filetb.lib \em64t-win_cmake\lib\ulib\timer.lib \em64t-win_cmake\lib
> \ulib\csys.lib C:\Users\madymo\em64t-win\ext\lib\xerces-c_1.lib C:\Users\madymo\
> em64t-win\ext\boost\lib\libboost_regex-iw-mt-1_33_1.lib -lpthread -lm libifcorem
> t.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib s
> hell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib win
> spool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
> /MANIFEST
> Fatal error cannot open "libboost_regex-iw-mt-s-1_33_1.lib"
> icl: error: problem during multi-file optimization compilation (code 1)
> LINK failed. with 1
> NMAKE : fatal error U1077: '"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe"' :
> return code '0xffffffff'
> Stop.
> NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 8\vc
> \bin\nmake.exe"' : return code '0x2'
> Stop.
> </snip>
>
> The linker cannot open "libboost_regex-iw-mt-s-1_33_1.lib"! I know the libboost_regex-iw-mt-s-1_33_1.lib library is on my disk, at the correct location (I can find it with 'dir C:\Users\madymo\em64t-win\ext\boost\lib\libboost_regex-iw-mt-1_33_1.lib'). I have full permissions on the file. When I change "libboost_regex-iw-mt-s-1_33_1.lib" to "libboost_regex-vc80-mt-s-1_33_1.lib" in my CMakeLists.txt file, CMake shows the same error: it complains about not being able to open "libboost_regex-iw-mt-s-1_33_1.lib"(!!).
>
> Any ideas on what's going on?
>

Looks like you are mixing 64 bit and 32 bit libs.

John


More information about the CMake mailing list