amnsbr / cubnm

A toolbox for biophysical network modeling on GPUs
https://cubnm.readthedocs.io
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

[BUG] Linking to pre-existing GSL libraries compiled without `-fPIC` #2

Closed amnsbr closed 6 months ago

amnsbr commented 11 months ago

When building from source setup.py searches for libgsl.a and libgslcblas.a in some known paths which will be linked in compilation of bnm.cu and run_simulations.cpp. If there are preexisting GSL libraries but they have not been compiled with -fPIC compilation fails with this error message:

  /bin/ld: /usr/lib/x86_64-linux-gnu/libgslcblas.a(xerbla.o): warning: relocation against `stderr@@GLIBC_2.2.5' in read-only section `.text'
  /bin/ld: /usr/lib/x86_64-linux-gnu/libgslcblas.a(xerbla.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC

To fix this the setup needs to identify if GSL libraries are compiled without -fPIC and if this is the case avoid using them.

amnsbr commented 6 months ago

I just added a note in the installation instructions that GSL must be built with --enable-shared option in this commit