sjitech / build-nodejs-for-android

Build nodejs for android(arm,arm64,x86,x64,mipsel) perfectly and provide prebuilt binaries, and a docker image as workbench.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support Node.JS v12

jacobbubu opened this issue · 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'

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

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(

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.

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

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?

If you want to compile node 13 I think it would be easier to just revert this change: nodejs/node@2623ef0 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.

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/

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

Thank you greatly!

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

Thank you greatly!

Want it too 😀