Linking error / Rust FFI

Hi! I’m struggling to get CUDA FFI to link in rust FFI, on Windows. I’m compiling with this command:
nvcc src/cuda.cu -gencode "arch=compute_75,code=sm_75" -c -o cuda.lib, which generates a library successfully. I have the environment variable CUDA_PATH set to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2, with CUDA installed to that directory.

The error:

  = note: LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
          cuda.lib : error LNK2019: unresolved external symbol __cudaRegisterFatBinary referenced in function "void __cdecl __nv_cudaEntityRegisterCallback(void * *)" (?__nv_cudaEntityRegisterCallback@@YAXPEAPEAX@Z)
          cuda.lib : error LNK2019: unresolved external symbol __cudaRegisterFatBinaryEnd referenced in function "void __cdecl __nv_cudaEntityRegisterCallback(void * *)" (?__nv_cudaEntityRegisterCallback@@YAXPEAPEAX@Z)
          cuda.lib : error LNK2019: unresolved external symbol __cudaUnregisterFatBinary referenced in function "void __cdecl __cudaUnregisterBinaryUtil(void)" (?__cudaUnregisterBinaryUtil@@YAXXZ)
          C:\Users\the_a\code\wf-lab\target\debug\deps\wf_lab.exe : fatal error LNK1120: 3 unresolved external

Where would you start? I don’t think it’s the nvcc command. Is there any special action that needs to be taken to link? Thank you.

Update: I get a similar issue on Ubuntu:

  = note: /usr/bin/ld: /home/david/code/wf-lab/target/debug/build/wf_lab-022d4f9dfab3e335/out/libcuda.a(cuda.o): in function `ffi_test':
          /home/david/code/wf-lab/src/cuda.cu:46: undefined reference to `std::cout'
          /usr/bin/ld: /home/david/code/wf-lab/src/cuda.cu:46: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
          /usr/bin/ld: /home/david/code/wf-lab/src/cuda.cu:46: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
          /usr/bin/ld: /home/david/code/wf-lab/src/cuda.cu:46: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
          /usr/bin/ld: /home/david/code/wf-lab/target/debug/build/wf_lab-022d4f9dfab3e335/out/libcuda.a(cuda.o): in function `__cudaUnregisterBinaryUtil()':
          /usr/include/crt/host_runtime.h:259: undefined reference to `__cudaUnregisterFatBinary'
          /usr/bin/ld: /home/david/code/wf-lab/target/debug/build/wf_lab-022d4f9dfab3e335/out/libcuda.a(cuda.o): in function `__sti____cudaRegisterAll()':
          /tmp/tmpxft_000060fa_00000000-6_cuda.cudafe1.stub.c:13: undefined reference to `__cudaRegisterFatBinary'
          /usr/bin/ld: /tmp/tmpxft_000060fa_00000000-6_cuda.cudafe1.stub.c:13: undefined reference to `__cudaRegisterFatBinaryEnd'
          /usr/bin/ld: /home/david/code/wf-lab/target/debug/build/wf_lab-022d4f9dfab3e335/out/libcuda.a(cuda.o): in function `__static_initialization_and_destruction_0(int, int)':
          /usr/include/c++/9/iostream:74: undefined reference to `std::ios_base::Init::Init()'
          /usr/bin/ld: /usr/include/c++/9/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
          collect2: error: ld returned 1 exit status