nodejs-mobile / nodejs-mobile

Full-fledged Node.js on Android and iOS
https://nodejs-mobile.github.io
Other
458 stars 44 forks source link

Issue building for Android #57

Open tritao opened 6 months ago

tritao commented 6 months ago

Version

No response

Platform

Linux GCC11

Subsystem

No response

What steps will reproduce the bug?

When trying to build with: ./tools/android_build.sh ~/Android/android-ndk-r26b/ 24 arm

Which eventually does this:

export GYP_DEFINES="target_arch=arm v8_target_arch=arm android_target_arch=arm host_os=linux OS=android ANDROID_NDK_ROOT=/home/joao/Android/android-ndk-r26b ANDROID_NDK_SYSROOT=/home/joao/Android/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot"
./configure --dest-cpu=arm --dest-os=android --openssl-no-asm --with-intl=none --cross-compiling --shared

And then I am getting:

make[1]: *** [tools/v8_gypfiles/v8_libplatform.host.mk:154: /home/joao/dev/runtimes/nodejs-mobile/out/Release/obj.host/v8_libplatform/deps/v8/src/libplatform/default-foreground-task-runner.o] Error 1
make[1]: *** Waiting for unfinished jobs....
  /usr/bin/g++ -o /home/joao/dev/runtimes/nodejs-mobile/out/Release/obj.host/v8_libplatform/deps/v8/src/libplatform/delayed-task-queue.o ../deps/v8/src/libplatform/delayed-task-queue.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DICU_NO_USER_DATA_OVERRIDE' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DCAN_USE_VFP3_INSTRUCTIONS' '-DCAN_USE_VFP32DREGS' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_ANDROID' '-DV8_EMBEDDER_STRING="-node.26"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DOBJECT_PRINT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DV8_SHARED_RO_HEAP' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_SCRIPTORMODULE_LEGACY_LIFETIME' '-DV8_ADVANCED_BIGINT_ALGORITHMS' '-DUSE_EABI_HARDFLOAT=0' -I../deps/v8 -I../deps/v8/include  -Wno-unused-parameter -fPIC -Wno-return-type -m32 -fno-omit-frame-pointer -fPIC -fdata-sections -ffunction-sections -O2 -fno-rtti -fno-exceptions -std=gnu++17 -MMD -MF /home/joao/dev/runtimes/nodejs-mobile/out/Release/.deps//home/joao/dev/runtimes/nodejs-mobile/out/Release/obj.host/v8_libplatform/deps/v8/src/libplatform/delayed-task-queue.o.d.raw   -c
In file included from /usr/include/c++/11/atomic:41,
                 from ../deps/v8/src/libplatform/default-job.h:8,
                 from ../deps/v8/src/libplatform/default-job.cc:5:
/usr/include/c++/11/bits/atomic_base.h:35:10: fatal error: bits/c++config.h: No such file or directory
   35 | #include <bits/c++config.h>

Based on the error, it looks like its trying to build the Android build with the host compiler, which seems wrong.

There seems to have been a similar issue here https://github.com/nodejs/build/issues/1113.

Anyone knows what's up?

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

No response

What do you see instead?

Compilation should work

tritao commented 6 months ago

Found a couple more issues, will be sending a PR shorly with some fixes.