build-nodejs-for-android icon indicating copy to clipboard operation
build-nodejs-for-android copied to clipboard

support Node.JS v12

Open jacobbubu opened this issue 6 years ago • 9 comments

It worked when I was trying to build node.js v6.5.0 but failed with node.js v12.40.0

The part of the output is following:

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/python3.6/subprocess.py", line 287, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/media/psf/vm_share/github/node/out/Release/bytecode_builtins_list_generator'
tools/v8_gypfiles/generate_bytecode_builtins_list.target.mk:13: recipe for target '/media/psf/vm_share/github/node/out/Release/obj/gen/generate-bytecode-output-root/builtins-generated/bytecodes-builtins-list.h' failed
make[1]: *** [/media/psf/vm_share/github/node/out/Release/obj/gen/generate-bytecode-output-root/builtins-generated/bytecodes-builtins-list.h] Error 1
Makefile:101: recipe for target 'node' failed
make: *** [node] Error 2
[BUILD] Build failed. See './out-bin/nodejs-android-arm64/build.log'

jacobbubu avatar Jan 08 '20 03:01 jacobbubu

I encountered the same issue and from my understanding now, its becuase bytecode_builtins_list_generator is not compiled for the host system

nappy avatar Feb 19 '20 12:02 nappy

There you go:

diff --git a/configure.py b/configure.py
index 473bbfeb..0453acf4 100755
--- a/configure.py
+++ b/configure.py
@@ -966,7 +966,7 @@ def configure_node(o):
                      else target_arch != host_arch)
   want_snapshots = not options.without_snapshot
   o['variables']['want_separate_host_toolset'] = int(
-      cross_compiling and want_snapshots)
+      cross_compiling)
 
   if not options.without_node_snapshot:
     o['variables']['node_use_node_snapshot'] = b(

nappy avatar Feb 19 '20 13:02 nappy

I am facing the same issue while cross-compiling nodejs version 13.1.0. Above changes are already there in configure.py, it is still not working though, bytecode_builtins_list_generator is getting compiled for the target machine, can someone please help here.

SwatiSonam avatar Aug 14 '20 14:08 SwatiSonam

Its probably due to this change in v13.0.1: https://github.com/nodejs/node/pull/30021 Either reverse that change or build with snapshots: https://github.com/termux/termux-packages/pull/4762

nappy avatar Aug 14 '20 14:08 nappy

Thanks for your prompt response. I tried compiling using --with-snapshots flag, still stuck with same issue (bytecode_builtins_list_generator is getting built for target machine). Could you please suggest something here?

SwatiSonam avatar Aug 15 '20 08:08 SwatiSonam

If you want to compile node 13 I think it would be easier to just revert this change: https://github.com/nodejs/node/pull/30021/commits/2623ef02d463742398d6433bbc2051cae92543fc and compile --without-snapshot (as long they did not any further conflicting changes). If you want to make snapshots work with cross-compiling you might want to take a closer look how termux did this, or maybe just use their binaries. I have not done this, I am still on node v12 for my android project. I would be interested in a solution once LTS switches to 14.

nappy avatar Aug 15 '20 18:08 nappy

Thanks a lot for all your help and suggestions. I am able to compile nodejs 13.0 using the steps mentioned in link - https://chrislea.com/2018/08/20/cross-compiling-node-js-for-arm-on-ubuntu/

SwatiSonam avatar Aug 17 '20 13:08 SwatiSonam

Can you please share the version 13 compiles? arm and arm64?

Thank you greatly!

272development avatar Feb 07 '22 03:02 272development

Can you please share the version 13 compiles? arm and arm64?

Thank you greatly!

Want it too 😀

DerGoogler avatar Mar 11 '22 21:03 DerGoogler