ShadowNode
ShadowNode copied to clipboard
Can not build out arm64 version for linux-android platform
- Version:
- Platform:
- Subsystem:
I try to build the ShadowNode sources with the guide: https://github.com/yodaos-project/ShadowNode/blob/master/docs/build/Build-for-Android.md
I used exactly the same build config as the description in doc. But what I built out is arm-32 version, not 64.
The result of "file" command: build/aarch64-linux-android/debug/bin/iotjs: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), BuildID[sha1]=799e3a8d0ab40f80600bfc07ba0760e10b251219, not stripped
My build steps:
export NDK_DIR=/home/tool/android-ndk-r21
./tools/build.py
--target-arch=aarch64
--target-os=linux-android
--cmake-param=-DANDROID_NDK=$NDK_DIR
--cmake-param=-DANDROID_NATIVE_API_LEVEL=23
--cmake-param=-DANDROID_ABI=armeabi-v7a
--cmake-param=-DANDROID_TOOLCHAIN=clang
--cmake-toolchain-file=$NDK_DIR/build/cmake/android.toolchain.cmake
--profile=./profiles/basic.profile
What error do you get from the above instructions?
No error found, it built out successfully.
...
[ 96%] Building C object CMakeFiles/libiotjs.dir/src/modules/iotjs_module_udp.c.o
[ 97%] Linking C static library lib/libiotjs.a
make[2]: Leaving directory /home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug' [ 97%] Built target libiotjs make[2]: Entering directory
/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug'
Scanning dependencies of target iotjs
make[2]: Leaving directory /home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug' make[2]: Entering directory
/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug'
[ 98%] Building C object CMakeFiles/iotjs.dir/src/iotjs_main.c.o
[100%] Linking C executable bin/iotjs
make[2]: Leaving directory /home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug' [100%] Built target iotjs make[1]: Leaving directory
/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug'
make: Leaving directory `/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug'
IoT.js Build Succeeded!!
To run tests use '--run-test' or one of the folowing commands:
tools/testrunner.py /home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug/bin/iotjs
Oops, I was misunderstood your question, may I ask you to print the options
at https://github.com/yodaos-project/ShadowNode/blob/master/tools/build.py#L270, thus we could check if the config is correct.
pint the options
at Line 270 in build.py
Namespace(G=None, build_root=u'/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug', builddir='/home/cchma/tool/ShadowNode/build', buildlib=False, buildtype=u'debug', clean=False, cmake_param=['-DANDROID_NDK=/home/cchma/tool/android-ndk-r21', '-DANDROID_NATIVE_API_LEVEL=23', '-DANDROID_ABI=armeabi-v7a', '-DANDROID_TOOLCHAIN=clang'], cmake_toolchain_file='/home/cchma/tool/android-ndk-r21/build/cmake/android.toolchain.cmake', compile_flag=[], config={u'target-os': u'', u'jerry-lto': False, u'external-include-dir': [], u'builddir': u'', u'jerry-memstat': False, u'no-init-submodule': False, u'jerry-heaplimit': 4096, u'link-flag': [], u'sysroot': u'', u'buildtype': u'debug', u'compile-flag': [], u'clean': False, u'jerry-cmake-param': [], u'target-arch': u'', u'no-parallel-build': False, u'no-check-test': False, u'jerry-compile-flag': [], u'target-board': u'', u'external-lib': [], u'config': u'', u'cmake-param': [], u'jerry-link-flag': [], u'no-snapshot': False, u'no-check-tidy': False, u'buildlib': False}, config_path='/home/cchma/tool/ShadowNode/build.config', disable_es2015=False, experimental=False, external_include_dir=[], external_lib=[], external_modules=set([]), host_tuple='x86_64-linux', install=False, install_prefix='/usr/local', jerry_cmake_param=[], jerry_compile_flag=[], jerry_cpu_profiler=False, jerry_debugger=False, jerry_heap_profiler=False, jerry_heap_section=None, jerry_heaplimit=4096, jerry_lto=False, jerry_memstat=False, jerry_profile='es5.1', jerryx=False, link_flag=[], napi=False, no_check_valgrind=False, no_init_submodule=False, no_parallel_build=False, no_snapshot=False, profile='./profiles/basic.profile', run_test=False, static=False, sysroot=None, target_arch='aarch64', target_board=None, target_os='linux-android', target_tuple='aarch64-linux-android', testsets=None)
May I ask you to have a look at /home/cchma/tool/android-ndk-r21/build/cmake/android.toolchain.cmake?
It seems need to set the -DANDROID_ABI
to arm64-v8a
? But After set --cmake-param=-DANDROID_ABI=arm64-v8a
, the build will be failed.
...
[ 50%] Completed 'libjerry'
make[2]: Leaving directory /home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug' [ 55%] Built target libjerry make[2]: Entering directory
/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug'
Scanning dependencies of target libiotjs
make[2]: Leaving directory /home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug' make[2]: Entering directory
/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug'
[ 56%] Building C object CMakeFiles/libiotjs.dir/src/iotjs_module.c.o
[ 57%] Linking C shared library lib/libiotjs.so
lib/libjerry-core.a: error adding symbols: File in wrong format
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libiotjs.so] Error 1
make[2]: Leaving directory /home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug' make[1]: *** [CMakeFiles/libiotjs.dir/all] Error 2 make[1]: Leaving directory
/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug'
make: *** [all] Error 2
make: Leaving directory `/home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug'
[Failed - 2] make -C /home/cchma/tool/ShadowNode/build/aarch64-linux-android/debug -j
lib/libjerry-core.a: error adding symbols: File in wrong format
This might be caused by the wrong format of some object files, have you tried a clean build?
lib/libjerry-core.a: error adding symbols: File in wrong format
This might be caused by the wrong format of some object files, have you tried a clean build?
Every time is clean build. First rm build -rf
, then do build.
armeabi-v7a is 32 bit
The issue has been fixed. The "-DANDROID_ABI" should be "arm64-v8a" and the "-DANDROID_ABI" should also be added in the deps cmake files, otherwise these deps static libraries will all be arm32.
I have created a pull request: https://github.com/yodaos-project/ShadowNode/pull/575