Issue 60573
Summary [MSVC] LLVM failed to build due to error LNK2019 on Windows
Labels new issue
Assignees
Reporter Zhaojun-Liu
    **Description:**
We update the commit of LLVM, and it built failed due to the below error, could you please take a look? Thanks.
```
NVPTXArch.obj : error LNK2019: unresolved external symbol _cuGetErrorString@8 referenced in function "int __cdecl handleError(enum cudaError_enum)" (?handleError@@YAHW4cudaError_enum@@@Z) [F:\gitP\llvm\llvm-project\build_x86\tools\clang\tools\nvptx-arch\nvptx-arch.vcxproj]
 NVPTXArch.obj : error LNK2019: unresolved external symbol _cuInit@4 referenced in function _main [F:\gitP\llvm\llvm-project\build_x86\tools\clang\tools\nvptx-arch\nvptx-arch.vcxproj]
 NVPTXArch.obj : error LNK2019: unresolved external symbol _cuDeviceGet@8 referenced in function _main [F:\gitP\llvm\llvm-project\build_x86\tools\clang\tools\nvptx-arch\nvptx-arch.vcxproj]
 NVPTXArch.obj : error LNK2019: unresolved external symbol _cuDeviceGetCount@4 referenced in function _main [F:\gitP\llvm\llvm-project\build_x86\tools\clang\tools\nvptx-arch\nvptx-arch.vcxproj]
 NVPTXArch.obj : error LNK2019: unresolved external symbol _cuDeviceGetAttribute@12 referenced in function _main [F:\gitP\llvm\llvm-project\build_x86\tools\clang\tools\nvptx-arch\nvptx-arch.vcxproj]
 F:\gitP\llvm\llvm-project\build_x86\RelWithDebInfo\bin\nvptx-arch.exe : fatal error LNK1120: 5 unresolved externals [F:\gitP\llvm\llvm-project\build_x86\tools\clang\tools\nvptx-arch\nvptx-arch.vcxproj]
```
The commit we used: bccf5999d38f14552f449618c1d72d18613f4285

**Repro steps:**
1. git clone https://github.com/llvm/llvm-project F:\gitP\llvm\llvm-project
2. git -C "F:\gitP\llvm\llvm-project" rev-parse --git-dir
3. git -C "F:\gitP\llvm\llvm-project" clean -xdf
4. git -C "F:\gitP\llvm\llvm-project" fetch --recurse-submodules=no --force
5. git -C "F:\gitP\llvm\llvm-project" reset --hard bccf599
6. git -C "F:\gitP\llvm\llvm-project" remote prune origin
7. mkdir F:\gitP\llvm\llvm-project\build_x86 and cd F:\gitP\llvm\llvm-project\build_x86
8. cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DLLVM_ENABLE_PROJECTS="clang" ..\llvm
9. msbuild /maxcpucount:4 /p:Platform=Win32 /p:Configuration=RelWithDebInfo /p:PreferredToolArchitecture=x64 LLVM.sln /t:Rebuild 2>&1

**Expected result:**
build successfully.

**Actural Result:**
[build.log](https://github.com/llvm/llvm-project/files/10671194/build.log)

Attached a repro file (cd linkrepro folder, execute link.exe @link.rsp):
[linkrepro.zip](https://github.com/llvm/llvm-project/files/10671206/linkrepro.zip)


_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to