googleprojectzero / SkCodecFuzzer

Fuzzing harness for testing proprietary image codecs supported by Skia on Android
Apache License 2.0
328 stars 79 forks source link

make failed #4

Closed cori-j0choi closed 4 years ago

cori-j0choi commented 4 years ago

Android NDK (r21b)

I've get /system/lib64 , /system/bin/linker64 ,/apex/com.android.runtime/lib64 from a Galaxy S20 ROM (G981B).


/home/vagrant/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang++ -o loader loader.o common.o tokenizer.o libdislocator.o -L/home/vagrant/capstone -lcapstone -L/home/vagrant/system/lib64 -lhwui -ldl -lbacktrace -landroidicu -Wl,-rpath -Wl,/home/vagrant/system/lib64 -Wl,--dynamic-linker=/home/vagrant/system/bin/linker64
loader.o: In function `ProcessImage()':
loader.cc:(.text+0x230): undefined reference to `SkCodec::MakeFromStream(std::__1::unique_ptr<SkStream, std::__1::default_delete<SkStream> >, SkCodec::Result*, SkPngChunkReader*, SkCodec::SelectionPolicy)'
loader.o: In function `SkImageInfo::bytesPerPixel() const':
loader.cc:(.text._ZNK11SkImageInfo13bytesPerPixelEv[_ZNK11SkImageInfo13bytesPerPixelEv]+0x14): undefined reference to `SkColorInfo::bytesPerPixel() const'
/home/vagrant/capstone/libcapstone.a(AArch64BaseInfo.o): In function `A64NamedImmMapper_fromString':
AArch64BaseInfo.c:(.text+0xc0): undefined reference to `__ctype_tolower_loc'
/home/vagrant/capstone/libcapstone.a(M680XDisassembler.o): In function `loop_hdlr':
M680XDisassembler.c:(.text+0x490): undefined reference to `__fprintf_chk'
/home/vagrant/capstone/libcapstone.a(M680XDisassembler.o): In function `reg_bits_hdlr':
M680XDisassembler.c:(.text+0x798): undefined reference to `__fprintf_chk'
/home/vagrant/capstone/libcapstone.a(M680XDisassembler.o): In function `imm_rel_hdlr':
M680XDisassembler.c:(.text+0xbf8): undefined reference to `__fprintf_chk'
/home/vagrant/capstone/libcapstone.a(M680XDisassembler.o): In function `immediate_hdlr':
M680XDisassembler.c:(.text+0x22c8): undefined reference to `__fprintf_chk'
/home/vagrant/capstone/libcapstone.a(M680XDisassembler.o): In function `M680X_getInstruction':
M680XDisassembler.c:(.text+0x39c4): undefined reference to `__fprintf_chk'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:23: recipe for target 'loader' failed
make: *** [loader] Error 1```
wlya commented 4 years ago

I faced the same issue.

pshad0w commented 4 years ago

check the skia version you used and re-compile capstone with the command: NDK=~/fuzz/android-ndk/android-ndk-r21 CAPSTONE_BUILD_CORE_ONLY=yes ./make.sh cross-android arm64 this is the way i deal with the same problem :)

cori-j0choi commented 4 years ago

check the skia version you used and re-compile capstone with the command: NDK=~/fuzz/android-ndk/android-ndk-r21 CAPSTONE_BUILD_CORE_ONLY=yes ./make.sh cross-android arm64 this is the way i deal with the same problem :)

thank you!!! I solved the problem

wlya commented 4 years ago

check the skia version you used and re-compile capstone with the command: NDK=~/fuzz/android-ndk/android-ndk-r21 CAPSTONE_BUILD_CORE_ONLY=yes ./make.sh cross-android arm64 this is the way i deal with the same problem :)

I cannot exec this command, error log. I've checked the ndk version, all ndk does not include aarch64-linux-android-gcc. Capstone directory is clean, I just unzip 4.0.1.zip which downloaded from official website. https://github.com/aquynh/capstone/archive/4.0.2.zip

How did you run this command?

ubuntu@~/disk1/capstone-4.0.1$
NDK=~/Android/Sdk/ndk/android-ndk-r21 CAPSTONE_BUILD_CORE_ONLY=yes ./make.sh cross-android arm64
  CC      cs.o
  CC      SStream.o
  CC      utils.o
make: /home/ubuntu/Android/Sdk/ndk/android-ndk-r20b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc: Command not found
make: /home/ubuntu/Android/Sdk/ndk/android-ndk-r20b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc: Command not found
Makefile:477: recipe for target 'cs.o' failed
make: *** [cs.o] Error 127
  CC      MCInstrDesc.o
make: *** Waiting for unfinished jobs....
Makefile:477: recipe for target 'SStream.o' failed
make: *** [SStream.o] Error 127
make: /home/ubuntu/Android/Sdk/ndk/android-ndk-r20b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc: Command not found
Makefile:477: recipe for target 'utils.o' failed
make: *** [utils.o] Error 127
make: /home/ubuntu/Android/Sdk/ndk/android-ndk-r20b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc: Command not found
Makefile:477: recipe for target 'MCInstrDesc.o' failed
make: *** [MCInstrDesc.o] Error 127

However, I can build capstone with this commnad CAPSTONE_BUILD_CORE_ONLY=yes ./make.sh cross-android64, but facing the problem @cori-j0choi mentioned at comment #4.

ubuntu@~/disk1/SkCodecFuzzer/source$
make
/home/ubuntu/Android/Sdk/ndk/android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android29-clang++ -o loader loader.o common.o tokenizer.o libdislocator.o -L/home/ubuntu/disk1/capstone-4.0.1 -lcapstone -L/home/ubuntu/disk1/emuisystem/lib64 -lhwui -ldl -lbacktrace -landroidicu -Wl,-rpath -Wl,/home/ubuntu/disk1/emuisystem/lib64 -Wl,--dynamic-linker=/home/ubuntu/disk1/emuisystem/bin/linker64
/home/ubuntu/disk1/capstone-4.0.1/libcapstone.a(AArch64BaseInfo.o): In function `A64NamedImmMapper_fromString':
AArch64BaseInfo.c:(.text+0xc0): undefined reference to `__ctype_tolower_loc'
/home/ubuntu/disk1/capstone-4.0.1/libcapstone.a(M680XDisassembler.o): In function `loop_hdlr':
M680XDisassembler.c:(.text+0x490): undefined reference to `__fprintf_chk'
/home/ubuntu/disk1/capstone-4.0.1/libcapstone.a(M680XDisassembler.o): In function `reg_bits_hdlr':
M680XDisassembler.c:(.text+0x798): undefined reference to `__fprintf_chk'
/home/ubuntu/disk1/capstone-4.0.1/libcapstone.a(M680XDisassembler.o): In function `imm_rel_hdlr':
M680XDisassembler.c:(.text+0xbf8): undefined reference to `__fprintf_chk'
/home/ubuntu/disk1/capstone-4.0.1/libcapstone.a(M680XDisassembler.o): In function `immediate_hdlr':
M680XDisassembler.c:(.text+0x22c8): undefined reference to `__fprintf_chk'
/home/ubuntu/disk1/capstone-4.0.1/libcapstone.a(M680XDisassembler.o): In function `M680X_getInstruction':
M680XDisassembler.c:(.text+0x39c4): undefined reference to `__fprintf_chk'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:23: recipe for target 'loader' failed
make: *** [loader] Error 1
cori-j0choi commented 4 years ago

Please check the ndk version again. The ndk version set as path is 20b. gcc is included in version r21 so try resetting the ndk pass and building capstone-4.0.2.

NDK=~/Android/Sdk/ndk/android-ndk-r21 CAPSTONE_BUILD_CORE_ONLY=yes ./make.sh cross-android arm64 CC cs.o CC SStream.o CC utils.o make: /home/ubuntu/Android/Sdk/ndk/android-ndk-r20b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc: Command not found make: /home/ubuntu/Android/Sdk/ndk/android-ndk-r20b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-gcc: Command not found

wlya commented 4 years ago

Thank you. I solved the problem.