I have a myfile.cu file containing a global (device) function and a host function.
I use nvcc to create a myfile.o object file.
I would then like to be able to link this object file into a shared library, along with another object file using gcc -shared myfile.o myotherfile.o
However, when I try this, I get:
/usr/bin/ld: myfile.o: relocation R_X86_64_32 against `.nvFatBinSegment’ can not be used when making a shared object; recompile with -fPIC
myfile.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Is there a way around this (where is .nvFatBinSegment? Probably in some proprietry cuda code which I can’t recompile) - I guess not, and that I really need to use the driver API…?