Linking Problem: CPM TFEL libraries and relative linking path do not match
Description
If ogs is configured to use MFRONT and TFEL package is added by CPM the relative path of the TFEL libs is different to the path used by linking the ogs binary.
Steps to Reproduce the Problem
- mkdir build && cd build
- cmake .. -DOGS_USE_MFRONT="ON"
- make
Expected behavior:
ldd ogs \rightarrow
all libs can be found
Actual behavior: [What actually happened]
ldd ogs
linux-vdso.so.1 (0x00007ffdaf8bb000)
libOgsMFrontBehaviour.so => /home/beese/ogs/buildRelease/bin/./../lib64/libOgsMFrontBehaviour.so (0x00007fc4e4de5000)
libTFELTests.so.3.4.2-dev => not found
libTFELException.so.3.4.2-dev => not found
libTFELUtilities.so.3.4.2-dev => not found
libTFELMaterial.so.3.4.2-dev => not found
libTFELMath.so.3.4.2-dev => not found
libMTestFileGenerator.so.3.4.2-dev => not found
libTFELPhysicalConstants.so.3.4.2-dev => not found
libMFrontGenericInterface.so => /home/beese/ogs/buildRelease/bin/./../lib64/libMFrontGenericInterface.so (0x00007fc4e4b8b000)
In the link.txt the relative path for TFEL libs is set to:
/usr/bin/c++ -fopenmp -O3 -DNDEBUG CMakeFiles/ogs.dir/ogs.cpp.o -o ../../bin/ogs -Wl,-rpath,"\$ORIGIN:\$ORIGIN/../lib64:/home/beese/ogs/buildRelease/_ext/TFEL/lib64"
But if I navigate to the TFEL dictionary there is only:
:~/ogs/buildRelease/_ext/TFEL> ls
bin CMakeCache.txt CMakeFiles cmake_install.cmake CMakeLists.txt include lib Makefile share src tmp
To get valid links to the libraries I can create the symbolic link:
ln -s lib lib64
and everything is working fine
Specifications
- Version: commit deb816da (HEAD -> upstreammaster, upstream/master)
- Platform:
cat /etc/os-release
NAME="openSUSE Leap"
VERSION="15.2"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.2"
PRETTY_NAME="openSUSE Leap 15.2"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.2"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
beese@ogs03:~/ogs/buildRelease/bin> uname -a
Linux ogs03 5.3.18-lp152.84-default #1 SMP Tue Jul 20 23:04:11 UTC 2021 (baaeecf) x86_64 x86_64 x86_64 GNU/Linux