Compile cuda program in so file

Hello,

I work on qtcreator and I would like to try to generate a so file from my program composed of cpp files and cuda files.

When I compile the so file I get that error:

/usr/bin/ld: progr_cuda.o:
relocation R_X86_64_32 against `.rodata' can not be used when making a
shared object; recompile with -fPIC

I don’t understand why this append because it works in program mode generation.

Have you tried following the instructions in the error message?

nvcc -Xcompiler="-fPIC" -shared ...

Yes it seems to work properly now.

Thank you.

@tera nice.