Building LAMMPS as a shared library

Axel,

I realize there is a previous email regarding this issue to which you had previously responded.

I chose your second option:

b) use -Xcompiler -fPIC with the CUDA_OPTS variable, so you have nvcc
pass the -fPIC to the underlying gcc compiler.

I changed the line to read:
CUDA_OPTS = -Xcompiler -fPIC -DUNIX -O3 -Xptxas -v --use_fast_math

which "works fine" (i.e. no errors in the building of the .a file) but I get the same (and only) error at the end of the main LAMMPS build:
ld: ../../lib/gpu/libgpu.a(lal_device.o): relocation R_X86_64_32S against `_ZTVN10ucl_cudadr11UCL_BaseMatE' can not be used when making a shared object; recompile with -fPIC
../../lib/gpu/libgpu.a: could not read symbols: Bad value

Not quite sure what to do...

I am using CUDA/5.0.35.

Regards,

Ross

Axel,

I realize there is a previous email regarding this issue to which you had previously responded.

I chose your second option:

b) use -Xcompiler -fPIC with the CUDA_OPTS variable, so you have nvcc
pass the -fPIC to the underlying gcc compiler.

I changed the line to read:
CUDA_OPTS = -Xcompiler -fPIC -DUNIX -O3 -Xptxas -v --use_fast_math

which "works fine" (i.e. no errors in the building of the .a file) but I get the same (and only) error at the end of the main LAMMPS build:
ld: ../../lib/gpu/libgpu.a(lal_device.o): relocation R_X86_64_32S against `_ZTVN10ucl_cudadr11UCL_BaseMatE' can not be used when making a shared object; recompile with -fPIC
../../lib/gpu/libgpu.a: could not read symbols: Bad value

Not quite sure what to do...

you probably forgot to add -fPIC to the non-cuda flags as well, e.g. OPTS

axel.

also, make sure you

$ make -f clean