New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working build script for Android ARM Node 7.x or 8.x shared library #14783

Open
aschrijver opened this Issue Aug 12, 2017 · 18 comments

Comments

Projects
None yet
9 participants
@aschrijver

aschrijver commented Aug 12, 2017

I spend the full day yesterday trying many variations of android-configure and other build scripts, with different versions of Node to create a shared library libnode.so for ARM.

An overview of build options that were tried so far (some successes):

Node NDK Arch Description Result Details
7.1.0 r15 latest ARM dna2oslab + --shared fail #14783 (comment)
7.4.0 up to 7.9.0 r13b ARM J2V8 libnode.a linked in libj2v8.so using PR#327 [1] success eclipsesource/J2V8#327 (comment)
7.10.1 r15 latest ARM dna2oslab + --shared fail #14783 (comment)
8.3.0 r17 canary ARM android-configure + --shared fail #14783 (comment)
8.x (none) ARM64 on-device using termux + python configure success node-on-mobile/node-on-android#4 (comment)
8.x master + #14837 r13b ARM J2V8 libnode.a linked in libj2v8.so using PR#327 fail eclipsesource/J2V8#327 (comment)
8.x r17 canary ARM J2V8 libnode.a linked in libj2v8.so using Clang and libc++ [2] fail
[3]
eclipsesource/J2V8#334 (comment)
v8.11.4 r17b ARM / x64 built via build-nodejs-for-android-perfectly success see: #14783 (comment)

[1] Or build only the static library with https://github.com/eclipsesource/static-node-build
[2] Clang + libc++ are the way to go for 8.x builds
[3] Looks promising, needs compiling with libandroid_support headers

Are there any more build script configurations known to work in creating Node shared libraries?


Many thanks to @gardner @DanAlbert @drywolf @matiwinnetou @irbull @mafintosh @gibfahn for all their great efforts in helping to figure this out! 👍

@aschrijver aschrijver referenced this issue Aug 12, 2017

Closed

build, api, docs: android support #10341

0 of 6 tasks complete
@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Aug 12, 2017

FYI:

I've tried many different ways to get NodeJS running on Android and spent yesterday all-day compiling without success.
I am investigating some viable-seeming approaches to use NodeJS in an android project. I have documented my findings on stackoverflow - Viable options to running NodeJS on Android (Aug 2017).

aschrijver commented Aug 12, 2017

FYI:

I've tried many different ways to get NodeJS running on Android and spent yesterday all-day compiling without success.
I am investigating some viable-seeming approaches to use NodeJS in an android project. I have documented my findings on stackoverflow - Viable options to running NodeJS on Android (Aug 2017).

@gardner

This comment has been minimized.

Show comment
Hide comment
@gardner

gardner Aug 12, 2017

Hi @aschrijver, I as well spent a lot of time with the node build system trying to get a shared lib for android. My work is here: https://github.com/gardner/ssband

You may be more interested in some work by @staltz that wraps the node binary in an Android service as showcased here: https://github.com/staltz/mmmmm-mobile

André definitely has a great working example of running a node server from and Android app. If you need the tight coupling that comes with shared modules and in-process communication then maybe check out the aging ssband.

Keep up the good work

gardner commented Aug 12, 2017

Hi @aschrijver, I as well spent a lot of time with the node build system trying to get a shared lib for android. My work is here: https://github.com/gardner/ssband

You may be more interested in some work by @staltz that wraps the node binary in an Android service as showcased here: https://github.com/staltz/mmmmm-mobile

André definitely has a great working example of running a node server from and Android app. If you need the tight coupling that comes with shared modules and in-process communication then maybe check out the aging ssband.

Keep up the good work

@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Aug 12, 2017

Thank you @gardner I will look at ssband. I have included @stalz in my evaluation. He also created react-native-node :)

I've also tried mmmm-mobile (not completely done yet, it has some nice things, but I don't need the deeper integration with scuttlebot). Because the react-native-node Example didn't work, I've created a combination of node-on-android, but I now just need to compile a node lib for that, because RN does not support 64-bit libs.

Update: I've looked at ssband, but is basically what I have tried already (android-configure + make) wrapped in Vagrant scripts, but thx anyway.

aschrijver commented Aug 12, 2017

Thank you @gardner I will look at ssband. I have included @stalz in my evaluation. He also created react-native-node :)

I've also tried mmmm-mobile (not completely done yet, it has some nice things, but I don't need the deeper integration with scuttlebot). Because the react-native-node Example didn't work, I've created a combination of node-on-android, but I now just need to compile a node lib for that, because RN does not support 64-bit libs.

Update: I've looked at ssband, but is basically what I have tried already (android-configure + make) wrapped in Vagrant scripts, but thx anyway.

@gibfahn

This comment has been minimized.

Show comment
Hide comment
@gibfahn

gibfahn Aug 12, 2017

Member

Are there any build script configurations known to work in creating Node shared libraries?

Since the android-configure script was created a --shared option was added to Node. It works (generates a valid shared lib) on Linux platforms (I haven't tried it with ARM, but it works on x,p,z). Sorry if you've already tried this and it doesn't work!

node/configure

Lines 489 to 493 in 89d9cc7

parser.add_option('--shared',
action='store_true',
dest='shared',
help='compile shared library for embedding node in another project. ' +
'(This mode is not officially supported for regular applications)')

Ideally android-configure would be merged back into configure, otherwise it'll probably continue to get out of sync.

It'd also be good to get some testing of our Shared Library node build options.

Member

gibfahn commented Aug 12, 2017

Are there any build script configurations known to work in creating Node shared libraries?

Since the android-configure script was created a --shared option was added to Node. It works (generates a valid shared lib) on Linux platforms (I haven't tried it with ARM, but it works on x,p,z). Sorry if you've already tried this and it doesn't work!

node/configure

Lines 489 to 493 in 89d9cc7

parser.add_option('--shared',
action='store_true',
dest='shared',
help='compile shared library for embedding node in another project. ' +
'(This mode is not officially supported for regular applications)')

Ideally android-configure would be merged back into configure, otherwise it'll probably continue to get out of sync.

It'd also be good to get some testing of our Shared Library node build options.

@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Aug 13, 2017

@gibfahn Thanks. I've tried this shared option for ARM on android, but it fails (have tried for 7.1.0, 7.10.1 and8.x). I agree mergingandroid-configure` would be best solution.

aschrijver commented Aug 13, 2017

@gibfahn Thanks. I've tried this shared option for ARM on android, but it fails (have tried for 7.1.0, 7.10.1 and8.x). I agree mergingandroid-configure` would be best solution.

@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Aug 13, 2017

Node v8.3.0 for ARM with latest NDK r17 canary build: Fails

Status: Fails at end of build when creating .so. May work if configured for libc++

Compiling NodeJS as native library for Android (arm) on Ubuntu 16.04 (4.4.0-59-generic) with the latest NDK continuous build

I am using canary NDK because of earlier node-matchers.h error 'nearbyint' is not a member of 'std' with stable r15 ndk and this github issue: android-ndk/ndk#82 (comment)

Procedure:

  • git clone --depth=2 -b v8.x https://github.com/nodejs/node.git
  • Edit android-configure: add --force to make_toolchain, add --without-intl --shared to configure
  • ./android-configure /home/arnold/Android/android-ndk-r17-canary arm
  • LDFLAGS=-shared make

And the resulting output was:

In file included from ../deps/v8/src/compiler/ast-graph-builder.cc:16:0:
../deps/v8/src/compiler/node-matchers.h: In member function 'bool v8::internal::compiler::FloatMatcher<T, kOpcode>::IsInteger() const':
../deps/v8/src/compiler/node-matchers.h:171:32: error: 'nearbyint' is not a member of 'std'
     return this->HasValue() && std::nearbyint(this->Value()) == this->Value();
                                ^
../deps/v8/src/compiler/node-matchers.h:171:32: note: suggested alternative:
In file included from /home/arnold/Development/misc/node/android-toolchain/include/c++/4.9.x/cmath:44:0,
                 from ../deps/v8/src/utils.h:11,
                 from ../deps/v8/src/conversions.h:11,
                 from ../deps/v8/src/ast/ast-types.h:8,
                 from ../deps/v8/src/ast/ast.h:8,
                 from ../deps/v8/src/compiler/ast-graph-builder.h:8,
                 from ../deps/v8/src/compiler/ast-graph-builder.cc:5:
/home/arnold/Development/misc/node/android-toolchain/sysroot/usr/include/math.h:198:8: note:   'nearbyint'
 double nearbyint(double);
        ^
deps/v8/src/v8_base.target.mk:605: recipe for target '/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/deps/v8/src/compiler/ast-graph-builder.o' failed
make[1]: *** [/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/deps/v8/src/compiler/ast-graph-builder.o] Error 1
rm bb4e5f9676e23c1f654738ad8795159445636c4f.intermediate
Makefile:76: recipe for target 'node' failed
make: *** [node] Error 2

BTW this is the same error I get when running the fantastic build system being PR'ed for J2V8 (kudos @drywolf ). See full details or:

In file included from ../deps/v8/src/compiler/ast-graph-builder.cc:16:0:
../deps/v8/src/compiler/node-matchers.h: In member function 'bool v8::internal::compiler::FloatMatcher<T, kOpcode>::IsInteger() const':
../deps/v8/src/compiler/node-matchers.h:171:32: error: 'nearbyint' is not a member of 'std'
return this->HasValue() && std::nearbyint(this->Value()) == this->Value();

@DanAlbert was kind enough to point out I am still using gnustl and not 'libc++ which leads to this error.

The only issue is, I do not know how to configure libc++. Added --stl=libc++ to make-standalone-toolchain.sh cmd in android-configure but that does not do it.

Then, working from C++ STL Support I added first --partly-shared (adds -static-libgcc, -static-libstdc++). No difference. Also tried with additional --enable-shared, and removing --partly-shared adding --without-inspector. Same result.

Console output:

  touch /home/arnold/Development/misc/node/out/Release/obj.target/deps/v8/src/inspector/inspector_debugger_script.stamp
  /home/arnold/Development/misc/node/android-toolchain/bin/arm-linux-androideabi-g++ '-DV8_GYP_BUILD' '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DCAN_USE_VFP3_INSTRUCTIONS' '-DCAN_USE_VFP32DREGS' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT' '-Dv8_promise_internal_field_count' '-D_GLIBCXX_USE_C99_MATH' -I../deps/v8 -I../. -I/home/arnold/Development/misc/node/out/Release/obj/gen -I../deps/v8/include  -Wall -Wextra -Wno-unused-parameter -fPIC -march=armv7-a -mfpu=vfpv3 -marm -fdata-sections -ffunction-sections -O2 -fno-omit-frame-pointer -fPIE -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/arnold/Development/misc/node/out/Release/.deps//home/arnold/Development/misc/node/out/Release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o.d.raw   -c -o /home/arnold/Development/misc/node/out/Release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o /home/arnold/Development/misc/node/out/Release/obj/gen/src/inspector/protocol/Protocol.cpp
In file included from /home/arnold/Development/misc/node/android-toolchain/include/c++/4.9.x/type_traits:390:0,
                 from /home/arnold/Development/misc/node/android-toolchain/include/c++/4.9.x/memory:643,
                 from ../deps/v8/src/inspector/string-util.h:8,
                 from /home/arnold/Development/misc/node/out/Release/obj/gen/src/inspector/protocol/Forward.h:8,
                 from /home/arnold/Development/misc/node/out/Release/obj/gen/src/inspector/protocol/Protocol.h:8,
                 from /home/arnold/Development/misc/node/out/Release/obj/gen/src/inspector/protocol/Protocol.cpp:7:
/home/arnold/Development/misc/node/android-toolchain/include/c++/4.9.x/cstddef:44:25: fatal error: stddef.h: No such file or directory
 #include_next <stddef.h>
                         ^
compilation terminated.
deps/v8/src/v8_base.target.mk:622: recipe for target '/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o' failed
make[1]: *** [/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o] Error 1
rm bb4e5f9676e23c1f654738ad8795159445636c4f.intermediate
Makefile:76: recipe for target 'node' failed
make: *** [node] Error 2

How can I pass this setting / configure this?

aschrijver commented Aug 13, 2017

Node v8.3.0 for ARM with latest NDK r17 canary build: Fails

Status: Fails at end of build when creating .so. May work if configured for libc++

Compiling NodeJS as native library for Android (arm) on Ubuntu 16.04 (4.4.0-59-generic) with the latest NDK continuous build

I am using canary NDK because of earlier node-matchers.h error 'nearbyint' is not a member of 'std' with stable r15 ndk and this github issue: android-ndk/ndk#82 (comment)

Procedure:

  • git clone --depth=2 -b v8.x https://github.com/nodejs/node.git
  • Edit android-configure: add --force to make_toolchain, add --without-intl --shared to configure
  • ./android-configure /home/arnold/Android/android-ndk-r17-canary arm
  • LDFLAGS=-shared make

And the resulting output was:

In file included from ../deps/v8/src/compiler/ast-graph-builder.cc:16:0:
../deps/v8/src/compiler/node-matchers.h: In member function 'bool v8::internal::compiler::FloatMatcher<T, kOpcode>::IsInteger() const':
../deps/v8/src/compiler/node-matchers.h:171:32: error: 'nearbyint' is not a member of 'std'
     return this->HasValue() && std::nearbyint(this->Value()) == this->Value();
                                ^
../deps/v8/src/compiler/node-matchers.h:171:32: note: suggested alternative:
In file included from /home/arnold/Development/misc/node/android-toolchain/include/c++/4.9.x/cmath:44:0,
                 from ../deps/v8/src/utils.h:11,
                 from ../deps/v8/src/conversions.h:11,
                 from ../deps/v8/src/ast/ast-types.h:8,
                 from ../deps/v8/src/ast/ast.h:8,
                 from ../deps/v8/src/compiler/ast-graph-builder.h:8,
                 from ../deps/v8/src/compiler/ast-graph-builder.cc:5:
/home/arnold/Development/misc/node/android-toolchain/sysroot/usr/include/math.h:198:8: note:   'nearbyint'
 double nearbyint(double);
        ^
deps/v8/src/v8_base.target.mk:605: recipe for target '/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/deps/v8/src/compiler/ast-graph-builder.o' failed
make[1]: *** [/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/deps/v8/src/compiler/ast-graph-builder.o] Error 1
rm bb4e5f9676e23c1f654738ad8795159445636c4f.intermediate
Makefile:76: recipe for target 'node' failed
make: *** [node] Error 2

BTW this is the same error I get when running the fantastic build system being PR'ed for J2V8 (kudos @drywolf ). See full details or:

In file included from ../deps/v8/src/compiler/ast-graph-builder.cc:16:0:
../deps/v8/src/compiler/node-matchers.h: In member function 'bool v8::internal::compiler::FloatMatcher<T, kOpcode>::IsInteger() const':
../deps/v8/src/compiler/node-matchers.h:171:32: error: 'nearbyint' is not a member of 'std'
return this->HasValue() && std::nearbyint(this->Value()) == this->Value();

@DanAlbert was kind enough to point out I am still using gnustl and not 'libc++ which leads to this error.

The only issue is, I do not know how to configure libc++. Added --stl=libc++ to make-standalone-toolchain.sh cmd in android-configure but that does not do it.

Then, working from C++ STL Support I added first --partly-shared (adds -static-libgcc, -static-libstdc++). No difference. Also tried with additional --enable-shared, and removing --partly-shared adding --without-inspector. Same result.

Console output:

  touch /home/arnold/Development/misc/node/out/Release/obj.target/deps/v8/src/inspector/inspector_debugger_script.stamp
  /home/arnold/Development/misc/node/android-toolchain/bin/arm-linux-androideabi-g++ '-DV8_GYP_BUILD' '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DCAN_USE_VFP3_INSTRUCTIONS' '-DCAN_USE_VFP32DREGS' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT' '-Dv8_promise_internal_field_count' '-D_GLIBCXX_USE_C99_MATH' -I../deps/v8 -I../. -I/home/arnold/Development/misc/node/out/Release/obj/gen -I../deps/v8/include  -Wall -Wextra -Wno-unused-parameter -fPIC -march=armv7-a -mfpu=vfpv3 -marm -fdata-sections -ffunction-sections -O2 -fno-omit-frame-pointer -fPIE -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/arnold/Development/misc/node/out/Release/.deps//home/arnold/Development/misc/node/out/Release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o.d.raw   -c -o /home/arnold/Development/misc/node/out/Release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o /home/arnold/Development/misc/node/out/Release/obj/gen/src/inspector/protocol/Protocol.cpp
In file included from /home/arnold/Development/misc/node/android-toolchain/include/c++/4.9.x/type_traits:390:0,
                 from /home/arnold/Development/misc/node/android-toolchain/include/c++/4.9.x/memory:643,
                 from ../deps/v8/src/inspector/string-util.h:8,
                 from /home/arnold/Development/misc/node/out/Release/obj/gen/src/inspector/protocol/Forward.h:8,
                 from /home/arnold/Development/misc/node/out/Release/obj/gen/src/inspector/protocol/Protocol.h:8,
                 from /home/arnold/Development/misc/node/out/Release/obj/gen/src/inspector/protocol/Protocol.cpp:7:
/home/arnold/Development/misc/node/android-toolchain/include/c++/4.9.x/cstddef:44:25: fatal error: stddef.h: No such file or directory
 #include_next <stddef.h>
                         ^
compilation terminated.
deps/v8/src/v8_base.target.mk:622: recipe for target '/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o' failed
make[1]: *** [/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/gen/src/inspector/protocol/Protocol.o] Error 1
rm bb4e5f9676e23c1f654738ad8795159445636c4f.intermediate
Makefile:76: recipe for target 'node' failed
make: *** [node] Error 2

How can I pass this setting / configure this?

@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Aug 13, 2017

NodeJS v7.10.1 for ARM with dna2oslab build script, built on NDK r15 latest: Fails

Status: Fails at end of build when creating .so

Built with dna2oslab build script. This because it solves the first mkpeephole error you'll get with android-configure:

/home/arnold/Development/misc/node/android-toolchain/bin/arm-linux-androideabi-g++ -rdynamic -fPIE -pie -shared -o /home/arnold/Development/misc/node/out/Release/mkpeephole -Wl,--start-group /home/arnold/Development/misc/node/out/Release/obj.target/mkpeephole/deps/v8/src/interpreter/bytecode-operands.o /home/arnold/Development/misc/node/out/Release/obj.target/mkpeephole/deps/v8/src/interpreter/bytecodes.o /home/arnold/Development/misc/node/out/Release/obj.target/mkpeephole/deps/v8/src/interpreter/mkpeephole.o /home/arnold/Development/misc/node/out/Release/obj.target/deps/v8/src/libv8_libbase.a -Wl,--end-group -llog
  LD_LIBRARY_PATH=/home/arnold/Development/misc/node/out/Release/lib.host:/home/arnold/Development/misc/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/src; mkdir -p /home/arnold/Development/misc/node/out/Release/obj.target/v8_base/geni; "/home/arnold/Development/misc/node/out/Release/mkpeephole" "/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc"
/home/arnold/Development/misc/node/out/Release/mkpeephole: 1: /home/arnold/Development/misc/node/out/Release/mkpeephole: Syntax error: word unexpected (expecting ")")
deps/v8/src/v8_base.target.mk:13: recipe for target '/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc' failed
make[1]: *** [/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc] Error 2
make[1]: Leaving directory '/home/arnold/Development/misc/node/out'
Makefile:75: recipe for target 'node' failed
make: *** [node] Error 2

Building with dna2oslab resulted in following mkpeephole-related error:

/home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ --sysroot=/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr -I/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/include -L/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/lib '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DCAN_USE_VFP3_INSTRUCTIONS' '-DCAN_USE_VFP32DREGS' '-DENABLE_DISASSEMBLER' '-D_GLIBCXX_USE_C99_MATH' -I../deps/v8 -I../. -I/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj/gen -I../deps/v8/include  -Wall -Wextra -Wno-unused-parameter -fPIC -march=armv7-a -mfpu=vfpv3 -marm -fdata-sections -ffunction-sections -O2 -fno-omit-frame-pointer -fPIE -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/.deps//home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.o.d.raw  -I/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -I/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -L/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi -fPIE -pie  -I/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -I/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -L/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi -fPIE -pie -c -o /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.o /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc
/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:13:68: error: conflicting declaration 'const v8::internal::interpreter::PeepholeActionAndData v8::internal::interpreter::PeepholeActionTable::row_data_ [129][129]'
 const PeepholeActionAndData PeepholeActionTable::row_data_[129][129] = {
                                                                    ^
In file included from /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:7:0:
../deps/v8/src/interpreter/bytecode-peephole-table.h:64:38: note: previous declaration as 'const v8::internal::interpreter::PeepholeActionAndData v8::internal::interpreter::PeepholeActionTable::row_data_ [][133]'
   static const PeepholeActionAndData row_data_[][kNumberOfBytecodes];
                                      ^
/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:13:68: error: declaration of 'const v8::internal::interpreter::PeepholeActionAndData v8::internal::interpreter::PeepholeActionTable::row_data_ [][133]' outside of class is not definition [-fpermissive]
 const PeepholeActionAndData PeepholeActionTable::row_data_[129][129] = {
                                                                    ^
/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:16915:65: error: conflicting declaration 'const v8::internal::interpreter::PeepholeActionAndData* const v8::internal::interpreter::PeepholeActionTable::row_ [129]'
 const PeepholeActionAndData* const PeepholeActionTable::row_[129] = {
                                                                 ^
In file included from /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:7:0:
../deps/v8/src/interpreter/bytecode-peephole-table.h:65:45: note: previous declaration as 'const v8::internal::interpreter::PeepholeActionAndData* const v8::internal::interpreter::PeepholeActionTable::row_ [133]'
   static const PeepholeActionAndData* const row_[kNumberOfBytecodes];
                                             ^
/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:16915:65: error: declaration of 'const v8::internal::interpreter::PeepholeActionAndData* const v8::internal::interpreter::PeepholeActionTable::row_ [133]' outside of class is not definition [-fpermissive]
 const PeepholeActionAndData* const PeepholeActionTable::row_[129] = {
                                                                 ^
Makefile:313: recipe for target '/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.o' failed
make[1]: *** [/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.o] Error 1
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out'
Makefile:75: recipe for target 'node' failed
make: *** [node] Error 2

aschrijver commented Aug 13, 2017

NodeJS v7.10.1 for ARM with dna2oslab build script, built on NDK r15 latest: Fails

Status: Fails at end of build when creating .so

Built with dna2oslab build script. This because it solves the first mkpeephole error you'll get with android-configure:

/home/arnold/Development/misc/node/android-toolchain/bin/arm-linux-androideabi-g++ -rdynamic -fPIE -pie -shared -o /home/arnold/Development/misc/node/out/Release/mkpeephole -Wl,--start-group /home/arnold/Development/misc/node/out/Release/obj.target/mkpeephole/deps/v8/src/interpreter/bytecode-operands.o /home/arnold/Development/misc/node/out/Release/obj.target/mkpeephole/deps/v8/src/interpreter/bytecodes.o /home/arnold/Development/misc/node/out/Release/obj.target/mkpeephole/deps/v8/src/interpreter/mkpeephole.o /home/arnold/Development/misc/node/out/Release/obj.target/deps/v8/src/libv8_libbase.a -Wl,--end-group -llog
  LD_LIBRARY_PATH=/home/arnold/Development/misc/node/out/Release/lib.host:/home/arnold/Development/misc/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/src; mkdir -p /home/arnold/Development/misc/node/out/Release/obj.target/v8_base/geni; "/home/arnold/Development/misc/node/out/Release/mkpeephole" "/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc"
/home/arnold/Development/misc/node/out/Release/mkpeephole: 1: /home/arnold/Development/misc/node/out/Release/mkpeephole: Syntax error: word unexpected (expecting ")")
deps/v8/src/v8_base.target.mk:13: recipe for target '/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc' failed
make[1]: *** [/home/arnold/Development/misc/node/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc] Error 2
make[1]: Leaving directory '/home/arnold/Development/misc/node/out'
Makefile:75: recipe for target 'node' failed
make: *** [node] Error 2

Building with dna2oslab resulted in following mkpeephole-related error:

/home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ --sysroot=/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr -I/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/include -L/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/lib '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DCAN_USE_VFP3_INSTRUCTIONS' '-DCAN_USE_VFP32DREGS' '-DENABLE_DISASSEMBLER' '-D_GLIBCXX_USE_C99_MATH' -I../deps/v8 -I../. -I/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj/gen -I../deps/v8/include  -Wall -Wextra -Wno-unused-parameter -fPIC -march=armv7-a -mfpu=vfpv3 -marm -fdata-sections -ffunction-sections -O2 -fno-omit-frame-pointer -fPIE -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/.deps//home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.o.d.raw  -I/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -I/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -L/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi -fPIE -pie  -I/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/include -I/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include -L/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi -fPIE -pie -c -o /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.o /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc
/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:13:68: error: conflicting declaration 'const v8::internal::interpreter::PeepholeActionAndData v8::internal::interpreter::PeepholeActionTable::row_data_ [129][129]'
 const PeepholeActionAndData PeepholeActionTable::row_data_[129][129] = {
                                                                    ^
In file included from /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:7:0:
../deps/v8/src/interpreter/bytecode-peephole-table.h:64:38: note: previous declaration as 'const v8::internal::interpreter::PeepholeActionAndData v8::internal::interpreter::PeepholeActionTable::row_data_ [][133]'
   static const PeepholeActionAndData row_data_[][kNumberOfBytecodes];
                                      ^
/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:13:68: error: declaration of 'const v8::internal::interpreter::PeepholeActionAndData v8::internal::interpreter::PeepholeActionTable::row_data_ [][133]' outside of class is not definition [-fpermissive]
 const PeepholeActionAndData PeepholeActionTable::row_data_[129][129] = {
                                                                    ^
/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:16915:65: error: conflicting declaration 'const v8::internal::interpreter::PeepholeActionAndData* const v8::internal::interpreter::PeepholeActionTable::row_ [129]'
 const PeepholeActionAndData* const PeepholeActionTable::row_[129] = {
                                                                 ^
In file included from /home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:7:0:
../deps/v8/src/interpreter/bytecode-peephole-table.h:65:45: note: previous declaration as 'const v8::internal::interpreter::PeepholeActionAndData* const v8::internal::interpreter::PeepholeActionTable::row_ [133]'
   static const PeepholeActionAndData* const row_[kNumberOfBytecodes];
                                             ^
/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc:16915:65: error: declaration of 'const v8::internal::interpreter::PeepholeActionAndData* const v8::internal::interpreter::PeepholeActionTable::row_ [133]' outside of class is not definition [-fpermissive]
 const PeepholeActionAndData* const PeepholeActionTable::row_[129] = {
                                                                 ^
Makefile:313: recipe for target '/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.o' failed
make[1]: *** [/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.o] Error 1
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.10.1/out'
Makefile:75: recipe for target 'node' failed
make: *** [node] Error 2
@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Aug 13, 2017

NodeJS v7.1.0 for ARM with dna2oslab build script, built on NDK r15 latest: Fails

Status: Fails at end of build when creating .so

Built with dna2oslab build script. This because it solves the first mkpeephole error you'll get with android-configure

It leads to similar issue as earlier reported error by @gardner (with NDK r14-beta1 and Node v6.9.1). Also tried with --partly-static, same results:

/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/zlib/libzlib.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/http_parser/libhttp_parser.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/cares/libcares.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/uv/libuv.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/v8/src/libv8_base.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/v8/src/libv8_libbase.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/v8/src/libv8_libsampler.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/v8/src/libv8_nosnapshot.a -Wl,--no-whole-archive -lgnustl_static -lm -ldl -llog
/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/lib/crtbegin_dynamic.o:crtbegin.c:function _start: error: undefined reference to 'main'
collect2: error: ld returned 1 exit status
node.target.mk:193: recipe for target '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/libnode.so.51' failed
make[1]: *** [/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/libnode.so.51] Error 1
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
Makefile:68: recipe for target 'node' failed
make: *** [node] Error 2

But this build almost made it to its successful conclusion!


Compiling with added --fully-static yields this error:

/home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ --sysroot=/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr -I/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/include -L/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/lib -rdynamic -fPIE -pie --sysroot=/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr -L/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/lib -fPIE -pie -L/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi -fPIE -pie -o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/openssl-cli -Wl,--start-group /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/app_rand.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/apps.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/asn1pars.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ca.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ciphers.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/cms.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/crl.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/crl2p7.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dgst.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dh.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dhparam.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dsa.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dsaparam.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ec.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ecparam.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/enc.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/engine.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/errstr.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/gendh.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/gendsa.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/genpkey.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/genrsa.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/nseq.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ocsp.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/openssl.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/passwd.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkcs12.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkcs7.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkcs8.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkey.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkeyparam.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkeyutl.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/prime.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/rand.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/req.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/rsa.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/rsautl.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_cb.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_client.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_server.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_socket.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_time.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/sess_id.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/smime.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/speed.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/spkac.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/srp.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ts.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/verify.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/version.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/x509.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a -Wl,--end-group -static -ldl -llog
/home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
/home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -llog
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: undefined reference to 'dlopen'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: undefined reference to 'dlsym'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: undefined reference to 'dlclose'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefined reference to 'dlsym'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefined reference to 'dlerror'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefined reference to 'dlsym'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefined reference to 'dlerror'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined reference to 'dlopen'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined reference to 'dlclose'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined reference to 'dlerror'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_unload: error: undefined reference to 'dlclose'
collect2: error: ld returned 1 exit status
deps/openssl/openssl-cli.target.mk:195: recipe for target '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/openssl-cli' failed
make[1]: *** [/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/openssl-cli] Error 1
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
Makefile:68: recipe for target 'node' failed
make: *** [node] Error 2

This probably due to statically linked executable limitations, specifically:

it could not load compiled modules: some C libs like musl (and seems glibc too) either use a stripped-down version of the dlopen() function or dynamic loading functionality is stubbed out entirely (at least with musl 1.1.11) when included in statically linked executables, so loading of Node.js compiled modules could fail. Requiring pure Javascript modules will work as expected, though.


Compiled instead with --enable-static (and --without-inspector):

  rm -f /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/libnode.so.51 && /home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar crsT /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/libnode.so.51 /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/debug-agent.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/async-wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/env.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/fs_event_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/cares_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/connection_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/connect_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/handle_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/js_stream.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_buffer.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_config.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_constants.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_contextify.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_file.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_http_parser.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_javascript.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_os.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_revert.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_url.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_util.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_v8.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_stat_watcher.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_watchdog.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_zlib.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_i18n.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/pipe_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/signal_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/spawn_sync.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/string_bytes.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/stream_base.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/stream_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/tcp_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/timer_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/tty_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/process_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/udp_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/uv.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/util.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/string_search.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_crypto.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_crypto_bio.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_crypto_clienthello.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/tls_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/backtrace_posix.o
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_dtrace_header.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_dtrace_provider.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_dtrace_ustack.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_etw.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_perfctr.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/specialize_node_d.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.host/v8_inspector_compress_protocol_json.stamp
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
ln -fs out/Release/node node
++ mkdir /home/arnold/Development/misc/dna2oslab/android/build/../node-v7.1.0/dist/bin
++ cp out/Release/mkpeephole /home/arnold/Development/misc/dna2oslab/android/build/../node-v7.1.0/dist/bin/v8_mkpeephole
++ make_install node-v7.1.0
++ make install
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
  LD_LIBRARY_PATH=/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/lib.host:/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/src; mkdir -p /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/v8_base/geni; echo "/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc"
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
ln -fs out/Release/node node
/usr/bin/python tools/install.py install '' '/home/arnold/Development/misc/dna2oslab/android/build/../node-v7.1.0/dist/'
installing /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/dist/bin/libnode.so.51
Traceback (most recent call last):
  File "tools/install.py", line 212, in <module>
    run(sys.argv[:])
  File "tools/install.py", line 206, in run
    if cmd == 'install': return files(install)
  File "tools/install.py", line 127, in files
    action([output_prefix + output_file], 'bin/' + output_file)
  File "tools/install.py", line 75, in install
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 75, in <lambda>
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 67, in try_copy
    return shutil.copy2(source_path, target_path)
  File "/usr/lib/python2.7/shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: u'out/Release/lib.target/libnode.so.51'
Makefile:85: recipe for target 'install' failed
make: *** [install] Error 1

aschrijver commented Aug 13, 2017

NodeJS v7.1.0 for ARM with dna2oslab build script, built on NDK r15 latest: Fails

Status: Fails at end of build when creating .so

Built with dna2oslab build script. This because it solves the first mkpeephole error you'll get with android-configure

It leads to similar issue as earlier reported error by @gardner (with NDK r14-beta1 and Node v6.9.1). Also tried with --partly-static, same results:

/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/zlib/libzlib.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/http_parser/libhttp_parser.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/cares/libcares.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/uv/libuv.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/v8/src/libv8_base.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/v8/src/libv8_libbase.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/v8/src/libv8_libsampler.a /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/v8/src/libv8_nosnapshot.a -Wl,--no-whole-archive -lgnustl_static -lm -ldl -llog
/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/lib/crtbegin_dynamic.o:crtbegin.c:function _start: error: undefined reference to 'main'
collect2: error: ld returned 1 exit status
node.target.mk:193: recipe for target '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/libnode.so.51' failed
make[1]: *** [/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/libnode.so.51] Error 1
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
Makefile:68: recipe for target 'node' failed
make: *** [node] Error 2

But this build almost made it to its successful conclusion!


Compiling with added --fully-static yields this error:

/home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ --sysroot=/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr -I/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/include -L/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/lib -rdynamic -fPIE -pie --sysroot=/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr -L/home/arnold/Android/Sdk/ndk-bundle/platforms/android-23/arch-arm/usr/lib -fPIE -pie -L/home/arnold/Android/Sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi -fPIE -pie -o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/openssl-cli -Wl,--start-group /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/app_rand.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/apps.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/asn1pars.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ca.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ciphers.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/cms.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/crl.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/crl2p7.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dgst.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dh.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dhparam.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dsa.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/dsaparam.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ec.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ecparam.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/enc.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/engine.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/errstr.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/gendh.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/gendsa.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/genpkey.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/genrsa.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/nseq.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ocsp.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/openssl.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/passwd.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkcs12.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkcs7.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkcs8.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkey.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkeyparam.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/pkeyutl.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/prime.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/rand.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/req.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/rsa.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/rsautl.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_cb.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_client.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_server.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_socket.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/s_time.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/sess_id.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/smime.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/speed.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/spkac.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/srp.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/ts.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/verify.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/version.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl-cli/deps/openssl/openssl/apps/x509.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a -Wl,--end-group -static -ldl -llog
/home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
/home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -llog
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: undefined reference to 'dlopen'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: undefined reference to 'dlsym'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: undefined reference to 'dlclose'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefined reference to 'dlsym'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefined reference to 'dlerror'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefined reference to 'dlsym'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefined reference to 'dlerror'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined reference to 'dlopen'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined reference to 'dlclose'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined reference to 'dlerror'
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/deps/openssl/libopenssl.a(/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/dso/dso_dlfcn.o):dso_dlfcn.c:function dlfcn_unload: error: undefined reference to 'dlclose'
collect2: error: ld returned 1 exit status
deps/openssl/openssl-cli.target.mk:195: recipe for target '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/openssl-cli' failed
make[1]: *** [/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/openssl-cli] Error 1
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
Makefile:68: recipe for target 'node' failed
make: *** [node] Error 2

This probably due to statically linked executable limitations, specifically:

it could not load compiled modules: some C libs like musl (and seems glibc too) either use a stripped-down version of the dlopen() function or dynamic loading functionality is stubbed out entirely (at least with musl 1.1.11) when included in statically linked executables, so loading of Node.js compiled modules could fail. Requiring pure Javascript modules will work as expected, though.


Compiled instead with --enable-static (and --without-inspector):

  rm -f /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/libnode.so.51 && /home/arnold/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ar crsT /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/libnode.so.51 /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/debug-agent.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/async-wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/env.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/fs_event_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/cares_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/connection_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/connect_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/handle_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/js_stream.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_buffer.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_config.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_constants.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_contextify.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_file.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_http_parser.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_javascript.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_os.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_revert.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_url.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_util.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_v8.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_stat_watcher.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_watchdog.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_zlib.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_i18n.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/pipe_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/signal_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/spawn_sync.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/string_bytes.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/stream_base.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/stream_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/tcp_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/timer_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/tty_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/process_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/udp_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/uv.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/util.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/string_search.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_crypto.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_crypto_bio.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/node_crypto_clienthello.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/tls_wrap.o /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node/src/backtrace_posix.o
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_dtrace_header.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_dtrace_provider.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_dtrace_ustack.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_etw.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/node_perfctr.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/specialize_node_d.stamp
  touch /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.host/v8_inspector_compress_protocol_json.stamp
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
ln -fs out/Release/node node
++ mkdir /home/arnold/Development/misc/dna2oslab/android/build/../node-v7.1.0/dist/bin
++ cp out/Release/mkpeephole /home/arnold/Development/misc/dna2oslab/android/build/../node-v7.1.0/dist/bin/v8_mkpeephole
++ make_install node-v7.1.0
++ make install
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
  LD_LIBRARY_PATH=/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/lib.host:/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/src; mkdir -p /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/v8_base/geni; echo "/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc"
/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out/Release/obj.target/v8_base/geni/bytecode-peephole-table.cc
make[1]: Leaving directory '/home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/out'
ln -fs out/Release/node node
/usr/bin/python tools/install.py install '' '/home/arnold/Development/misc/dna2oslab/android/build/../node-v7.1.0/dist/'
installing /home/arnold/Development/misc/dna2oslab/android/node-v7.1.0/dist/bin/libnode.so.51
Traceback (most recent call last):
  File "tools/install.py", line 212, in <module>
    run(sys.argv[:])
  File "tools/install.py", line 206, in run
    if cmd == 'install': return files(install)
  File "tools/install.py", line 127, in files
    action([output_prefix + output_file], 'bin/' + output_file)
  File "tools/install.py", line 75, in install
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 75, in <lambda>
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 67, in try_copy
    return shutil.copy2(source_path, target_path)
  File "/usr/lib/python2.7/shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: u'out/Release/lib.target/libnode.so.51'
Makefile:85: recipe for target 'install' failed
make: *** [install] Error 1
@irbull

This comment has been minimized.

Show comment
Hide comment
@irbull

irbull Aug 19, 2017

@aschrijver I have also created https://github.com/eclipsesource/static-node-build. I use that to build node for J2V8.

irbull commented Aug 19, 2017

@aschrijver I have also created https://github.com/eclipsesource/static-node-build. I use that to build node for J2V8.

@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Aug 20, 2017

Thanks @irbull I updated the link in the overview. 👍

aschrijver commented Aug 20, 2017

Thanks @irbull I updated the link in the overview. 👍

@orangemocha

This comment has been minimized.

Show comment
Hide comment
@orangemocha

orangemocha Nov 15, 2017

Member

@aschrijver did you try https://github.com/janeasystems/nodejs-mobile? It has ARM builds of Node v8.6.0.

Member

orangemocha commented Nov 15, 2017

@aschrijver did you try https://github.com/janeasystems/nodejs-mobile? It has ARM builds of Node v8.6.0.

@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Nov 17, 2017

@orangemocha thanks! I looked at the project, but it is a fork of chakra-core which is discontinued. I am looking into compiling the actual nodejs codebase for android.

And currently I can get working builds using the J2V8 project. It is quite nice, and has a very cool build script. This issue is still open for people with similar use cases to share experience..

aschrijver commented Nov 17, 2017

@orangemocha thanks! I looked at the project, but it is a fork of chakra-core which is discontinued. I am looking into compiling the actual nodejs codebase for android.

And currently I can get working builds using the J2V8 project. It is quite nice, and has a very cool build script. This issue is still open for people with similar use cases to share experience..

@orangemocha

This comment has been minimized.

Show comment
Hide comment
@orangemocha

orangemocha Nov 17, 2017

Member

@aschrijver :

https://github.com/nodejs/node-chakracore is definitely not discontinued (perhaps you meant JXcore?). It is actively maintained by Microsoft, and it's under the Node.js Foundation umbrella.

In any case, we are only using node-chakracore for iOS. For Android, we are using the Node.js codebase (which is passed through the node-chakracore fork without significant modifications). We are providing a build script and pre-built binaries for the armeabi-v7a, x86, arm64-v8a and x86_64 architectures.

Member

orangemocha commented Nov 17, 2017

@aschrijver :

https://github.com/nodejs/node-chakracore is definitely not discontinued (perhaps you meant JXcore?). It is actively maintained by Microsoft, and it's under the Node.js Foundation umbrella.

In any case, we are only using node-chakracore for iOS. For Android, we are using the Node.js codebase (which is passed through the node-chakracore fork without significant modifications). We are providing a build script and pre-built binaries for the armeabi-v7a, x86, arm64-v8a and x86_64 architectures.

@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Nov 17, 2017

you are absolutely correct. sorry for my confusion :)
i took a quick look and have the project tracked.. thx for the reference!

aschrijver commented Nov 17, 2017

you are absolutely correct. sorry for my confusion :)
i took a quick look and have the project tracked.. thx for the reference!

@xeoshow

This comment has been minimized.

Show comment
Hide comment
@xeoshow

xeoshow Aug 15, 2018

For the time as now, is there any new update regarding the nodejs official build for android platform?
Thanks!

xeoshow commented Aug 15, 2018

For the time as now, is there any new update regarding the nodejs official build for android platform?
Thanks!

@mhdawson

This comment has been minimized.

Show comment
Hide comment
@mhdawson

mhdawson Aug 23, 2018

Member

As far as I know we don't have a champion for this in the project so I don't think there is any progress. @rvagg can correct me if I'm wrong.

Member

mhdawson commented Aug 23, 2018

As far as I know we don't have a champion for this in the project so I don't think there is any progress. @rvagg can correct me if I'm wrong.

@kelp404

This comment has been minimized.

Show comment
Hide comment
@kelp404

kelp404 Sep 3, 2018

@aschrijver I build node.js for Android via https://github.com/sjitech/build-nodejs-for-android.
I can build node v8.x, but I can't build node v10.x.
I commit some patches, you can check this fork.
https://github.com/kelp404/node-in-android/releases

kelp404 commented Sep 3, 2018

@aschrijver I build node.js for Android via https://github.com/sjitech/build-nodejs-for-android.
I can build node v8.x, but I can't build node v10.x.
I commit some patches, you can check this fork.
https://github.com/kelp404/node-in-android/releases

@aschrijver

This comment has been minimized.

Show comment
Hide comment
@aschrijver

aschrijver Sep 3, 2018

Thank you! I added the successful build in the table at the top :)

aschrijver commented Sep 3, 2018

Thank you! I added the successful build in the table at the top :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment