Skip to content

Windows build vecadd sample fail: linking with link.exe failed: exit code: 1120 #364

@CharryWu

Description

@CharryWu

Build on my windows machine failed on vecadd sample using CUDA v13.2. Other samples matmul gemm sha2_crates_io don't have build failures.

I've completed necessary steps of

  • Installing LLVM 7.0.1
  • adding nvvm64 path to system PATH variable
  • setting up include, dll, lib CUDA dir
  • setting up system environment variables CUDNN_INCLUDE_DIR

I've also tried taking out crates/cudnn and crates/cudnn-sys from Cargo.toml, however that yields the same failure msg:

warning: vecadd@0.1.0: Building rustc_codegen_nvvm to satisfy cuda_builder requirements
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\wuzcc\\AppData\\Local\\Temp\\rustcAggPCL\\symbols.o" "<43 object files omitted>" "C:\\Users\\wuzcc\\repos\\rust-cuda\\target\\debug\\deps/{libnanorand-9f6e19a68fc9bbd8,libcust-52f8a6d6e3076750,libbitflags-51ce0b49603a3905,libcust_core-71568aa6690e393f,libnum_complex-a7eefcb649649515,libglam-19391019730a1d01,liblibm-444b5f94078aa3ba,libmint-818e8402e3e851d1,libvek-306fb5567b251c0b,libapprox-d6b14a695a88116e,libnum_integer-94b95c575c64d9f3,libnum_traits-2550727de1635f7c,libbytemuck-c4d6ba9783c81500,libcust_raw-f8ef2e101cb21c64}.rlib" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,libcfg_if-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v13.0\\lib\\x64\\cuda.lib" "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v13.0\\lib\\x64\\cublas.lib" "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v13.0\\nvvm\\lib\\x64\\nvvm.lib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/LIBPATH:C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v13.0\\lib\\x64" "/LIBPATH:C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v13.0\\nvvm\\bin" "/LIBPATH:C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v13.0\\nvvm\\lib\\x64" "/OUT:C:\\Users\\wuzcc\\repos\\rust-cuda\\target\\debug\\deps\\vecadd.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library␍
          libnanorand-9f6e19a68fc9bbd8.rlib(nanorand-9f6e19a68fc9bbd8.nanorand.96a93bfb8161137c-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol SystemFunction036 referenced in function _ZN8nanorand7entropy7windows7entropy17h2165301ee84d00f2E␍
          C:\Users\wuzcc\repos\rust-cuda\target\debug\deps\vecadd.exe : fatal error LNK1120: 1 unresolved externals␍


warning: vecadd@0.1.0: Building rustc_codegen_nvvm to satisfy cuda_builder requirements
error: could not compile `vecadd` (bin "vecadd") due to 1 previous error

rustc 1.91.0-nightly (f34ba774c 2025-08-03)
CUDA Kit Version: v13.2
Microsoft Visual Studio 2022 Version 17.14.20
OS version: Windows 11 25H2
GPU Device: RTX 3060 12GB
Clang version 7.0.1
Nvidia GeForce Driver: 595.79

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