Nvc++ -static-nvidia yields corrupted library


When I compile a dynamic loaded library on linux and add the -static-nvidia option, the resulting .so file is corrupted and does not work. However the linker does not show any error message.

I used the following options:
“Linux_x86_64/20.7/compilers/bin/nvc++” -static-nvidia -ta=tesla:nollvm -Mcuda=cuda11.0,nollvm -Mcudalib=curand -s -fpic -o mylib.so

ldd on mylib.so shows “not a dynamic executable”.

Kind regards,

Hi Rob,

Can you try adding the “-shared” option? This flag instructs the compiler to create a shared object.

Now I would expect a link error from the command above since it would create an executable. Presuming that the objects used in the library don’t have a “main” program, I would expect undefined reference error. I’d need a more information to understand why that’s not occurring.