Skip to content

CMake: enable POSITION_INDEPENDENT_CODE to fix linker error.

Martin Heistermann requested to merge cmake-enable-pic into master

I had the following error in one of my projects using CoMISo:

/usr/bin/ld: /tmp/lto-llvm-988aa8.o: warning: relocation against `_ZZN12COMISO_EIGEN21factored_to_quadraticIdLi0EiLi0EiEEvRKN5Eigen12SparseMatrixIT_XT0_
ET1_EERNS2_IS3_XT2_ET3_EERNS1_6MatrixIS3_Lin1ELi1ELi0ELin1ELi1EEEE8deb_nmbr' in read-only section `.text._ZN6COMISO17ConstrainedSolver5solveERN12COMISO_
EIGEN19HalfSparseRowMatrixIdEERNS1_19HalfSparseColMatrixIdEERN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEERSt6vectorIiSaIiEEdb'                              
/usr/bin/ld: /tmp/lto-llvm-988aa8.o: relocation R_X86_64_PC32 against symbol `_ZTVN4Base13OStringStreamE' can not be used when making a shared object; r
ecompile with -fPIC                                                                                                                                     
/usr/bin/ld: final link failed: bad value                                          

This fixed it.

Merge request reports