Subject: [bug#62666] [PATCH 0/2] Add aflplusplus

From: Denis 'GNUtoo' Carikli <[email-masked]>
Date: Fri, 15 Sep 2023 05:25:40 +0200

On Wed, 23 Aug 2023 10:34:48 +0800
Hilton Chain <[email-masked]> wrote:
> > Here's two patches to add aflplusplus. I've also patches (not part
> > of this serie) to add support for faster compilers with GCC
> > plugins, but when I do that it somehow fails to run:
> I think (for the plugin) this is related:
> --8<---------------cut here---------------start------------->8---
> [+] All set and ready to build.
> g++ -O3 -g -funroll-loops -D_FORTIFY_SOURCE=1 -Wall -std=c++11 -fPIC
> -fno-rtti
> -I"/gnu/store/930nwsiysdvy2x5zv1sf6v7ym75z8ayk-gcc-11.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/plugin"/include
> -I"/gnu/store/930nwsiysdvy2x5zv1sf6v7ym75z8ayk-gcc-11.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/plugin"
> -shared instrumentation/afl-gcc-pass.so.cc -o afl-gcc-pass.so In file
> included from
> /gnu/store/930nwsiysdvy2x5zv1sf6v7ym75z8ayk-gcc-11.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/plugin/include/gcc-plugin.h:28,
> from instrumentation/afl-gcc-common.h:46, from
> instrumentation/afl-gcc-pass.so.cc:127:
> /gnu/store/930nwsiysdvy2x5zv1sf6v7ym75z8ayk-gcc-11.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.3.0/plugin/include/system.h:698:10:
> fatal error: gmp.h: No such file or directory 698 | #include <gmp.h>
> |          ^~~~~~~ compilation terminated. make[1]: ***
> [GNUmakefile.gcc_plugin:149: afl-gcc-pass.so] Error 1 make[1]:
> Leaving directory '/tmp/guix-build-aflplusplus-4.05c.drv-0/source'
> make: [GNUmakefile:790: install] Error 2 (ignored)
> --8<---------------cut here---------------end--------------->8---
> 
> Can you address the issue and send an updated patch?
The issue turned out to be that it called "gcc" instead of the gcc
available during the build.

Qemu is one of the aflplusplus dependencies and it doesn't cross
compile:
> $ guix build --target=aarch64-linux-gnu qemu 
> guix build: error: gnu/packages/gnome.scm:3501:2: [email-masked]:
> build system `cargo' does not support cross builds

So for simplicity I've simply made aflplusplus use the gcc that is in
the inputs.

I've verified that it took the right gcc by adding '(invoke "gcc"
"--version")' to the package and verifying that it was really gcc-11.

I've also updated aflplusplus to the latest version along the way.

Denis.