Skip to content

Build fails when cross compiling v12.x host x86-64 to arm #32717

@facorreia

Description

@facorreia

I am trying to cross compile node v12.16.1 for arm. It appears that part of the build process is to build the bytecode_builtins_list_generator executable that will be used in the host machine to create header files dynamically. However the build process is using target compiler instead of host compiler where the final binary can not to be executed in the host machine.

bytecode_builtins_list_generator: node/out/Release/bytecode_builtins_list_generator: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=27e85c210648cdd73a0e84e1c367c3915259ff85, not stripped

compiler: arm-linux-gnueabi-g++ version 5.5.0

Host Platform: Linux 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu May 17 12:56:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Target Platform: -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon

Node version: v12.16.1

Configure: ./configure --prefix=/work/deploy/node --shared --cross-compiling --shared-openssl --with-arm-fpu=neon --with-arm-float-abi=softfp --shared-openssl-includes=
/work/sdk/openssl/1.0.2s/include/ --shared-openssl-libname=crypto,ssl --shared-openssl-libpath=/work/sdk/openssl/1.0.2s/lib/
--dest-cpu=arm --dest-os=linux --without-snapshot --without-node-snapshot --without-report --without-dtrace --without-etw --without-npm --no-browser-globals --wi
thout-inspector --without-intl

config.gypi
########################################################
Do not edit. Generated by the configure script.
{ 'target_defaults': { 'cflags': [],
'default_configuration': 'Release',
'defines': [],
'include_dirs': [ '/work/sdk/openssl/1.0.2s/include/'],
'libraries': [ '-L/work/sdk/include/oss/openssl/1.0.2s/lib/',
'-lcrypto',
'-lssl']},
'variables': { 'arm_float_abi': 'softfp',
'arm_fpu': 'neon',
'arm_thumb': 0,
'arm_version': '7',
'asan': 0,
'build_v8_with_gn': 'false',
'coverage': 'false',
'debug_nghttp2': 'false',
'enable_lto': 'false',
'enable_pgo_generate': 'false',
'enable_pgo_use': 'false',
'force_dynamic_crt': 1,
'host_arch': 'x64',
'icu_small': 'false',
'is_debug': 0,
'llvm_version': '0.0',
'napi_build_version': '5',
'node_byteorder': 'little',
'node_debug_lib': 'false',
'node_enable_d8': 'false',
'node_install_npm': 'false',
'node_module_version': 72,
'node_no_browser_globals': 'true',
'node_prefix': '/work/deploy/node',
'node_release_urlbase': '',
'node_report': 'false',
'node_shared': 'true',
'node_shared_cares': 'false',
'node_shared_http_parser': 'false',
'node_shared_libuv': 'false',
'node_shared_nghttp2': 'false',
'node_shared_openssl': 'true',
'node_shared_zlib': 'false',
'node_tag': '',
'node_target_type': 'shared_library',
'node_use_bundled_v8': 'true',
'node_use_dtrace': 'false',
'node_use_etw': 'false',
'node_use_large_pages': 'false',
'node_use_large_pages_script_lld': 'false',
'node_use_node_code_cache': 'false',
'node_use_node_snapshot': 'false',
'node_use_openssl': 'true',
'node_use_v8_platform': 'true',
'node_with_ltcg': 'false',
'node_without_node_options': 'false',
'openssl_fips': '',
'openssl_is_fips': 'false',
'shlib_suffix': 'so.72',
'target_arch': 'arm',
'v8_enable_gdbjit': 0,
'v8_enable_i18n_support': 0,
'v8_enable_inspector': 0,
'v8_no_strict_aliasing': 1,
'v8_optimized_debug': 1,
'v8_promise_internal_field_count': 1,
'v8_random_seed': 0,
'v8_trace_maps': 0,
'v8_use_siphash': 1,
'v8_use_snapshot': 0,
'want_separate_host_toolset': 0}}

error message:

#####################################################
LD_LIBRARY_PATH=/node/out/Release/lib.host:/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../tools/v8_gypfiles; mkdir -p /node/out/Release/obj/gen/generate-bytecode-output-root/builtins-generated; python ../../deps/v8/tools/run.py "/node/out/Release/bytecode_builtins_list_generator" "/node/out/Release/obj/gen/generate-bytecode-output-root/builtins-generated/bytecodes-builtins-list.h"
Traceback (most recent call last):
File "../../deps/v8/tools/run.py", line 12, in <module>
sys.exit(subprocess.call(sys.argv[1:]))
File "/usr/lib/python2.7/subprocess.py", line 523, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
tools/v8_gypfiles/generate_bytecode_builtins_list.target.mk:13: recipe for target '/node/out/Release/obj/gen/generate-bytecode-output-root/builtins-generated/bytecodes-builtins-list.h' failed
make[2]: *** [/node/out/Release/obj/gen/generate-bytecode-output-root/builtins-generated/bytecodes-builtins-list.h] Error 1
make[2]: *** Waiting for unfinished jobs....
../deps/v8/src/torque/implementation-visitor.cc: In member function 'v8::internal::torque::VisitResult v8::internal::torque::ImplementationVisitor::InlineMacro(v8::internal::torque::Macro*, v8::base::Optional<v8::internal::torque::LocationReference>, const std::vector<v8::internal::torque::VisitResult>&, std::vector<v8::internal::torque::Block*>)':
../deps/v8/src/torque/implementation-visitor.cc:258:32: warning: 'macro_end' may be used uninitialized in this function [-Wmaybe-uninitialized]
assembler().Bind(macro_end);
^
../deps/v8/src/torque/torque-parser.cc: In function 'v8::base::Optional<v8::internal::torque::ParseResult> v8::internal::torque::{anonymous}::MakeTypeswitchStatement(v8::internal::torque::ParseResultIterator*)':
../deps/v8/src/torque/torque-parser.cc:1026:30: warning: 'accumulated_types' may be used uninitialized in this function [-Wmaybe-uninitialized]
: cases[i].type;
^
Makefile:101: recipe for target 'node' failed
make[1]: *** [node] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    armIssues and PRs related to the ARM platform.buildIssues and PRs related to build files or the CI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions