Building openvas-scanner from source: libopenvas_misc.so.22.4.1~dev1: undefined reference to `is_host_alive'

Hi all,

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.

Anyone can help?

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

Hi there,

I already ran the build script with the root account, and ran ldconfig after installing gvm-libs before reporting this.

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.

I built it again with $INSTALL_PREFIX = /usr/local and the error did not occur. I’m testing more with other prefixes.

Hi @Lukas,

I’m not sure why it is messed up. I didn’t run any custom commands to update the path.

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.

That is a absolute path, you need to understand the difference between a absolute and relative path ! Otherwise you will run into explosive risks :wink:

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!

I followed this instruction: https://greenbone.github.io/docs/latest/22.4/source-build/index.html#choosing-an-install-prefix

I’m not sure if /opt/gvm is not an absolute path. I’m just trying to use a custom path but keep the path format from the document.

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):

Hi @cfi,

Thank you for responding! I already updated the PKG_CONFIG_PATH variable. If I didn’t, the previous builds didn’t work. Here is what I ran:

export PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH

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!

Here is the content of the lib dir:

ls $INSTALL_PREFIX/lib
libgvm_base.so
libgvm_base.so.22
libgvm_base.so.22.4.5~dev1
libgvm_boreas.so
libgvm_boreas.so.22
libgvm_boreas.so.22.4.5~dev1
libgvm_gmp.so
libgvm_gmp.so.22
libgvm_gmp.so.22.4.5~dev1
libgvm_osp.so
libgvm_osp.so.22
libgvm_osp.so.22.4.5~dev1
libgvm_util.so
libgvm_util.so.22
libgvm_util.so.22.4.5~dev1
pkgconfig
ls $INSTALL_PREFIX/lib/pkgconfig
libgvm_base.pc
libgvm_boreas.pc
libgvm_gmp.pc
libgvm_osp.pc
libgvm_util.pc

Hi @jjnicola,
Can you please test with a custom INSTALL_PREFIX such as /opt/gvm? I still can’t build the scanner successfully.

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:

  1. is the installation of all components really done based on the stable tags of GitHub (no mixed versions, commits, branches, …)
  2. is the build and installation of the previous component like e.g. gvm-libs successful?
  3. Are there no leftovers from older installations on a different prefix like e.g. /usr/local/lib?
2 Likes

Hi @cfi,

I built the scanner successfully when I checked out the commit 75930f5a086a38f722d5f84258992189168bf39f. The error only happens if I use the latest stable source.

  1. I build both the openvas-scanner and gvm-libs from the latest stable source.
  2. gvm-libs was built successfully.
  3. I built the scanner on a clean virtual machine (Ubuntu server 22.04).

So the difference between that commit and the latest stable branch is the following:

https://github.com/greenbone/openvas-scanner/compare/75930f5a086a38f722d5f84258992189168bf39f...stable

Let’s see if some one from the dev team can give some insight why there is a difference here.

1 Like

The error occurred after this:

[ 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?

Hi there, I think this is the root cause of the problem when I build the scanner:

-- Installing: /install/gvm-libs/opt/gvm/include/gvm/base/version.h
-- Installing: /install/gvm-libs/opt/gvm/lib/pkgconfig/libgvm_boreas.pc
-- Installing: /install/gvm-libs/opt/gvm/lib/libgvm_boreas.so.22.4.7~dev1
-- Installing: /install/gvm-libs/opt/gvm/lib/libgvm_boreas.so.22
-- Set runtime path of "/install/gvm-libs/opt/gvm/lib/libgvm_boreas.so.22.4.7~dev1" to ""
-- Installing: /install/gvm-libs/opt/gvm/lib/libgvm_boreas.so
-- Installing: /install/gvm-libs/opt/gvm/include/gvm/boreas/alivedetection.h
-- Installing: /install/gvm-libs/opt/gvm/include/gvm/boreas/arp.h
-- Installing: /install/gvm-libs/opt/gvm/include/gvm/boreas/boreas_error.h

I have same problem. Did you find solution