Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake fails for Gvm-libs #284

Closed
SergioBinfo opened this issue Oct 20, 2019 · 5 comments · Fixed by #668
Closed

Cmake fails for Gvm-libs #284

SergioBinfo opened this issue Oct 20, 2019 · 5 comments · Fixed by #668

Comments

@SergioBinfo
Copy link

Hi, I'm trying to create a Dockerfile which will install GVM10 from its source code. I'm using alpine 3.10 as base image. I'm following the install.md for each component.

Expected behavior

cmake with success in the folder where I unzipped the source code of gvm-libs and go to the next stop which will be make and make install.

Current behavior

Warnings stops with error and abort the process.

Steps to reproduce

  1. Dockerfile with base image alpine:3.10
  2. install dependencies
  3. wget the source code in this case for the gvm-libs.
  4. unzip
  5. create a new folder and cd in it.
  6. cmake ..

GVM versions

gsa: (gsad --version)
8.0.1
gvm: (gvmd --version)
8.0.1
openvas-scanner: (openvassd --version)
6.0.1
gvm-libs:
10.0.1
openvas-smb:
1.0.5

Environent

Operating system:
Linux Alpine
Installation method / source: (packages, source installation)
From source code https://community.greenbone.net/t/gvm-10-old-stable-initial-release-2019-04-05/208

Logfiles

[100%] Building documentation...
[100%] Built target doc-full
[  2%] Building C object base/CMakeFiles/gvm_base_shared.dir/hosts.c.o
/root/gvm-libs-10.0.1/base/hosts.c: In function 'gvm_hosts_deduplicate':
/root/gvm-libs-10.0.1/base/hosts.c:1016:3: error: implicit declaration of function 'malloc_trim'; did you mean 'malloc'? [-Werror=implicit-function-declaration]
   malloc_trim (0);
   ^~~~~~~~~~~
   malloc
cc1: all warnings being treated as errors
make[2]: *** [base/CMakeFiles/gvm_base_shared.dir/build.make:115: base/CMakeFiles/gvm_base_shared.dir/hosts.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:123: base/CMakeFiles/gvm_base_shared.dir/all] Error 2
@cfi-gb
Copy link
Member

cfi-gb commented Dec 24, 2019

The reference system used by most of the developers is Debian GNU/Linux 'Buster' 10. The build might fail on any other system.
-> https://github.com/greenbone/gvm-libs/blob/master/INSTALL.md

I guess the problem is that Alpine is using musl libc which is (as seen on various occasions) different to glibc. @SergioBinfo you probably need to find / research if there is any alternative for musl libc to the not available malloc_trim.

As @greenbone/gvm-dev probably isn't adding compatibility for Alpine Linux this needs an update / PR from the community / some one familiar with Alpine Linux to make gvm-libs to build on Alpine Linux.

@mattmundell
Copy link
Contributor

Calling malloc_trim is not required, so you could just patch out the calls.

@fcolista
Copy link

You can check the APKBUILD for Alpine. I'm the maintainer, you can use it as base.
This is the link for openvas, you can search for gvmd, gvm-libs, greenbone-security-assistant etc.

https://git.alpinelinux.org/aports/tree/community/openvas?h=master

Hope it helps.

@ArnoStiefvater
Copy link
Member

We will replace the malloc_trim calls.

@fcolista
Copy link

For now, Alpine has a patch downstream that disables malloc_trim() since it's GLIBC specific, while Alpine uses musl.

$ cat malloc-trim.patch 
diff --git a/base/hosts.c b/base/hosts.c
index 74f5d92..1073e2c 100644
--- a/base/hosts.c
+++ b/base/hosts.c
@@ -1013,7 +1013,9 @@ gvm_hosts_deduplicate (gvm_hosts_t *hosts)
   hosts->count -= duplicates;
   hosts->removed += duplicates;
   hosts->current = 0;
+#ifdef __GLIBC__
   malloc_trim (0);
+#endif
 }
 
 /**
@@ -1208,7 +1210,9 @@ gvm_hosts_new_with_max (const gchar *hosts_str, unsigned int max_hosts)
     gvm_hosts_deduplicate (hosts);
 
   g_strfreev (split);
+#ifdef __GLIBC__
   malloc_trim (0);
+#endif
   return hosts;
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants