Installing preCICE in Ubuntu 14.04

Hi~
I met an error when I use Cmake to compile PreCICE.

[ 60%] Building CXX object CMakeFiles/precice.dir/src/utils/MasterSlave.cpp.o
[ 60%] Building CXX object CMakeFiles/precice.dir/src/utils/Parallel.cpp.o
[ 61%] Building CXX object CMakeFiles/precice.dir/src/utils/Petsc.cpp.o
[ 61%] Building CXX object CMakeFiles/precice.dir/src/utils/String.cpp.o
[ 62%] Building CXX object CMakeFiles/precice.dir/src/utils/TableWriter.cpp.o
[ 62%] Building CXX object CMakeFiles/precice.dir/src/utils/stacktrace.cpp.o
[ 63%] Building CXX object CMakeFiles/precice.dir/src/xml/ConfigParser.cpp.o
[ 63%] Building CXX object CMakeFiles/precice.dir/src/xml/XMLTag.cpp.o
[ 64%] Linking CXX shared library libprecice.so
/usr/bin/ld: /usr/local/lib/liblapack.a(dgeev.o): relocation R_X86_64_32 against `.rodata’ can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/liblapack.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libprecice.so.1.6.1] Error 1
make[1]: *** [CMakeFiles/precice.dir/all] Error 2
make: *** [all] Error 2

I have try to add the following words at the beginning of the CMakeLists.txt but the error still appeared.

add_compile_options(-fPIC)

  • [C++ compiler] (gcc 5.5)
  • CMake
  • [Boost] (1.71)

Can anyone help me? Thanks~

Hi, @jun_leng!

In general, we don’t support Ubuntu 14.04 anymore (and it would be a good time to upgrade, as you probably don’t get any software updates, including security updates, anymore). I understand, however, that you are using a compatible, manually installed compiler, Boost version etc.

Your error is:

[ 64%] Linking CXX shared library libprecice.so
/usr/bin/ld: /usr/local/lib/liblapack.a(dgeev.o): relocation R_X86_64_32 against `.rodata’ can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/liblapack.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

This means that you are using a static library (liblapack.a) as a dependency to a shared library (libprecice.so), without the static library being ready for that (i.e. rellocatable). It is, therefore, a lapack issue.

I am not sure why lapack shows up here, but I assume because of PETSc. Could you try building without PETSc and uploading your complete CMake log here?

Finally, I chose to upgrade my system to Ubuntu 18 and finished installation~
Thanks~

1 Like