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

openvas-scanner errors out at compilation in Arch GNU/Linux #1710

Open
r3k2 opened this issue Sep 3, 2024 · 11 comments
Open

openvas-scanner errors out at compilation in Arch GNU/Linux #1710

r3k2 opened this issue Sep 3, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@r3k2
Copy link

r3k2 commented Sep 3, 2024

OS: Arch GNU/Linux
Medium: AUR package
Doc: Follow the Arch wiki
I have read and did not find anything related before posting this.
also posted here: https://aur.archlinux.org/packages/openvas-scanner

openvas-scanner will not compile :(

-- Found Doxygen: /usr/bin/doxygen (found version "1.12.0") found components: doxygen missing components: dot
-- Configuring done (0.8s)
-- Generating done (0.0s)
-- Build files have been written to: /home/rek2/.cache/paru/clone/openvas-scanner/src/build
make: Entering directory '/home/rek2/.cache/paru/clone/openvas-scanner/src/build'
[  1%] Building C object misc/CMakeFiles/openvas_misc_shared.dir/bpf_share.c.o
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<command-line>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[2]: *** [misc/CMakeFiles/openvas_misc_shared.dir/build.make:76: misc/CMakeFiles/openvas_misc_shared.dir/bpf_share.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:229: misc/CMakeFiles/openvas_misc_shared.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
make: Leaving directory '/home/rek2/.cache/paru/clone/openvas-scanner/src/build'
==> ERROR: A failure occurred in build().
    Aborting...
error: failed to build 'openvas-scanner-23.8.5-2': 
error: packages failed to build: openvas-scanner-23.8.5-2

I did this manually as well with out using the AUR package and same issue.
make -C build

Sorry if this is not the right place, looks like a bug on dependencies or versions

@r3k2 r3k2 added the bug Something isn't working label Sep 3, 2024
@jjnicola
Copy link
Member

jjnicola commented Sep 5, 2024

Hi @r3k2
It seems it is fixed and working now. https://aur.archlinux.org/packages/openvas-scanner#comment-989338
Please, close the issue if it is working for you as well.
Best regards

@r3k2
Copy link
Author

r3k2 commented Sep 6, 2024

@jjnicola Hello, thank you. Yes I saw today, I got out of work a bit earlier and have re-tried with no luck.. :(
same error, I deleted the old cache package to force "paru" to repull the source code. 🤷‍♂️ 😿

@Kraemii
Copy link
Member

Kraemii commented Sep 9, 2024

I did a bit of research and found out, that we set the FORTIFY_SOURCE to 2 (https://github.com/greenbone/openvas-scanner/blob/main/CMakeLists.txt#L204), which can cause errors, when a user sets this flag to an higher level than 2. As I find out, some compilers set this flag internally, which can cause such errors. Maybe it would help to check, if a higher level is set by the user, like nextcloud did: https://github.com/nextcloud/desktop/pull/4703/files. But as I am not an expert in such cases I am not sure about any side effects this could have.

@r3k2
Copy link
Author

r3k2 commented Sep 9, 2024

@Kraemii you nail it!, indeed by default my /etc/makepkg.conf has -D_FORTIFY_SOURCE=3
I am sure I did not modify this file
this is the rest of the file in case it helps attached.(hmm says that file type is not supported..to attach sorry)

@r3k2
Copy link
Author

r3k2 commented Sep 9, 2024

Now I am getting a diff error (I changed -D_FORTIFY_SOURCE=2 )
sc-20240909-162848

@Kraemii
Copy link
Member

Kraemii commented Sep 16, 2024

Hi @r3k2,
sorry for the late answer. Did you install openvas-smb before? This should solve the issue here.

@r3k2
Copy link
Author

r3k2 commented Sep 16, 2024

Hello @Kraemii no I did not I am following this in the Arch wiki and it mentions no openvas-smb :(
https://wiki.archlinux.org/title/OpenVAS
I guess I need to tell the current maintainer of the packages to also package openvas-smb 🤷‍♂️
I will point him to this issue.
Thank you! @Kraemii

@Kraemii
Copy link
Member

Kraemii commented Sep 17, 2024

Ah ok, openvas-smb is not absolutely needed for openvas. It is a module for scanning windows systems. If it is not installed it's functionality is replaced by dummy functions, which seem to cause problems for your compiler. Sorry for the confusion here. They are just warnings, but it seems your compiler is treating warnings as errors. You should also be able to disable this setting, by either changing the cmake command when building from source (https://stackoverflow.com/questions/73215417/cmake-treat-warnings-as-errors) or when calling gcc (https://stackoverflow.com/questions/11561261/how-can-i-compile-without-warnings-being-treated-as-errors)

@r3k2
Copy link
Author

r3k2 commented Sep 17, 2024

Hello @Kraemii thanks for the clarification, but now I wonder after I have traid to compile openvas-smb and failed because it required older libs, will the kerberos/smb-samba tests will not be fully run as they are supposed to? 🤔

@r3k2
Copy link
Author

r3k2 commented Sep 17, 2024

@Kraemii this is the flags that get passed by default on the whole system I only see one -Werror= <-- si is not on all cases

#-- Compiler and Linker Flags
#CPPFLAGS=""
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
        -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
        -fstack-clash-protection -fcf-protection \
        -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
         -Wl,-z,pack-relative-relocs"
LTOFLAGS="-flto=auto"
RUSTFLAGS="-Cforce-frame-pointers=yes"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
DEBUG_RUSTFLAGS="-C debuginfo=2"

#

NOTE: I changed fortify to 2 for the reason of the original post in this ticket but it was 4-5 I believe

@Narrat
Copy link

Narrat commented Sep 18, 2024

@Kraemii you nail it!, indeed by default my /etc/makepkg.conf has -D_FORTIFY_SOURCE=3 I am sure I did not modify this file this is the rest of the file in case it helps attached.(hmm says that file type is not supported..to attach sorry)

Only after the pacman 7.0 update I noticed I had a .pacnew around from before, where Arch switched per default to FORTIFY_SOURCE 3 . Therefore no wonder I couldn't reproduce the issue of the author :D I will look into working it around for the PKGBUILD, but on the long run it would be nice if such a thing wasn't needed :)

Edit: Done with stripping -Werror. Warnings on a rolling release distribution are likely and shouldn't necessarily cause the build to fail.
Builds for me on FORTIFY_SOURCE=3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants