ys-zhang / filter-fuzz

0 stars 0 forks source link

make does not work #1

Open thuanpv opened 2 years ago

thuanpv commented 2 years ago

Hi YS,

When I run make forkserver-simple, I get the following error message:

[-] Oops, can't find gcc header files. Be sure to install 'gcc-X-plugin-dev'.
GNUmakefile.gcc_plugin:120: recipe for target 'test_deps' failed
make[2]: *** [test_deps] Error 1
make[2]: Leaving directory '/home/ubuntu/ML/filter-fuzz/AFLplusplus'
GNUmakefile:325: recipe for target 'gcc_plugin' failed
make[1]: [gcc_plugin] Error 2 (ignored)
[*] Testing the CC wrapper afl-cc and its instrumentation output...
afl-cc++4.01a by Michal Zalewski, Laszlo Szekeres, Marc Heuse - mode: GCC-GCC
[!] WARNING: You are using outdated instrumentation, install LLVM and/or gcc-plugin and use afl-clang-fast/afl-clang-lto/afl-gcc-fast instead!
afl-as++4.01a by Michal Zalewski
[+] Instrumented 19 locations (64-bit, non-hardened mode, ratio 100%).
ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr < /dev/null
echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr

[+] All right, the instrumentation of afl-cc seems to be working!
[+] Main compiler 'afl-cc' successfully built!
[-] LLVM mode for 'afl-cc'  failed to build, likely you either don't have llvm installed, or you need to set LLVM_CONFIG, to point to e.g. llvm-config-11. See instrumentation/README.l
lvm.md how to do this. Highly recommended!
[-] LLVM LTO mode for 'afl-cc'  failed to build, this would need LLVM 11+, see instrumentation/README.lto.md how to build it
[-] gcc_plugin for 'afl-cc'  failed to build, unless you really need it that is fine - or read instrumentation/README.gcc_plugin.md how to build it
[+] All done! Be sure to review the README.md - it's pretty short and useful.
NOTE: If you can read this, your terminal probably uses white background.
This will make the UI hard to read. See docs/status_screen.md for advice.
make -C utils/aflpp_driver
make[2]: Entering directory '/home/ubuntu/ML/filter-fuzz/AFLplusplus/utils/aflpp_driver'
clang -I. -I../../include -O3 -funroll-loops -g -fPIC -c aflpp_driver.c
'libAFLDriver.a' -> '../../libAFLDriver.a'
clang -O3 -funroll-loops -g -fPIC -O0 -funroll-loops -c aflpp_qemu_driver.c
'libAFLQemuDriver.a' -> '../../libAFLQemuDriver.a'
Note: Optional aflpp_qemu_driver_hook.o not built.
Note: Optional aflpp_qemu_driver_hook.so not built.
make[2]: Leaving directory '/home/ubuntu/ML/filter-fuzz/AFLplusplus/utils/aflpp_driver'
make[1]: Leaving directory '/home/ubuntu/ML/filter-fuzz/AFLplusplus'
AFLplusplus/afl-cc examples/forkserver_simple/src/program.c -o target/debug/program
afl-cc++4.01a by Michal Zalewski, Laszlo Szekeres, Marc Heuse - mode: GCC-GCC
[!] WARNING: You are using outdated instrumentation, install LLVM and/or gcc-plugin and use afl-clang-fast/afl-clang-lto/afl-gcc-fast instead!
afl-as++4.01a by Michal Zalewski
[+] Instrumented 8 locations (64-bit, non-hardened mode, ratio 100%).
/usr/bin/ld: cannot open output file target/debug/program: No such file or directory
collect2: error: ld returned 1 exit status
Makefile:19: recipe for target 'afl' failed
make: *** [afl] Error 1

Do you know the reason? Thanks.

Thuan

thuanpv commented 2 years ago

I tested the command on Ubuntu 18.04 64-bit.

ys-zhang commented 2 years ago

The reason is the LLVM_CONFIG variable is not correct set in the makefile. In the makefile of the project

BUILD_PROFILE = debug
OUT_DIR = target/$(BUILD_PROFILE)

CC = clang
LLVM_CONFIG = llvm-config-12     <----- here

this variable needs to be set to correct verson.

I have llvm12 installed in my computer at /usr/bin/llvm-config-12 thus it can find it there. Just replace the LLVM_CONFIG variable in the makefile.

in detail, the makefile download AFL++ and compile it using clang and llvm. AFL++ is needed to instrument program.cc as the example target.