最近,我已经熟悉libfuzzer并想尝试一下。好了,就您所知,使用Sanitizer最好以32位模式编译二进制文件,因为它在64位系统上需要大量内存。 因此,当我尝试使用clang-6.0在32位模式(-m32)中编译我的模糊器时,出现以下错误:
CC="clang-6.0 -O2 -fno-omit-frame-pointer -g -fsanitize=address,fuzzer -fsanitize-coverage=trace-pc-guard,trace-cmp,trace-gep,trace-div -m32 "
...............................
/usr/bin/ld: skipping incompatible /usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.1/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我有libstdc++.so
32位版本,然后使用此命令使编译更容易:
cp /usr/lib32/libstdc++.so{.6,}
但是在此之后,错误消息更改为:
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerClangCounters.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerCrossOver.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerDriver.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerExtFunctionsDlsym.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerExtFunctionsDlsymWin.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerExtFunctionsWeak.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerExtFunctionsWeakAlias.o)' is incompatible with i386 output
/usr/bin/ld: i386:x86-64 architecture of input file `/usr/lib/llvm-6.0/lib/clang/6.0.1/lib/linux/libclang_rt.fuzzer-i386.a(FuzzerExtraCounters.o)' is incompatible with i386 output
..............
..............
..............
您是否知道问题的根本原因是什么以及如何解决?