I’m trying to build openvas-scanner from the latest git stable source, the following error occurred:
...
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'glib-2.0>=2.42'
-- Found glib-2.0, version 2.72.4
-- Checking for module 'json-glib-1.0>=1.4.4'
-- Found json-glib-1.0, version 1.6.6
-- Checking for module 'gnutls>=3.6.4'
-- Found gnutls, version 3.7.3
-- Checking for module 'libgvm_base>=22.4'
-- Found libgvm_base, version 22.4.5~dev1
-- Checking for module 'libgvm_util>=22.4'
-- Found libgvm_util, version 22.4.5~dev1
-- Checking for module 'libgvm_boreas>=22.4'
-- Found libgvm_boreas, version 22.4.5~dev1
...
[ 77%] Building C object nasl/CMakeFiles/openvas_nasl_shared.dir/time.c.o
[ 79%] Linking C shared library libopenvas_nasl.so
[ 79%] Built target openvas_nasl_shared
[ 80%] Building C object nasl/CMakeFiles/openvas-nasl.dir/nasl.c.o
[ 81%] Linking C executable openvas-nasl
/usr/bin/ld: warning: libgvm_boreas.so.22, needed by ../misc/libopenvas_misc.so.22.4.1~dev1, not found (try using -rpath or -rpath-link)
/usr/bin/ld: ../misc/libopenvas_misc.so.22.4.1~dev1: undefined reference to `is_host_alive'
collect2: error: ld returned 1 exit status
The gvm-libs is also built from the latest git stable source. I build the scanner using the same build script that I used to successfully build the old scanner version before.
Hi @panajo1017 ,
I have just tested in my environment and it is working for me.
Please try with sudo ldconfig .
Let me know if it worked.
Regards,
Juan
Your LD-library path is messed up. You need to fix your environment correctly to be able to dynamically link that. Never use relative LD libary dependencies, that is breaking a lot and introducing great security risks.
The error occurs when I build the scanner with custom prefixes such as /opt/gvm rather than /usr/local. I was able to successfully build the older version of the scanner with the same script.
Sorry because I’m not experienced with building software from source, I’m just following the document step by step. Please help to correct me if I’m doing wrong or guide me on what I have to do. Thank you!
It using a different installation prefix the PKG_CONFIG_PATH is probably not set correctly (which is something not specific to the Greenbone software stack but AFAICT common for all cmake based projects):
Here is the error if I don’t update the PKG_CONFIG_PATH variable:
-- Checking for module 'libgvm_base>=22.4'
-- No package 'libgvm_base' found
CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:825 (_pkg_check_modules_internal)
misc/CMakeLists.txt:32 (pkg_check_modules)
-- Configuring incomplete, errors occurred!
Ah, yes indeed. Otherwise you wouldn’t have received the following:
I’m not Juan but still can confirm this:
I can confirm that building the current stable tags from GitHub are building just fine when using an INSTALL_PREFIX such as /opt/gvm as i have recently updated two installations from 21.04 to 22.04. Both are running on different Debian releases (1x testing, 1x stable/bullseye).
For now i would suggest to cross-check a few things:
is the installation of all components really done based on the stable tags of GitHub (no mixed versions, commits, branches, …)
is the build and installation of the previous component like e.g. gvm-libs successful?
Are there no leftovers from older installations on a different prefix like e.g. /usr/local/lib?
I built the scanner successfully when I checked out the commit 75930f5a086a38f722d5f84258992189168bf39f. The error only happens if I use the latest stable source.
[ 80%] Building C object nasl/CMakeFiles/openvas-nasl.dir/nasl.c.o
[ 81%] Linking C executable openvas-nasl
/usr/bin/ld: warning: libgvm_boreas.so.22, needed by ../misc/libopenvas_misc.so.22.4.2~dev1, not found (try using -rpath or -rpath-link)
So is it necessary to make changes to the file nasl/CMakeLists.txt alonging with the file misc/CMakeLists.txt?