qsharp-runtime
qsharp-runtime copied to clipboard
Cannot build QIR Runtime using VS 2019 dev command prompt
Describe the bug
Running .\bootstrap.ps1 on a clean repo from a VS 2019 command prompt, ends with the following error:
##[info]Build QIR Runtime
On Windows build QIR Runtime using Clang
INFO*** build config: RelWithDebInfo
-- The C compiler identification is Clang 11.1.0 with GNU-like command-line
-- The CXX compiler identification is Clang 11.1.0 with GNU-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe
-- Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Program Files/LLVM/bin/clang.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Repos/qsharp-runtime/src/Qir/Runtime/bin/Release/CMakeFiles/CMakeTmp
Run Build Command(s):C:/ProgramData/chocolatey/bin/ninja.exe cmTC_600bc && [1/2] Building C object CMakeFiles/cmTC_600bc.dir/testCCompiler.c.obj
[2/2] Linking C executable cmTC_600bc.exe
FAILED: cmTC_600bc.exe
cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\clang.exe -fuse-ld=lld-link -nostartfiles -nostdlib -Werror -Wall -Wextra -g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -Xlinker /subsystem:console CMakeFiles/cmTC_600bc.dir/testCCompiler.c.obj -o cmTC_600bc.exe -Xlinker /implib:cmTC_600bc.lib -Xlinker /pdb:cmTC_600bc.pdb -Xlinker /version:0.0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames && cd ."
lld-link: error: <root>: undefined symbol: mainCRTStartup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:6 (project)
The command works fine on a normal command prompt.
To Reproduce
- Clone the repo
- Open a VS 2019 command prompt
- Run
.\bootstrap.ps1
Expected behavior
The command should succeed.
System information
- OS: Windows
- .NET Core Version: 5.0.301
- VS 2019 Version: 16.10.2