Skip to content

[BUG] #1435 breaks automated builds on Windows #1441

@DanielLiamAnderson

Description

@DanielLiamAnderson

Describe the bug
My CI automatically clones the main branch using CMake FetchContent. My Windows CI builds are now failing as of #1435. Specifically, the following linker error appears:

bench_delayed.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct benchmark::State::StateIterator __cdecl benchmark::State::begin(void)" (__imp_?begin@State@benchmark@@QEAA?AUStateIterator@12@XZ) referenced in function "void __cdecl bench_tokens(class benchmark::State &)" (?bench_tokens@@YAXAEAVState@benchmark@@@Z) [D:\a\parlaylib\parlaylib\build\benchmark\bench_delayed.vcxproj]
bench_delayed.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct benchmark::State::StateIterator __cdecl benchmark::State::end(void)" (__imp_?end@State@benchmark@@QEAA?AUStateIterator@12@XZ) referenced in function "void __cdecl bench_tokens(class benchmark::State &)" (?bench_tokens@@YAXAEAVState@benchmark@@@Z) [D:\a\parlaylib\parlaylib\build\benchmark\bench_delayed.vcxproj]
bench_delayed.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __cdecl benchmark::State::range(unsigned __int64)const " (__imp_?range@State@benchmark@@QEBA_J_K@Z) referenced in function "void __cdecl bench_tokens(class benchmark::State &)" (?bench_tokens@@YAXAEAVState@benchmark@@@Z) [D:\a\parlaylib\parlaylib\build\benchmark\bench_delayed.vcxproj]
bench_delayed.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl benchmark::internal::FunctionBenchmark::FunctionBenchmark(char const *,void (__cdecl*)(class benchmark::State &))" (__imp_??0FunctionBenchmark@internal@benchmark@@QEAA@PEBDP6AXAEAVState@2@@Z@Z) referenced in function "void __cdecl `dynamic initializer for 'benchmark_uniq_2_benchmark_''(void)" (??__Ebenchmark_uniq_2_benchmark_@@YAXXZ) [D:\a\parlaylib\parlaylib\build\benchmark\bench_delayed.vcxproj]
bench_delayed.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl benchmark::internal::FunctionBenchmark::~FunctionBenchmark(void)" (__imp_??1FunctionBenchmark@internal@benchmark@@UEAA@XZ) referenced in function "public: virtual void * __cdecl benchmark::internal::FunctionBenchmark::`scalar deleting destructor'(unsigned int)" (??_GFunctionBenchmark@internal@benchmark@@UEAAPEAXI@Z) [D:\a\parlaylib\parlaylib\build\benchmark\bench_delayed.vcxproj]
D:\a\parlaylib\parlaylib\build\benchmark\Debug\bench_delayed.exe : fatal error LNK1120: 5 unresolved externals [D:\a\parlaylib\parlaylib\build\benchmark\bench_delayed.vcxproj]

Downgrading to any previous commit works fine and fixes the error.

Here is an example CI run that demonstrates the issue: https://github.com/cmuparlay/parlaylib/runs/7453801262?check_suite_focus=true#step:5:6769 (build failed)

Here is an identical CI run of the same code, except that I downgraded Google Benchmark to v1.6.2: https://github.com/cmuparlay/parlaylib/runs/7454449941?check_suite_focus=true (build succeeded)

System
Which OS, compiler, and compiler version are you using:

  • OS: Microsoft Windows Server 2022 10.0.20348 (windows-latest in Github Actions)
  • Compiler and version: MSVC 19.32.31332.0

To reproduce
Steps to reproduce the behavior:

  1. Checkout https://github.com/cmuparlay/parlaylib/tree/45433ca5425db200071feb60c58e965967112f40
  2. mkdir build && cd build
  3. cmake -A x64 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=" /bigobj " -DPARLAY_BENCHMARK=On ..
  4. cmake --build .
  5. See error

Expected behavior
The build does not produce a linker error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions