benchmark icon indicating copy to clipboard operation
benchmark copied to clipboard

Windows shared builds are failing

Open Croydon opened this issue 7 years ago • 6 comments

Tested both with 1.14.1 and master, same result.

cmake .. -A x64 -DBUILD_SHARED_LIBS=On && cmake --build .

(Link target) -> LINK : fatal error LNK1104: cannot open file 'Debug\benchmark.lib'

Croydon avatar Jul 14 '18 22:07 Croydon

I am having the same issue today with Visual Studio 2019, any idea how to solve this issue?

codars avatar May 13 '19 18:05 codars

Can you post your cmake command and any logs please?

dmah42 avatar May 14 '19 13:05 dmah42

This is the command I have used:


cmake                                                               `
    -DBUILD_SHARED_LIBS=ON                                          `
    -DBENCHMARK_ENABLE_GTEST_TESTS=OFF                              `
    -DCMAKE_BUILD_TYPE=Release                                      `
    -DCMAKE_C_FLAGS="/GL /MP /Zi"                                   `
    -DCMAKE_CXX_FLAGS="/EHsc /GL /MP /Zi"                           `
    -DCMAKE_EXE_LINKER_FLAGS="/DEBUG:FASTLINK /LTCG:incremental"    `
    -DCMAKE_PDB_OUTPUT_DIRECTORY="${PWD}/pdb"                       `
    -DCMAKE_SHARED_LINKER_FLAGS="/DEBUG:FASTLINK /LTCG:incremental" `
    -DCMAKE_STATIC_LINKER_FLAGS="/LTCG:incremental"                 `
    -G"Ninja"                                                       `
    ..

cmake --build .

And this is the issues I have seen:

Previous IPDB not found, fall back to full compilation.
All 999 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
[37/54] Linking CXX shared library src\benchmark_main.dll
FAILED: src/benchmark_main.dll src/benchmark_main.lib
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\CMakeFiles\benchmark_main.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo src\CMakeFiles\benchmark_main.dir\benchmark_main.cc.obj  /out:src\benchmark_main.dll /implib:src\benchmark_main.lib /pdb:pdb\benchmark_main.pdb /dll /version:0.0 /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO  src\benchmark.lib Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
LINK: command "C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo src\CMakeFiles\benchmark_main.dir\benchmark_main.cc.obj /out:src\benchmark_main.dll /implib:src\benchmark_main.lib /pdb:pdb\benchmark_main.pdb /dll /version:0.0 /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO src\benchmark.lib Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:src\benchmark_main.dll.manifest" failed (exit code 1181) with the following output:
LINK : fatal error LNK1181: cannot open input file 'src\benchmark.lib'
[38/54] Linking CXX executable test\basic_test.exe
FAILED: test/basic_test.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=test\CMakeFiles\basic_test.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo test\CMakeFiles\basic_test.dir\basic_test.cc.obj  /out:test\basic_test.exe /implib:test\basic_test.lib /pdb:pdb\basic_test.pdb /version:0.0  /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO  /subsystem:console  src\benchmark.lib Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo test\CMakeFiles\basic_test.dir\basic_test.cc.obj /out:test\basic_test.exe /implib:test\basic_test.lib /pdb:pdb\basic_test.pdb /version:0.0 /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO /subsystem:console src\benchmark.lib Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:test\basic_test.exe.manifest" failed (exit code 1181) with the following output:
LINK : fatal error LNK1181: cannot open input file 'src\benchmark.lib'
[39/54] Linking CXX executable test\options_test.exe
FAILED: test/options_test.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=test\CMakeFiles\options_test.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo test\CMakeFiles\options_test.dir\options_test.cc.obj  /out:test\options_test.exe /implib:test\options_test.lib /pdb:pdb\options_test.pdb /version:0.0  /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO  /subsystem:console  src\benchmark.lib Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo test\CMakeFiles\options_test.dir\options_test.cc.obj /out:test\options_test.exe /implib:test\options_test.lib /pdb:pdb\options_test.pdb /version:0.0 /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO /subsystem:console src\benchmark.lib Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:test\options_test.exe.manifest" failed (exit code 1181) with the following output:
LINK : fatal error LNK1181: cannot open input file 'src\benchmark.lib'
[40/54] Linking CXX executable test\user_counters_tabular_test.exe

codars avatar May 14 '19 22:05 codars

Also tried adding -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DBUILD_SHARED_LIBS=TRUE to cmake but still fails:

[36/54] Linking CXX shared library src\benchmark.dll
FAILED: src/benchmark.dll src/benchmark.lib
cmd.exe /C "cmd.exe /C ""C:\Program Files\CMake\bin\cmake.exe" -E __create_def C:\Users\xiaguo\AppData\Local\Temp\benchmark\build\src\CMakeFiles\benchmark.dir\exports.def C:\Users\xiaguo\AppData\Local\Temp\benchmark\build\src\CMakeFiles\benchmark.dir\exports.def.objs && cd C:\Users\xiaguo\AppData\Local\Temp\benchmark\build" && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\CMakeFiles\benchmark.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo src\CMakeFiles\benchmark.dir\benchmark.cc.obj src\CMakeFiles\benchmark.dir\benchmark_register.cc.obj src\CMakeFiles\benchmark.dir\colorprint.cc.obj src\CMakeFiles\benchmark.dir\commandlineflags.cc.obj src\CMakeFiles\benchmark.dir\complexity.cc.obj src\CMakeFiles\benchmark.dir\console_reporter.cc.obj src\CMakeFiles\benchmark.dir\counter.cc.obj src\CMakeFiles\benchmark.dir\csv_reporter.cc.obj src\CMakeFiles\benchmark.dir\json_reporter.cc.obj src\CMakeFiles\benchmark.dir\reporter.cc.obj src\CMakeFiles\benchmark.dir\sleep.cc.obj src\CMakeFiles\benchmark.dir\statistics.cc.obj src\CMakeFiles\benchmark.dir\string_util.cc.obj src\CMakeFiles\benchmark.dir\sysinfo.cc.obj src\CMakeFiles\benchmark.dir\timers.cc.obj  /out:src\benchmark.dll /implib:src\benchmark.lib /pdb:pdb\benchmark.pdb /dll /version:0.0 /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO  /DEF:src\CMakeFiles\benchmark.dir\exports.def  Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
ninja: build stopped: subcommand failed.
Failed to build.
Retry with best-effort for logging.
You may Ctrl-C this if you don't need the log file.
[1/19] Linking CXX shared library src\benchmark.dll
FAILED: src/benchmark.dll src/benchmark.lib
cmd.exe /C "cmd.exe /C ""C:\Program Files\CMake\bin\cmake.exe" -E __create_def C:\Users\xiaguo\AppData\Local\Temp\benchmark\build\src\CMakeFiles\benchmark.dir\exports.def C:\Users\xiaguo\AppData\Local\Temp\benchmark\build\src\CMakeFiles\benchmark.dir\exports.def.objs && cd C:\Users\xiaguo\AppData\Local\Temp\benchmark\build" && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\CMakeFiles\benchmark.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo src\CMakeFiles\benchmark.dir\benchmark.cc.obj src\CMakeFiles\benchmark.dir\benchmark_register.cc.obj src\CMakeFiles\benchmark.dir\colorprint.cc.obj src\CMakeFiles\benchmark.dir\commandlineflags.cc.obj src\CMakeFiles\benchmark.dir\complexity.cc.obj src\CMakeFiles\benchmark.dir\console_reporter.cc.obj src\CMakeFiles\benchmark.dir\counter.cc.obj src\CMakeFiles\benchmark.dir\csv_reporter.cc.obj src\CMakeFiles\benchmark.dir\json_reporter.cc.obj src\CMakeFiles\benchmark.dir\reporter.cc.obj src\CMakeFiles\benchmark.dir\sleep.cc.obj src\CMakeFiles\benchmark.dir\statistics.cc.obj src\CMakeFiles\benchmark.dir\string_util.cc.obj src\CMakeFiles\benchmark.dir\sysinfo.cc.obj src\CMakeFiles\benchmark.dir\timers.cc.obj  /out:src\benchmark.dll /implib:src\benchmark.lib /pdb:pdb\benchmark.pdb /dll /version:0.0 /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO  /DEF:src\CMakeFiles\benchmark.dir\exports.def  Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
ninja: build stopped: cannot make progress due to previous errors.
[1/19] Linking CXX shared library src\benchmark.dll
FAILED: src/benchmark.dll src/benchmark.lib
cmd.exe /C "cmd.exe /C ""C:\Program Files\CMake\bin\cmake.exe" -E __create_def C:\Users\xiaguo\AppData\Local\Temp\benchmark\build\src\CMakeFiles\benchmark.dir\exports.def C:\Users\xiaguo\AppData\Local\Temp\benchmark\build\src\CMakeFiles\benchmark.dir\exports.def.objs && cd C:\Users\xiaguo\AppData\Local\Temp\benchmark\build" && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=src\CMakeFiles\benchmark.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~3\2019\ENTERP~1\VC\Tools\MSVC\1420~1.275\bin\Hostx64\x64\link.exe /nologo src\CMakeFiles\benchmark.dir\benchmark.cc.obj src\CMakeFiles\benchmark.dir\benchmark_register.cc.obj src\CMakeFiles\benchmark.dir\colorprint.cc.obj src\CMakeFiles\benchmark.dir\commandlineflags.cc.obj src\CMakeFiles\benchmark.dir\complexity.cc.obj src\CMakeFiles\benchmark.dir\console_reporter.cc.obj src\CMakeFiles\benchmark.dir\counter.cc.obj src\CMakeFiles\benchmark.dir\csv_reporter.cc.obj src\CMakeFiles\benchmark.dir\json_reporter.cc.obj src\CMakeFiles\benchmark.dir\reporter.cc.obj src\CMakeFiles\benchmark.dir\sleep.cc.obj src\CMakeFiles\benchmark.dir\statistics.cc.obj src\CMakeFiles\benchmark.dir\string_util.cc.obj src\CMakeFiles\benchmark.dir\sysinfo.cc.obj src\CMakeFiles\benchmark.dir\timers.cc.obj  /out:src\benchmark.dll /implib:src\benchmark.lib /pdb:pdb\benchmark.pdb /dll /version:0.0 /DEBUG:FASTLINK /LTCG:incremental /INCREMENTAL:NO  /DEF:src\CMakeFiles\benchmark.dir\exports.def  Shlwapi.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
ninja: build stopped: subcommand failed.

codars avatar May 14 '19 22:05 codars

what are the contents of src/ (where it's trying to find benchmark.lib) ?

dmah42 avatar May 15 '19 07:05 dmah42

It's this folder: https://github.com/google/benchmark/tree/master/src

codars avatar May 15 '19 16:05 codars