问题
I try to build v8 for android on mac. My steps are below :
- Install depot_tools
- fetch v8
- cd v8
- git checkout branch-name (last stable version for android)
echo "target_os = ['android']" >> ../.gclient && gclient sync --nohooks
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
回答3:
We integrated V8 to Skype for Android and open-sourced the docker build script: https://github.com/Microsoft/v8-docker-buildscript
Feel free to re-use it. It is not completely fair solution, but it is reproducible build on any OS.
V8 team supports Linux build infrastructure also it is well documented.
We succeed building it on Mac but found it too hard to maintain in working condition. At the end we had to patch the Android NDK while chrome build script checkouts working version of NDK and all other required tools.
With docker script any engineer in the team could build the engine from scratch no mater which OS he uses.
来源:https://stackoverflow.com/questions/43366927/v8-build-for-android-on-mac