AFLplusplus / AFLplusplus

The fuzzer afl++ is afl with community patches, qemu 5.1 upgrade, collision-free coverage, enhanced laf-intel & redqueen, AFLfast++ power schedules, MOpt mutators, unicorn_mode, and a lot more!

Home Page:https://aflplus.plus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LLVM LTO mode could not be built with LLVM 18.1.2 on Ubuntu

l2dy opened this issue · comments

IMPORTANT

  1. You have verified that the issue to be present in the current dev branch.
  2. Please supply the command line options and relevant environment variables,
    e.g., a copy-paste of the contents of out/default/fuzzer_setup.

Thank you for making AFL++ better!

Describe the bug
Unable to build LLVM LTO mode.

To Reproduce
Steps to reproduce the behavior:

  1. Install Ubuntu 22.04
  2. Install LLVM 18.1.2 from official APT repo (sudo apt install clang-18 lld-18, which installs llvm-18-dev and others as dependencies)
  3. clone dev branch of AFLplusplus (commit 59465bd)
  4. LLVM_CONFIG=llvm-config-18 make all

Expected behavior
Build Summary reports success [+].

Screen output/Screenshots

Build Summary:
[+] afl-fuzz and supporting tools successfully built
[+] LLVM basic mode successfully built
[+] LLVM mode successfully built
[-] LLVM LTO mode could not be built, it is optional, if you want it, please install LLVM and LLD 11+. More information at instrumentation/README.lto.md on how to build it
[-] gcc_mode could not be built, it is optional, install gcc-VERSION-plugin-dev to enable this

Additional context
Build was conducted in an LXC container.

can you please share the full compile log? I need to see the error messages

@vanhauser-thc Here is the log file: log.txt

Looks like you didn’t install lld-18

Looks like you didn’t install lld-18

I included dpkg -l output at the beginning of the log file to show that I have the relevant packages installed, at least as described by the documentation. How else should I prove that?

The log shows that a clang-18 -flto -o foo foo.c fails. Has nothing to do with afl++, it’s your llvm setup that is not complete/functioning

Thanks for the pointer! llvm-17-linker-tools provides LLVMgold.so, but llvm-18-linker-tools does not. Looks like a packaging issue to me.

$ curl -s 'https://apt.llvm.org/jammy/pool/main/l/llvm-toolchain-18/llvm-18-linker-tools_18.1.2~%2B%2B20240319123516%2B7fd9979eb9cf-1~exp1~20240319003547.83_amd64.deb' | bsdtar -xOvf - data.tar.zst 2>/dev/null | bsdtar -tvf -
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/bfd-plugins/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/llvm-18/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/llvm-18/lib/
-rw-r--r--  0 root   root  3944048 Mar 19 08:35 ./usr/lib/llvm-18/lib/LLVMPolly.so
-rw-r--r--  0 root   root    74128 Mar 19 08:35 ./usr/lib/llvm-18/lib/libLTO.so.18.1
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/doc/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/doc/llvm-18-linker-tools/
-rw-r--r--  0 root   root    64358 Mar 19 08:35 ./usr/share/doc/llvm-18-linker-tools/changelog.Debian.gz
-rw-r--r--  0 root   root     6897 Mar 19 08:34 ./usr/share/doc/llvm-18-linker-tools/copyright
lrwxrwxrwx  0 root   root        0 Mar 19 08:35 ./usr/lib/bfd-plugins/LLVMgold-18.so -> ../llvm-18/lib/LLVMgold.so
$ curl -s 'https://apt.llvm.org/jammy/pool/main/l/llvm-toolchain-17/llvm-17-linker-tools_17.0.6~%2B%2B20231209124227%2B6009708b4367-1~exp1~20231209124336.77_amd64.deb' | bsdtar -xOvf - data.tar.zst 2>/dev/null | bsdtar -tvf -
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/bfd-plugins/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/llvm-17/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/llvm-17/lib/
-rw-r--r--  0 root   root  3980856 Dec  9 20:43 ./usr/lib/llvm-17/lib/LLVMPolly.so
-rw-r--r--  0 root   root    85648 Dec  9 20:43 ./usr/lib/llvm-17/lib/LLVMgold.so
-rw-r--r--  0 root   root    61296 Dec  9 20:43 ./usr/lib/llvm-17/lib/libLTO.so.17
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/doc/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/doc/llvm-17-linker-tools/
-rw-r--r--  0 root   root    62292 Dec  9 20:43 ./usr/share/doc/llvm-17-linker-tools/changelog.Debian.gz
-rw-r--r--  0 root   root     6897 Dec  9 20:41 ./usr/share/doc/llvm-17-linker-tools/copyright
lrwxrwxrwx  0 root   root        0 Dec  9 20:43 ./usr/lib/bfd-plugins/LLVMgold-17.so -> ../llvm-17/lib/LLVMgold.so

Closing this issue then. Thanks for your help!