V8 build for android on mac

2019-07-26 02:17发布

问题:

I try to build v8 for android on mac. My steps are below :

  1. Install depot_tools
  2. fetch v8
  3. cd v8
  4. git checkout branch-name (last stable version for android)
  5. echo "target_os = ['android']" >> ../.gclient && gclient sync --nohooks
  6. make android_arm.release android_ndk_root=[full path to ndk]

It says that

no archive symbol table (run ranlib)

I search this issue. There is a bug for this state. But it is not solved yet.

I try to create d8 and push the android device. How can I do it?

EDIT

v8 guide provides building with GN. I pass the ndk-root path using gn gen out.gn/arm.release/ --args='is_debug=false android_ndk_root="/path/android-ndk" target_os="android" arm_arch="armv7-a" android_sdk_root="/path/android-sdk-r25" v8_static_library=true android_ndk_version="r11b"'

Then I run ninja -C out.gn/arm.release/, the error is below :

ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a', needed by 'obj/libv8_base.a', missing and no known rule to make it

That is right. Because my libgcc under 4.9 folder not 4.9.x. How can I set libgcc path?

回答1:

The up-to-date build instructions are at https://github.com/v8/v8/wiki/Cross-compiling-for-ARM. Anything that says "make android_arm" is outdated.

However, I don't know if building for Android on Mac is supported. It definitely works on Linux (so you could try in a VM). If something doesn't work, and you want to make it work, we'd happily accept patches; see https://github.com/v8/v8/wiki/Contributing.



回答2:

you do not need to set ANDROID_NDK.

step 5:"target_os = ['android']" >> ../.gclient && gclient sync" will download ndk to "third_party/android_tools/ndk"

ndk_version must >= 12.b