Feature #2047

Fix compilation failures if fftw3, libtiff or Python are static.

Added by pospelov almost 2 years ago. Updated 8 months ago.

Status:ResolvedStart date:04 May 2018
Priority:NormalDue date:
Assignee:pospelov% Done:

0%

Category:-
Target version:Sprint 41

Description

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.

Possible solutions:

  • CMake should detect if found dependencies are static only and propagate -fPIC key to compilation flag.

or

  • CMake should detect if dependencies are static and exit with error message insisting on having dynamic libraries.

History

#1 Updated by pospelov 11 months ago

  • Status changed from Backlog to Sprint
  • Assignee set to pospelov
  • Target version set to Sprint 41

#2 Updated by pospelov 11 months ago

Moving to release, got complain from Artur.

#3 Updated by pospelov 8 months 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).

Also available in: Atom PDF