LibAFL icon indicating copy to clipboard operation
LibAFL copied to clipboard

`libafl_libfuzzer_runtime` does not compile with Apple's clang on macOS

Open maxammann opened this issue 1 year ago • 8 comments

Describe the bug I'm using the stock Clang on macOS (likely the cause of this issue). Compiling libafl_libfuzzer_runtime on macOS fails in the final rust-lld step with:

    Finished `release` profile [optimized + debuginfo] target(s) in 0.16s
rust-lld: error: target/release/libafl_libfuzzer_runtime.a(afl_libfuzzer_runtime-f4e5a11aa5da33a2.afl_libfuzzer_runtime.e93c846f93848154-cgu.0.rcgu.o): not an ELF file

To Reproduce Steps to reproduce the behavior:

  1. cd LibAFL/libafl_libfuzzer/libafl_libfuzzer_runtime
  2. ./build.sh

Expected behavior The build should succeed with Apple's clang.

Additional context I'm investigating further if it works with e.g. Nix Clang. I think LibAFL is not supporting Apple's Clang so we might just close this and the issue would serve as documentation for further users :)

maxammann avatar May 16 '24 07:05 maxammann

same issue for now with Clang 14 from Nix. I don't use homebrew so ideally someone could try to reproduce in their environment.

maxammann avatar May 16 '24 08:05 maxammann

Same error for me on homebrew clang... @sameer did the MacOS integration IIRC

domenukk avatar May 17 '24 23:05 domenukk

Took a quick look, build.sh is still Linux-only unfortunately. But it should be possible to mirror what I did in #1711 into this script to make it work for macOS.

sameer avatar May 17 '24 23:05 sameer

@jasikpark is fixing this. Please do not release 0.13 until we fix this.

addisoncrump avatar Jun 12 '24 17:06 addisoncrump

There are new problems on macOS as well -- namely, libafl_main and LLVMFuzzerCustom{Mutator,Crossover} do not appear. @maxammann, are you aware of how to fix this issue? It does not seem to resolve it as expected (these symbols do not even appear in the produced .a files...).

addisoncrump avatar Jun 12 '24 19:06 addisoncrump

There are new problems on macOS as well -- namely, libafl_main and LLVMFuzzerCustom{Mutator,Crossover} do not appear. @maxammann, are you aware of how to fix this issue? It does not seem to resolve it as expected (these symbols do not even appear in the produced .a files...).

Not really, sorry!

maxammann avatar Jun 13 '24 11:06 maxammann

If it's helpful, I can try to do what I did in #1711 for this build script. Though I won't be able to get to it until Monday/Tuesday if the release is being blocked by this issue.

sameer avatar Jun 13 '24 21:06 sameer

@domenukk if you would be willing to release a point release a couple weeks after 0.13.0, please feel free to skip this issue for the .0 release. We'll release a .1 with the fix.

addisoncrump avatar Jun 13 '24 21:06 addisoncrump