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

Build fails with OSX Mojave #207

Closed
achanda opened this issue Jan 14, 2020 · 2 comments
Closed

Build fails with OSX Mojave #207

achanda opened this issue Jan 14, 2020 · 2 comments

Comments

@achanda
Copy link

achanda commented Jan 14, 2020

I followed the tutorial here https://rust-fuzz.github.io/book/cargo-fuzz/tutorial.html The build failed with this

  = note: "cc" "-m64" "-L" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/fuzz_target_1-6a5ad7bbfee725a4.3464qd1d22kyq2dc.rcgu.o" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/fuzz_target_1-6a5ad7bbfee725a4.55bynx9o1u7259a8.rcgu.o" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/fuzz_target_1-6a5ad7bbfee725a4.77lp28rh20hx0y7.rcgu.o" "-o" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/fuzz_target_1-6a5ad7bbfee725a4" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/fuzz_target_1-6a5ad7bbfee725a4.wrjt79l6472o2qj.rcgu.o" "-nodefaultlibs" "-L" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps" "-L" "/Users/Abhishek/src/ipnetwork/fuzz/target/debug/deps" "-L" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/build/libfuzzer-sys-9363796c86688179/out" "-L" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-Wl,-rpath" "-Xlinker" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-Wl,-force_load" "-Wl,/var/folders/m3/2lg_mptn6w54n1qql_h_g67c0000gs/T/rustcyBbaIe/librustc_asan-bdc601c58a2e51d1.rlib" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/libipnetwork-90abd8012ec5ce37.rlib" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/libserde-26be16d130a2c8cd.rlib" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/liblibfuzzer_sys-580bffd799137f70.rlib" "/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/libarbitrary-a78b4ec247e92fdc.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-79c39208a33c9e70.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-c0dcebecdb8e4e83.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-0d3e011ffc07f6a1.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-b8f6b45456cb0df7.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace-cdb8474f49e76dc7.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace_sys-46aaa6c6a896e403.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-d3b500aecd0ff14a.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-56edb87d9ec96055.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-eaa1ca179ae8ca90.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-3b370636605a0018.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-aac98d4c0b716767.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-0aaaf935f33318ff.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-c131f8e9758169df.rlib" "/Users/Abhishek/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-287a5c6b287e708b.rlib" "-l__rustc__clang_rt.asan_osx_dynamic" "-lc++" "-lSystem" "-lresolv" "-lc" "-lm"
  = note: ld: library not found for -l__rustc__clang_rt.asan_osx_dynamic
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: aborting due to previous error

error: could not compile `ipnetwork-fuzz`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name fuzz_target_1 fuzz_targets/fuzz_target_1.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=6a5ad7bbfee725a4 -C extra-filename=-6a5ad7bbfee725a4 --out-dir /Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps --target x86_64-apple-darwin -C incremental=/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/incremental -L dependency=/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps -L dependency=/Users/Abhishek/src/ipnetwork/fuzz/target/debug/deps --extern ipnetwork=/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/libipnetwork-90abd8012ec5ce37.rlib --extern libfuzzer_sys=/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/deps/liblibfuzzer_sys-580bffd799137f70.rlib --cfg fuzzing -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-trace-geps -Cllvm-args=-sanitizer-coverage-prune-blocks=0 -Cllvm-args=-sanitizer-coverage-pc-table -Clink-dead-code -Zsanitizer=address -L native=/Users/Abhishek/src/ipnetwork/fuzz/target/x86_64-apple-darwin/debug/build/libfuzzer-sys-9363796c86688179/out` (exit code: 1)
Error: failed to build fuzz script: "cargo" "build" "--manifest-path" "/Users/Abhishek/src/ipnetwork/fuzz/Cargo.toml" "--verbose" "--target" "x86_64-apple-darwin" "--bin" "fuzz_target_1"

Metadata:

$ cargo fuzz -V
cargo-fuzz 0.6.0
$ rustc --version
rustc 1.41.0-nightly (412f43ac5 2019-11-24)
$ cargo --version
cargo 1.41.0-nightly (8280633db 2019-11-11)
@hjr3
Copy link

hjr3 commented Jan 17, 2020

This looks to be related to rust-lang/rust#66140

I did the following to get it working:

$ rustup install nightly-2019-10-23
$ cd /path/to/code
$ rustup override set nightly-2019-10-2
$ cargo install --force --version 0.5.5 cargo-fuzz

I had to use an older version of cargo-fuzz because the older nightly failed compiling the arbitrary crate. I think it was using a newer experimental feature. I chose the version that was released right before nightly stopped working.

edit: I noticed that issue was supposedly fixed. This seems to work though 🤷‍♂

edit 2: rust-lang/rust#65241 landed 6 days ago. We were both using nightly versions prior to that change. If you rustup update nightly then everything should work fine. Happy fuzzing!

@achanda
Copy link
Author

achanda commented Jan 18, 2020

That worked, thanks @hjr3

@achanda achanda closed this as completed Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants