← All tasks
cppninja-build/ninja #2006Not a task: already works

Unable to build form source with clang

envgap__ninja-build__ninja-2006

01 / FAILURE SIGNATURE

As reported upstream

lld-link: error: undefined symbol: void __cdecl CreateWin32MiniDump(struct _EXCEPTION_POINTERS *)
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
102ef25fdf27504f3ac7392ce8dbfe83485fb25a
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

ninja-build/ninja #2006 · read the original issue
```

lld-link: error: undefined symbol: void __cdecl CreateWin32MiniDump(struct _EXCEPTION_POINTERS *)

>>> referenced by C:/Users/a7bd50f1/Downloads/ninja-1.10.2/src/ninja.cc

>>>               CMakeFiles/ninja.dir/src/ninja.cc.obj

clang++: error: linker command failed with exit code 1 (use -v to see invocation)

```



The source file containing the implementation of the missing function is conditionally included into compilation inside an `if(MSVC)`. It seems that the flag is not set for clang with GNU-like command line (clang.exe), but it is for MSVC style (clang-cl.exe), even though in both cases MSVC runtime libraries and headers are used, in both cases the target is `x86_64-pc-windows-msvc`. Removing the check makes the ninja build just fine.



The problematic part of CMakeLists.txt:

```

if(MSVC)

	target_sources(libninja PRIVATE src/minidump-win32.cc)

endif()

```

`cmake` was invoked with `CC=clang CXX=clang++ cmake .. -GNinja`

A snippet from the CMake compiler discovery log:

```

-- The C compiler identification is Clang 12.0.1 with GNU-like command-line

-- The CXX compiler identification is Clang 12.0.1 with GNU-like command-line

-- Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe - skipped

-- Check for working CXX compiler: C:/Program Files/LLVM/bin/clang++.exe - skipped



-- Configuring done

-- Generating done

```

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]