Fix compilation failures if fftw3, libtiff or Python are static.
|Status:||Resolved||Start date:||04 May 2018|
|Target version:||Sprint 41|
If Python, libtiff or fftw3 are present on the system only in static versions, then CMake configuration passes successfully, but compilation fails in the middle with
[ 54%] Linking CXX shared library ../lib/_libBornAgainCore.so /usr/bin/ld: /usr/local/lib/libfftw3.a(apiplan.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libfftw3.a: error adding symbols: Bad value
This happens, when fftw, libtiff or Python appear on the system via manual compilation
configure; make; make install
By default, 'configure' produces only static libraries. To compile shared versions, one have to use --enable-shared flag.
Please note, that installation of fftw3/libtiff/Python via package manager doesn't have this problem, since it brings to the system both, static and shared and BornAgain use shared automatically.
- CMake should detect if found dependencies are static only and propagate -fPIC key to compilation flag.
- CMake should detect if dependencies are static and exit with error message insisting on having dynamic libraries.
#3 Updated by pospelov about 1 year ago
- Status changed from Sprint to Resolved
- Check for static fftw was implemented. CMake now will stop if only static fftw3 version is present.
- Check for static Python should wait for #2275 (may be it will not be relevant anymore).
- Check for static libtiff I have dropped (actually couldn't compile new libtiff statically, it comes naturally shared).