greenbone / openvas-scanner

This repository contains the scanner component for Greenbone Community Edition.
https://greenbone.github.io/docs/
GNU General Public License v2.0
3.25k stars 605 forks source link

OpenVASSD 6.0.0 - error in make: implicit declaration of function 'nvti_xref' #369

Closed afzouni closed 5 years ago

afzouni commented 5 years ago

Step 1: cmake

this is ok.

root@f815ef7590a5:~/share/openvas-6.0.0/build# cmake ..
-- Configuring the Scanner...
-- The C compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Could NOT find Git (missing:  GIT_EXECUTABLE)
-- Looking for clang-format...
-- clang-format not found...
Set LIBDIR to /usr/local/lib
-- Install prefix: /usr/local
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29")
-- Checking for module 'glib-2.0>=2.42'
--   Found glib-2.0, version 2.50.3
-- Checking for module 'gnutls>=3.2.15'
--   Found gnutls, version 3.5.8
-- Checking for module 'libgvm_base>=10.0.0'
--   Found libgvm_base, version 11.0.0
-- Checking for module 'libgvm_util>=10.0.0'
--   Found libgvm_util, version 11.0.0
-- Checking for module 'libopenvas_wmiclient>=1.0.4'
--
-- Checking for module 'libopenvas_wincmd>=1.0.4'
--
-- Looking for pcap...
-- Looking for pcap... /usr/lib/x86_64-linux-gnu/libpcap.so
-- Looking for pcap-config...
-- Looking for pcap-config... /usr/bin/pcap-config
-- Looking for gpgme...
-- Looking for gpgme... /usr/lib/x86_64-linux-gnu/libgpgme.so
-- Checking for module 'gio-2.0'
--   Found gio-2.0, version 2.50.3
-- Checking for module 'libopenvas_wmiclient>=1.0.4'
--
-- Checking for module 'libopenvas_wincmd>=1.0.4'
--
-- Checking for module 'libssh>=0.6.0'
--   Found libssh, version 0.7.3
-- Looking for ksba >= 1.0.7...
-- Looking for ksba >= 1.0.7... /usr/lib/x86_64-linux-gnu/libksba.so
-- Found ksba 1.3.5-unknown...
-- Looking for pcap...
-- Looking for gpgme... /usr/lib/x86_64-linux-gnu/libgpgme.so
-- Looking for netsnmp...
-- Looking for netsnmp... /usr/lib/x86_64-linux-gnu/libnetsnmp.so
-- Looking for libgcrypt...
-- Looking for libgcrypt... /usr/lib/x86_64-linux-gnu/libgcrypt.so
--   found libgcrypt, version 1.7.6-beta
-- Looking for bison...
-- Found BISON: /usr/bin/bison (found suitable version "3.0.4", minimum required is "2.5")
-- Looking for libgcrypt...
-- Looking for libgcrypt... /usr/lib/x86_64-linux-gnu/libgcrypt.so
--   found libgcrypt, version 1.7.6-beta
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.13")
-- Configuring done
-- Generating done
-- Build files have been written to: /root/share/openvas-6.0.0/build

Step 2: make

root@f815ef7590a5:~/share/openvas-6.0.0/build# make
Scanning dependencies of target openvas_misc_shared
[  1%] Building C object misc/CMakeFiles/openvas_misc_shared.dir/bpf_share.c.o
[  2%] Building C object misc/CMakeFiles/openvas_misc_shared.dir/ftp_funcs.c.o
[  3%] Building C object misc/CMakeFiles/openvas_misc_shared.dir/vendorversion.c.o
[  5%] Building C object misc/CMakeFiles/openvas_misc_shared.dir/network.c.o
[  6%] Building C object misc/CMakeFiles/openvas_misc_shared.dir/plugutils.c.o
/root/share/openvas-6.0.0/misc/plugutils.c: In function 'plug_set_xref':
/root/share/openvas-6.0.0/misc/plugutils.c:80:7: error: implicit declaration of function 'nvti_xref' [-Werror=implicit-function-declaration]
   if (nvti_xref (n))
       ^~~~~~~~~
/root/share/openvas-6.0.0/misc/plugutils.c:81:24: error: passing argument 1 of 'g_strconcat' makes pointer from integer without a cast [-Werror=int-conversion]
     new = g_strconcat (nvti_xref (n), ", ", name, ":", value, NULL);
                        ^~~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:79:0,
                 from /root/share/openvas-6.0.0/misc/scanneraux.h:28,
                 from /root/share/openvas-6.0.0/misc/plugutils.h:29,
                 from /root/share/openvas-6.0.0/misc/plugutils.c:26:
/usr/include/glib-2.0/glib/gstrfuncs.h:230:22: note: expected 'const gchar * {aka const char *}' but argument is of type 'int'
 gchar*               g_strconcat      (const gchar *string1,
                      ^~~~~~~~~~~
/root/share/openvas-6.0.0/misc/plugutils.c:85:3: error: implicit declaration of function 'nvti_set_xref' [-Werror=implicit-function-declaration]
   nvti_set_xref (n, new);
   ^~~~~~~~~~~~~
/root/share/openvas-6.0.0/misc/plugutils.c: In function 'add_plugin_preference':
/root/share/openvas-6.0.0/misc/plugutils.c:530:18: error: passing argument 1 of 'nvtpref_new' makes integer from pointer without a cast [-Werror=int-conversion]
     nvtpref_new ((gchar *) name, (gchar *) type, (gchar *) defaul);
                  ^
In file included from /root/share/openvas-6.0.0/misc/scanneraux.h:29:0,
                 from /root/share/openvas-6.0.0/misc/plugutils.h:29,
                 from /root/share/openvas-6.0.0/misc/plugutils.c:26:
/usr/local/include/gvm/base/nvti.h:47:1: note: expected 'int' but argument is of type 'gchar * {aka char *}'
 nvtpref_new (int, gchar *, gchar *, gchar *);
 ^~~~~~~~~~~
/root/share/openvas-6.0.0/misc/plugutils.c:530:5: error: too few arguments to function 'nvtpref_new'
     nvtpref_new ((gchar *) name, (gchar *) type, (gchar *) defaul);
     ^~~~~~~~~~~
In file included from /root/share/openvas-6.0.0/misc/scanneraux.h:29:0,
                 from /root/share/openvas-6.0.0/misc/plugutils.h:29,
                 from /root/share/openvas-6.0.0/misc/plugutils.c:26:
/usr/local/include/gvm/base/nvti.h:47:1: note: declared here
 nvtpref_new (int, gchar *, gchar *, gchar *);
 ^~~~~~~~~~~
cc1: all warnings being treated as errors
misc/CMakeFiles/openvas_misc_shared.dir/build.make:158: recipe for target 'misc/CMakeFiles/openvas_misc_shared.dir/plugutils.c.o' failed
make[2]: *** [misc/CMakeFiles/openvas_misc_shared.dir/plugutils.c.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'misc/CMakeFiles/openvas_misc_shared.dir/all' failed
make[1]: *** [misc/CMakeFiles/openvas_misc_shared.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
image

Libraries

root@f815ef7590a5:~/share/openvas-master-2/build# ldconfig -p | grep gvm
    libgvm_util.so.11 (libc6,x86-64) => /usr/local/lib/libgvm_util.so.11
    libgvm_util.so.10 (libc6,x86-64) => /usr/local/lib/libgvm_util.so.10
    libgvm_util.so (libc6,x86-64) => /usr/local/lib/libgvm_util.so
    libgvm_osp.so.11 (libc6,x86-64) => /usr/local/lib/libgvm_osp.so.11
    libgvm_osp.so.10 (libc6,x86-64) => /usr/local/lib/libgvm_osp.so.10
    libgvm_osp.so (libc6,x86-64) => /usr/local/lib/libgvm_osp.so
    libgvm_gmp.so.11 (libc6,x86-64) => /usr/local/lib/libgvm_gmp.so.11
    libgvm_gmp.so.10 (libc6,x86-64) => /usr/local/lib/libgvm_gmp.so.10
    libgvm_gmp.so (libc6,x86-64) => /usr/local/lib/libgvm_gmp.so
    libgvm_base.so.11 (libc6,x86-64) => /usr/local/lib/libgvm_base.so.11
    libgvm_base.so.10 (libc6,x86-64) => /usr/local/lib/libgvm_base.so.10
    libgvm_base.so (libc6,x86-64) => /usr/local/lib/libgvm_base.so
    libgvm-pg-server.so.0 (libc6,x86-64) => /usr/local/lib/libgvm-pg-server.so.0
    libgvm-pg-server.so (libc6,x86-64) => /usr/local/lib/libgvm-pg-server.so
bjoernricks commented 5 years ago

Could you please try gvm-libs 10 to build openvas-scanner 6? Not sure if gvm-libs 11 is compatible.

Btw. you are hopefully aware that building software as root may be very very dangerous?

afzouni commented 5 years ago

thx, solved with using gvm-libs-10

also about root user: the openvas services is on docker, should I use another user instead of root?

@bjoernricks

bjoernricks commented 5 years ago

I just wanted to note that running software as root especially for building software may be very dangerous. If you are using short running docker instances this may be ok but nevertheless you should be aware of the risks.

afzouni commented 5 years ago

thx dear