Hello,
I am trying to compile a cpp code which has some external library calls (libnova) among others.
That lib is found using the find_library call:
find_library(NOVA_LIBRARIES NAMES nova
PATHS ${NOVA_ROOT} ENV INSTALL_LOCATION
PATH_SUFFIXES lib lib64
${_obLinkDir}
${GNUWIN32_DIR}/lib
)
The NOVA_LIBRARIES cmake var outputs NOVA_LIBRARIES /usr/lib/x86_64-linux-gnu/libnova.so
When the library is linked the makefile output is (object file list removed):
[100%] Linking CXX shared library libfoo.so
cd /tst/build/src/time && /usr/bin/cmake -E cmake_link_script CMakeFiles/TIME.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -fopenmp -O3 -DNDEBUG -g -Wall -Wextra -Werror -ggdb -fpermissive -gdwarf-3
-fprofile-arcs -ftest-coverage -fprofile-arcs
-shared -Wl,-soname,libfoo.so -o libfoo.so object_files.o
-Wl,-rpath,::::::::::::::::::::::::: /usr/lib/x86_64-linux-gnu/libnova.so
As you can see the libnova lib is a non versioned linked lib, tut if I objdump the generated lib I actually get:
NEEDED libnova-0.16.so.0
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libgomp.so.1
NEEDED libgcc_s.so.1
NEEDED libpthread.so.0
NEEDED libc.so.6
And If I ldd the lib:
root@46bdf6475137:/tst/build/src/time# ldd libfoo.so
linux-vdso.so.1 (0x00007ffe4ddad000)
libnova-0.16.so.0 => /usr/lib/x86_64-linux-gnu/libnova-0.16.so.0
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2762523000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f27623a0000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f276236f000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2762355000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2762332000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2762171000)
/lib64/ld-linux-x86-64.so.2 (0x00007f27626d4000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f276216c000)
There are some symlinks but are not used at all:
lrwxrwxrwx 1 root root 21 Jan 23 2019 /usr/lib/x86_64-linux-gnu/libnova-0.16.so.0 -> libnova-0.16.so.0.0.0
-rw-r--r-- 1 root root 3669184 Jan 23 2019 /usr/lib/x86_64-linux-gnu/libnova-0.16.so.0.0.0
-rw-r--r-- 1 root root 3811162 Jan 23 2019 /usr/lib/x86_64-linux-gnu/libnova.a
lrwxrwxrwx 1 root root 21 Jan 23 2019 /usr/lib/x86_64-linux-gnu/libnova.so -> libnova-0.16.so.0.0.0
Also, I tried to remove the symlink “libnova-0.16.so.0” to see if now the linker takes the non-versioned or at least, the major versioned symlink:
-rw-r--r-- 1 root root 3811162 Jan 23 2019 /usr/lib/x86_64-linux-gnu/libnova.a
lrwxrwxrwx 1 root root 17 Aug 13 10:35 /usr/lib/x86_64-linux-gnu/libnova.so -> libnova.so.0.16.0
lrwxrwxrwx 1 root root 17 Aug 13 10:23 /usr/lib/x86_64-linux-gnu/libnova.so.0 -> libnova.so.0.16.0
-rw-r--r-- 1 root root 3669184 Jan 23 2019 /usr/lib/x86_64-linux-gnu/libnova.so.0.16.0
But it still points to an unexisting lib (since I removed it):
NEEDED libnova-0.16.so.0
NEEDED libstdc++.so.6
NEEDED libm.so.6
NEEDED libgomp.so.1
NEEDED libgcc_s.so.1
NEEDED libpthread.so.0
NEEDED libc.so.6
How can I get the non versioned lib as the linked lib?
Thanks in advance