Cannot build dune-uggrid with shared libraries only
Compiling dune-uggrid with the CMake option "-DBUILD_SHARED_LIBS=TRUE" fails for me with the following error message:
[ 97%] Linking CXX shared library libugS2.so /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/algebra.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/enrol.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/evm.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/mgio.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/ugio.cc.o: relocation R_X86_64_32S against symbol_ZN2UG2D219element_descriptorsE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/ugm.cc.o: relocation R_X86_64_32S against undefined symbol
_ZN2UG2D27dddctrlE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/cw.cc.o: relocation R_X86_64_32S against symbol_ZN2UG2D215control_entriesE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/initgm.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/elements.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/shapes.cc.o: relocation R_X86_64_32S against symbol
_ZN2UG2D219element_descriptorsE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/evalproc.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/rm.cc.o: relocation R_X86_64_32S against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/refine.cc.o: relocation R_X86_64_32S against symbol_ZN2UG2D211refine_infoE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/smooth.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/dlmgr.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/gmcheck.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../gm/CMakeFiles/ug_gm2.dir/er.cc.o: relocation R_X86_64_32 against.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/algebra/CMakeFiles/algebra2.dir/ugblas.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/algebra/CMakeFiles/algebra2.dir/ugiter.cc.o: relocation R_X86_64_32S against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/algebra/CMakeFiles/algebra2.dir/transgrid.cc.o: relocation R_X86_64_32S against symbol
_ZN2UG2D219element_descriptorsE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/algebra/CMakeFiles/algebra2.dir/block.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/algebra/CMakeFiles/algebra2.dir/npcheck.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/algebra/CMakeFiles/algebra2.dir/blasm.cc.o: relocation R_X86_64_32S against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/udm/CMakeFiles/udm2.dir/disctools.cc.o: relocation R_X86_64_32S against symbol
_ZN2UG2D219element_descriptorsE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/udm/CMakeFiles/udm2.dir/npscan.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/udm/CMakeFiles/udm2.dir/udm.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/udm/CMakeFiles/udm2.dir/formats.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../np/udm/CMakeFiles/udm2.dir/numproc.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../ui/CMakeFiles/ugui2.dir/cmdline.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../ui/CMakeFiles/ugui2.dir/commands.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../dev/CMakeFiles/devices.dir/ugdevices.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/ugenv.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/heaps.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/misc.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/defaults.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/fileopen.cc.o: relocation R_X86_64_32 against
.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/ugstruct.cc.o: relocation R_X86_64_32S against.bss' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/bio.cc.o: relocation R_X86_64_32 against
.bss' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/scan.cc.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: ../low/CMakeFiles/low.dir/ugtimer.cc.o: relocation R_X86_64_32S against symbol
_ZN2UG8ug_timerE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status
The system is Debian Stretch and the full list of CMake flags is the following:
`WARN_FLAGS="-Wall -Winit-self -Wfatal-errors -fdiagnostics-color" ARCH_FLAGS="-march=ivybridge -mfpmath=sse" OPTIM_FLAGS="-DNDEBUG -O3 -funroll-loops -ffast-math --param inline-unit-growth=700 -fno-stack-protector" DEBUG_FLAGS="-O0 -ggdb"
CMAKE_FLAGS="
-DCMAKE_CXX_FLAGS="${WARN_FLAGS} ${DEBUG_FLAGS} ${ARCH_FLAGS}"
-DCMAKE_INSTALL_PREFIX=${ENVDIR}
-DBUILD_SHARED_LIBS=TRUE
-DDUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS=TRUE
-DPYTHON_INSTALL_LOCATION=system
"`