rust-fuzz / honggfuzz-rs

Fuzz your Rust code with Google-developed Honggfuzz !
https://crates.io/crates/honggfuzz
Apache License 2.0
460 stars 42 forks source link

Compilation fails on macOS 10.13.3 #1

Closed frewsxcv closed 6 years ago

frewsxcv commented 6 years ago

Just tried this out on macOS 10.13.3, but running into this compiler error when I build the crate:

corey@mac /p/t/hong> cargo hfuzz run hong
   Compiling honggfuzz v0.5.3
error: failed to run custom build command for `honggfuzz v0.5.3`
process didn't exit successfully: `/private/tmp/hong/hfuzz_target/release/build/honggfuzz-aa6fe05b2573cde2/build-script-build` (exit code: 101)
--- stdout
rm -f -r core Makefile.bak cmdline.o display.o fuzz.o honggfuzz.o input.o mangle.o report.o sancov.o sanitizers.o socketfuzzer.o subproc.o mac/arch.o mac/mach_excServer.o mac/mach_excUser.o honggfuzz hfuzz_cc/hfuzz-cc libhfuzz/libhfuzz.a libhfuzz/instrument.o libhfuzz/linux.o libhfuzz/main.o libhfuzz/memorycmp.o libhfuzz/persistent.o libhfcommon/libhfcommon.a libhfcommon/files.o libhfcommon/log.o libhfcommon/ns.o libhfcommon/util.o libhfnetdriver/libhfnetdriver.a libhfnetdriver/netdriver.o mac/mach_exc.h mac/mach_excServer.c mac/mach_excServer.h mac/mach_excUser.c obj libs ./*.o ./*~ ./core ./*.a ./*.dSYM ./*.la ./*.so ./*.dylib linux/*.o linux/*~ linux/core linux/*.a linux/*.dSYM linux/*.la linux/*.so linux/*.dylib mac/*.o mac/*~ mac/core mac/*.a mac/*.dSYM mac/*.la mac/*.so mac/*.dylib posix/*.o posix/*~ posix/core posix/*.a posix/*.dSYM posix/*.la posix/*.so posix/*.dylib libhfuzz/*.o libhfuzz/*~ libhfuzz/core libhfuzz/*.a libhfuzz/*.dSYM libhfuzz/*.la libhfuzz/*.so libhfuzz/*.dylib libhfcommon/*.o libhfcommon/*~ libhfcommon/core libhfcommon/*.a libhfcommon/*.dSYM libhfcommon/*.la libhfcommon/*.so libhfcommon/*.dylib libhfnetdriver/*.o libhfnetdriver/*~ libhfnetdriver/core libhfnetdriver/*.a libhfnetdriver/*.dSYM libhfnetdriver/*.la libhfnetdriver/*.so libhfnetdriver/*.dylib
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o cmdline.o cmdline.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o display.o display.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o fuzz.o fuzz.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o honggfuzz.o honggfuzz.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o input.o input.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o mangle.o mangle.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o report.o report.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o sancov.o sancov.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o sanitizers.o sanitizers.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o socketfuzzer.o socketfuzzer.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o subproc.o subproc.c
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -c -O3 -D_GNU_SOURCE -Wall -Werror -Wno-format-truncation -I. -arch x86_64 -std=c99 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -x objective-c -pedantic -fblocks -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wreturn-type -Wpointer-arith -Wno-gnu-case-range -Wno-gnu-designator -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-attributes -Wno-initializer-overrides -Wno-unknown-warning-option -Wno-gnu-empty-initializer -Wno-format-pedantic -Wno-gnu-statement-expression -D_HF_ARCH_DARWIN -fblocks -o mac/arch.o mac/arch.c

--- stderr
mac/arch.c:61:10: fatal error: 'mach_exc.h' file not found
#include "mach_exc.h"
         ^~~~~~~~~~~~
1 error generated.
make: *** [mac/arch.o] Error 1
thread 'main' panicked at 'assertion failed: status.success()', /Users/corey/.cargo/registry/src/github.com-1ecc6299db9ec823/honggfuzz-0.5.3/build.rs:34:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Not sure if this is a problem upstream, or if there's something that needs to be changed in the build logic in this crate, or if there's something wrong with my setup. Hmm

PaulGrandperrin commented 6 years ago

Thanks for the report! I've already been struggling with this issue for some time but it's very difficult for me to debug it because I don't own a Mac... I tried some things with Travis but it's really not a debugging tool ;-) (https://travis-ci.org/PaulGrandperrin/honggfuzz-rs) However I still very much want things to work on macOS so I just installed a High Sierra VM, and I'll try to figure things out even though I don't know anything about macOS. There are, however, many issues about building honggfuzz on mac so I've not very hopeful... https://github.com/google/honggfuzz/issues/189 https://github.com/google/honggfuzz/issues/176 https://github.com/google/honggfuzz/issues/182 https://github.com/google/honggfuzz/issues/169

We'll see

PaulGrandperrin commented 6 years ago

Reopening still doesn't work... I think upstream will need some fixes before we can do anything here. I'll try to look a little bit more into that.

PaulGrandperrin commented 6 years ago

WIP: https://github.com/google/honggfuzz/issues/191

PaulGrandperrin commented 6 years ago

I submitted a PR upstream which fixes the problem: https://github.com/google/honggfuzz/pull/192

robertswiecki commented 6 years ago

Thanks Paul!

I've added https://github.com/google/honggfuzz/commit/df02b9d41e6518b3f0a61c07849babe33ec89ba3 which should make it possible to use hfuzz-cc under macos (it has a bit odd linking stage, but well..:)

On a mac mini from it achieves >150k iterations per second, which seems quite good.

frewsxcv commented 6 years ago

just confirmed it works on mac now, thanks everyone!!