NVCC fails to create output file

Hi everyone,
I am trying to compile a static library (statically linked with CUDA) as plug-in to inject in another program.

At the beginning, for easiness, I adapted one (Windows) VS Solution files everyone can get from NVIDIA CUDA examples. However, I now would like to understand a bit more in detail how a CUDA compilation actually works, so I switched to command line compilation.

Here is the full command:

  nvcc.exe
      --compile -DBSACL_USE_CUDA__ -DBSACLC_DEBUG -DWIN32  --use-local-env  --verbose  -I"D:\BSA\BSACL\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include"  --relocatable-device-code=true  --lib --machine 64 -cudart static  --x cu --debug  --generate-line-info  -gencode=arch=compute_70,code=sm_70
      --linker-options --output-file "BSACLlib_cuda.lib"  --library-path "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\lib\x64"  --library cudart_static
        D:\BSA\BSACL\src\bsacl.c

Compiles fine, but fails at the moment of linking since I get the error:

c1xx: fatal error C1083: Not possible to open origin file: 'BSACLlib_cuda.lib': No such file or directory

What am I doing wrong ?

Thanks!

specifying --compile indicates compile only. You aren’t linking anything there. That step by itself isn’t sufficient to create a linked library. So it’s also rather curious to me that you have --linker-options in there.

It’s not really clear if the command you have shown is the command that is producing the C1083 error or if it is coming from some subsequent command you have issued. If you want help with something like this, my advice is to include the full console output rather than just the error, showing all the commands that led up to that error.

If you want to see how to build a static library using the command line, one possible approach is to set one up in VS, then study the output console carefully.

Otherwise, this may be of interest.

If you simply want to convert bsacl.c into a static lib, I think the command you want should be something like this:

nvcc.exe
      -DBSACL_USE_CUDA__ -DBSACLC_DEBUG -DWIN32  --use-local-env  --verbose  -I"D:\BSA\BSACL\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include"  --relocatable-device-code=true  --lib --machine 64 -cudart static  --x cu --debug   -gencode=arch=compute_70,code=sm_70
      --output-file "BSACLlib_cuda.lib"  --library-path "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\lib\x64"  --library cudart_static
        D:\BSA\BSACL\src\bsacl.c

@Robert_Crovella ,
Thanks for the answer.

I had the same doubt while doing it (say, I don’t use compilers daily, but close), but I don’t know why I mis-interpreted the help message displayed by nvcc. My bad there.
Same for --linker-options

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.