package/nodejs/nodejs-src: nodejs v20.15.1 fail to build raspberrypi3 32bits with BR2_TIME_BITS_64=y
### Check-list
- [X] I can reproduce the issue on the latest commit of the branch I'm using:
- [X] master
- [X] stable (i.e. 20NN.MM.x - please specify)
- [X] LTS (i.e. 20NN.02.x - please specify)
What I did
-
Buildroot commit sha1: master
ddcddc47882fac09b895e1414bf97f8b7baea46e -
Distribution of the build machine:
Ubuntu 22.04.5 LTS
What happens
package/nodejs/nodejs-src: nodejs v20.15.1 fail to build raspberrypi3 32bits with BR2_TIME_BITS_64=y.
I enabled BR2_TIME_BITS_64 to prevent year 2038 bug.
$ make nodejs-src
[2/3000] CC obj/deps/v8/third_party/zlib/v8_zlib.gzclose.o
FAILED: obj/deps/v8/third_party/zlib/v8_zlib.gzclose.o
/home/user/projects/opensrc/github/buildroot-master/output/host/bin/arm-buildroot-linux-gnueabihf-gcc -MMD -MF obj/deps/v8/third_party/zlib/v8_zlib.gzclose.o.d -D_GLIBCXX_USE_CXX11_ABI=1 -DNODE_OPENSSL_CONF_NAME=nodejs_conf -DICU_NO_USER_DATA_OVERRIDE -DV8_GYP_BUILD -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -D__STDC_FORMAT_MACROS -DV8_TARGET_ARCH_ARM -DCAN_USE_ARMV7_INSTRUCTIONS -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_LINUX '-DV8_EMBEDDER_STRING="-node.23"' -DENABLE_DISASSEMBLER -DV8_PROMISE_INTERNAL_FIELD_COUNT=1 -DV8_ENABLE_PRIVATE_MAPPING_FORK_OPTIMIZATION -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_USE_ZLIB -DV8_ENABLE_TURBOFAN -DV8_ENABLE_WEBASSEMBLY -DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DZLIB_IMPLEMENTATION -I../../deps/v8 -I../../deps/v8/include -I../../deps/v8/third_party/zlib -I../../deps/v8/third_party/zlib/google -pthread -Wno-unused-parameter -Wno-return-type -flax-vector-conversions -fno-strict-aliasing -mfpu=vfp -mfloat-abi=hard -marm -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -c ../../deps/v8/third_party/zlib/gzclose.c -o obj/deps/v8/third_party/zlib/v8_zlib.gzclose.o
In file included from /home/user/projects/opensrc/github/buildroot-master/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/features.h:402,
from /home/user/projects/opensrc/github/buildroot-master/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/bits/libc-header-start.h:33,
from /home/user/projects/opensrc/github/buildroot-master/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/stdio.h:28,
from ../../deps/v8/third_party/zlib/gzguts.h:21,
from ../../deps/v8/third_party/zlib/gzclose.c:6:
/home/user/projects/opensrc/github/buildroot-master/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
| ^~~~~
- Attaching my patch. Fix: build issue when defined _TIME_BITS and _FILE_OFFSET_BITS.
- I am not sure why the original nodejs code
undef _FILE_OFFSET_BITS. - I only allow it to
undef _FILE_OFFSET_BITSif_TIME_BITSnot equal 64. - See
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64in gcc build - With this patch, I successfully build and run
nodejs-srcon raspberrypi3 with my required node modules.
diff --git a/deps/v8/third_party/zlib/gzguts.h b/deps/v8/third_party/zlib/gzguts.h
index 57faf371..76bcd229 100644
--- a/deps/v8/third_party/zlib/gzguts.h
+++ b/deps/v8/third_party/zlib/gzguts.h
@@ -7,8 +7,10 @@
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
-# ifdef _FILE_OFFSET_BITS
-# undef _FILE_OFFSET_BITS
+# if defined (_TIME_BITS) && (_TIME_BITS != 64)
+# ifdef _FILE_OFFSET_BITS
+# undef _FILE_OFFSET_BITS
+# endif
# endif
#endif
What was expected
Successfully build nodejs-src v20.15.1 when BR2_TIME_BITS_64=y