Skip to content

Conversation

@occia
Copy link
Contributor

@occia occia commented Jul 26, 2019

  1. According to the issue Broken Android cross compilation using NDK r20 #1518, I made a fix for the broken Android compilation script;
  2. The fix is based on building standalone Android NDK env first, as I think this is the most general way for old & new version NDK, see this link for more details;
  3. I replace the gcc to clang as Android has no support for gcc now;
  4. You can try NDK=/path/to/the/unzipped/ndk/dir ./make.sh cross-android arm64 [clean] to test it. The build process is well but there is a problem for make test, the failure is because of the lack of bingcc:
make -C tests
make[1]: Entering directory '/root/workspace/capstone_make/capstone/tests'
/bin/sh: 1: /root/workspace/capstone_make/capstone/android-ndk-arm64-android-21/aarch64-linux-android/bingcc: not found
  CC      test_basic.o
  CC      test_detail.o
  CC      test_skipdata.o
make[1]: /root/workspace/capstone_make/capstone/android-ndk-arm64-android-21/aarch64-linux-android/bingcc: Command not found
make[1]: /root/workspace/capstone_make/capstone/android-ndk-arm64-android-21/aarch64-linux-android/bingcc: Command not found
Makefile:154: recipe for target 'test_basic.o' failed
make[1]: *** [test_basic.o] Error 127
make[1]: *** Waiting for unfinished jobs....
Makefile:154: recipe for target 'test_detail.o' failed
make[1]: *** [test_detail.o] Error 127
  CC      test_iter.o
make[1]: /root/workspace/capstone_make/capstone/android-ndk-arm64-android-21/aarch64-linux-android/bingcc: Command not found
make[1]: /root/workspace/capstone_make/capstone/android-ndk-arm64-android-21/aarch64-linux-android/bingcc: Command not found
Makefile:154: recipe for target 'test_skipdata.o' failed
make[1]: *** [test_skipdata.o] Error 127
Makefile:154: recipe for target 'test_iter.o' failed
make[1]: *** [test_iter.o] Error 127
make[1]: Leaving directory '/root/workspace/capstone_make/capstone/tests'
Makefile:366: recipe for target 'all' failed
make: *** [all] Error 2
r

make.sh Outdated
}

CROSS="$TOOLCHAIN/bin/$CROSS" CFLAGS="--sysroot=$PLATFORM" LDFLAGS="--sysroot=$PLATFORM" ${MAKE} $*
#CC="${STANDALONE}/bin/clang" CFLAGS="--sysroot=${STANDALONE}/sysroot" ${MAKE} $*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove this commented out line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@aquynh aquynh merged commit f6f87eb into capstone-engine:master Jul 26, 2019
@aquynh
Copy link
Collaborator

aquynh commented Jul 26, 2019

merged, thanks!

ifeq ($(CROSS),)
RANLIB ?= ranlib
else ifeq ($(ANDROID), 1)
CC = $(CROSS)/../../bin/clang
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a standard place for clang??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so. $(CROSS)/../../bin/clang means ${STANDALONE}/bin/clang, in that dir, you can find all versions of clang, as the following:

root@xxx:~/workspace/capstone# ls android-ndk-arm64-android-21/bin/*clang*
android-ndk-arm64-android-21/bin/aarch64-linux-android-clang
android-ndk-arm64-android-21/bin/aarch64-linux-android-clang++
android-ndk-arm64-android-21/bin/aarch64-linux-android21-clang
android-ndk-arm64-android-21/bin/aarch64-linux-android21-clang++
...
...

aquynh pushed a commit that referenced this pull request Jul 26, 2019
* fix for make.sh for android

* remove commented line
aquynh pushed a commit that referenced this pull request Jul 29, 2019
* fix for make.sh for android

* remove commented line
@occia occia mentioned this pull request Jul 29, 2019
@riptl riptl mentioned this pull request Jul 22, 2022
6 tasks
@TomieAi
Copy link

TomieAi commented Apr 16, 2023

/root/capstone/android-ndk-arm64-android-21/aarch64-linux-android/bingcc: not found

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

Successfully merging this pull request may close these issues.

3 participants