Recently, I've been familiar with libfuzzer and want to give it a go. Well, as far you know for using Sanitizer it's better to compile the binary in 32bit mode because it on 64bit system requests a lot of memory.
So, when I'm trying to compile my fuzzer in 32bit mode (-m32) with clang-6.0, I get the following error :
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)
I have libstdc++.so 32bit version then I use this command to make the compile easier:
cp /usr/lib32/libstdc++.so{.6,}
But after that the error message is changed to this :
/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
..............
..............
..............
Do you have any idea what the root cause of the problem is and how I can solve it?
Related
I have tried to install GMP Library Version 6.1.0 for iOS9.
I need to compile GMP in iOS for a math project. My configuration command was like this.
./configure CC=clang CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" CPPFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ -fembed-bitcode -miphoneos-version-min=7.0 -arch armv7 -target arm-apple-darwin" --host=aarch64-apple-darwin --disable-assembly --enable-static --disable-shared --disable-thread-safe --enable-cxx
Found this configure option in :This link.
Here is my environment details:
Mac OSX 10.11.2; Xcode7.2; iOS SDK 9.2
During "configure" state it shows one warning
configure: WARNING: unrecognized options: --disable-thread-safe
But it configures without any error.
Configure summary:
configure: summary of build options:
Version: GNU MP 6.1.0
Host type: aarch64-apple-darwin
ABI: standard
Install prefix: /usr/local
Compiler: clang
Static libraries: yes
Shared libraries: no
After that I run make command.
Then make check.
While running make check command it gives the following error.
or, in text form:
/bin/sh ../libtool --tag=CC --mode=link clang -mfpu=neon -O2 -pedantic -DNO_ASM -o t-bswap t-bswap.o libtests.la ../libgmp.la
libtool: link: clang -mfpu=neon -O2 -pedantic -DNO_ASM -o t-bswap t-bswap.o ./.libs/libtests.a [redacted]/Documents/gmp-6.1.0/.libs/libgmp.a ../.libs/libgmp.a
ld: warning: ld: warning: ignoring file ./.libs/libtests.a, file was built for archive which is not the architecture being linked (x86_64): ./.libs/libtests.aignoring file t-bswap.o, file was built for armv7 which is not the architecture being linked (x86_64): t-bswap.o
ld: warning: ignoring file [redacted]/Documents/gmp-6.1.0/.libs/libgmp.a, file was built for archive which is not the architecture being linked (x86_64): /Users/[redacted]/Documents/gmp-6.1.0/.libs/libgmp.a
ld: warning: ignoring file ../.libs/libgmp.a, file was built for archive which is not the architecture being linked (x86_64): ../.libs/libgmp.a
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [t-bswap] Error 1
make[3]: *** [check-am] Error 2
make[2]: *** [check-recursive] Error 1
make[1]: *** [check-recursive] Error 1
make: *** [check] Error 2
I am stuck here. Your help is highly appreciated.
[EDITED]
When compiling my project I get the following error:
/usr/bin/ld: skipping incompatible ../../Build/qtpropertybrowser/Linux/Develop/libqtpropertybrowser.a when searching for -lqtpropertybrowser
/usr/bin/ld: cannot find -lqtpropertybrowser
/usr/bin/ld: skipping incompatible ../../Build/libqxt/Linux/Develop/libqxt.a when searching for -lqxt
/usr/bin/ld: cannot find -lqxt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I assume that if anything, the files it should be searching for should be qtpropertybrowser and qxt. Is this correct? And if so, how do I change this?
New to Linux by the way.
I'm trying to build fftw for iOS.
I found this question:
How to link third party libraries like fftw3 and sndfile to an iPhone project in Xcode?
And tried running the shell script, but I am getting the errors shown below.
make[2]: *** [bench] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
lipo: unknown architecture specification flag: armv7s in specifying input file -arch armv7s ios-library/libfftw3f_armv7s.a
lipo: known architecture flags are: any little big ppc64 x86_64 ppc970-64 ppc i386 m68k hppa sparc m88k i860 veo arm ppc601 ppc603 ppc603e ppc603ev ppc604 ppc604e ppc750 ppc7400 ppc7450 ppc970 i486 i486SX pentium i586 pentpro i686 pentIIm3 pentIIm5 pentium4 m68030 m68040 hppa7100LC veo1 veo2 veo3 veo4 armv4t armv5 xscale armv6 armv7 armv7f armv7k
lipo: Usage: lipo [input_file] ... [-arch <arch_type> input_file] ... [-info] [-detailed_info] [-output output_file] [-create] [-arch_blank <arch_type>] [-thin <arch_type>] [-remove <arch_type>] ... [-extract <arch_type>] ... [-extract_family <arch_type>] ... [-verify_arch <arch_type> ...] [-replace <arch_type> <file_name>] ...
I am a total nooby when it comes to compiling for iOS so any help is much appreciated.
It looks like it can't find the armv7s architecture specified...
If I leave in only the first part, for the armv7 architecture, I get the following errors:
Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -arch armv7 -std=gnu99 -mfpu=neon
checking whether the C compiler works... no
configure: error: in `/Users/davidmenard/Desktop/fftw-3.3.3':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
cp: .libs/libfftw3f.a: No such file or directory
I needed to recompile my framework: double check those armv7s to not miss at that 2 place:
For me the problem was solved, hopefully it will help a few of you!
My XCode compilers were not getting along, because I had both XCode 4 and XCode5-DP5 installed. Using the latest compiler fixed my errors.
In attempting to compile a dummy program for iphoneos, Xcode4, gcc does not appear to reach beyond the initial sysroot directory
$ echo $ISYSROOT
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
$ gcc -arch armv6 --sysroot=$ISYSROOT test.cpp
ld: in /usr/lib/system/libcache.dylib, missing required architecture armv6 in file for architecture armv6
collect2: ld returned 1 exit status
If I leave out sysroot,
$ gcc -arch armv6 test.cpp
ld: warning: ignoring file /usr/lib/crt1.o, missing required architecture armv6 in file
ld: warning: ignoring file /usr/lib/libgcc_s.1.dylib, missing required architecture armv6 in file
ld: warning: ignoring file /usr/lib/libSystem.dylib, missing required architecture armv6 in file
Undefined symbols for architecture armv6:
"start", referenced from:
-u command line option
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
The following works, but it feels very cheesy, and not scalable. What's going on here?
$ gcc -arch armv6 -L$ISYSROOT/usr/lib/system --sysroot=$ISYSROOT test.cpp
Update. Apparently this is a known issue, though it still is not clear how to pass sysroot to gcc but isysroot to ld
http://www.doitscared.com/?m=201104
When compiling the library, if you see this error “ld: file not found:
/usr/lib/system/libcache.dylib for architecture armv7″, then your
linker command is using “–sysroot” which doesn’t work in Xcode 4.
Instead, change the linker command to use “-isysroot”. (Note: This
only applies to the linker command. The compile commands must continue
to use “–sysroot”. See here for more details.)
Change the Deployment Target of your project to be at least 4.3 and it will work. This is a problem with XCode 4 but there really isn't a need to deploy apps to iOS versions prior to 4.3. iOS users tend to stay pretty up-to-date with their iOS versions.
I'm using clang 2.9, compiled from source and when I try to compile a simple code like this:
#include <iostream>
int main (){
std::cout << "Hello\n";
}
I get the error:
/usr/include/c++/4.5/string:39:10: fatal error: 'bits/c++config.h' file not found
When I include /usr/include/c++/4.5/i686-linux-gnu, I get
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: cannot find -lgcc_s
/usr/bin/ld: cannot find -lgcc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas on how to solve this one?