diff mbox series

[04/13] nodejs: fix 'Duplicate v8 target errors when cross-compiling' error

Message ID 20220809075704.86472-5-ardeleanalex@gmail.com
State Accepted
Headers show
Series package/nodejs: rework cross-building | expand

Commit Message

Alexandru Ardelean Aug. 9, 2022, 7:56 a.m. UTC
Reported also via:
  https://github.com/nodejs/node/issues/37441

Patched in:
  https://github.com/minrk/node/commit/5e533cb943eef68b270f55f0cba02c0ec67c699d

The error is:
```
>>> nodejs 16.15.0 Building
PATH="<buildroot>/output/host/bin:<buildroot>/output/host/sbin:/home/aardelean/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" PYTHON=<buildroot>/output/host/bin/python3 /usr/bin/make  -C <buildroot>/output/build/nodejs-16.15.0 PATH="<buildroot>/output/host/bin:<buildroot>/output/host/sbin:/home/aardelean/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" AR="<buildroot>/output/host/bin/aarch64-none-linux-gnu-gcc-ar" AS="<buildroot>/output/host/bin/aarch64-none-linux-gnu-as" LD="<buildroot>/output/host/bin/aarch64-none-linux-gnu-ld" NM="<buildroot>/output/host/bin/aarch64-none-linux-gnu-gcc-nm" CC="<buildroot>/output/host/bin/aarch64-none-linux-gnu-gcc" GCC="<buildroot>/output/host/bin/aarch64-none-linux-gnu-gcc" CPP="<buildroot>/output/host/bin/aarch64-none-linux-gnu-cpp" CXX="<buildroot>/output/host/bin/aarch64-none-linux-gnu-g++" FC="<buildroot>/output/h
 ost/bin/aarch64-none-linux-gnu-gfortran" F77="<buildroot>/output/host/bin/aarch64-none-linux-gnu-gfortran" RANLIB="<buildroot>/output/host/bin/aarch64-none-linux-gnu-gcc-ranlib" READELF="<buildroot>/output/host/bin/aarch64-none-linux-gnu-readelf" STRIP="<buildroot>/output/host/bin/aarch64-none-linux-gnu-strip" OBJCOPY="<buildroot>/output/host/bin/aarch64-none-linux-gnu-objcopy" OBJDUMP="<buildroot>/output/host/bin/aarch64-none-linux-gnu-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="<buildroot>/output/host/bin/ccache /usr/bin/gcc" GCC_FOR_BUILD="<buildroot>/output/host/bin/ccache /usr/bin/gcc" CXX_FOR_BUILD="<buildroot>/output/host/bin/ccache /usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I<buildroot>/output/host/include" CFLAGS_FOR_BUILD="-O2 -I<buildroot>/output/host/include" CXXFLAGS_FOR_BUILD="-O2 -I<buildroot>/output/host/include" LDFLAGS_FOR_BUILD="-L<buildroot>/output/host/lib -Wl,-rpath,<buildroot>/output/host/lib" FCFLAGS_FOR_BUI
 LD="" DEFAULT_ASSEMBLER="<buildroot>/output/host/bin/aarch64-none-linux-gnu-as" DEFAULT_LINKER="<buildroot>/output/host/bin/aarch64-none-linux-gnu-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1" LDFLAGS="" FCFLAGS=" -Os -g0" FFLAGS=" -Os -g0" PKG_CONFIG="<buildroot>/output/host/bin/pkg-config" STAGING_DIR="<buildroot>/output/host/aarch64-buildroot-linux-gnu/sysroot" INTLTOOL_PERL=/usr/bin/perl NO_LOAD=cctest.target.mk PATH=<buildroot>/output/build/nodejs-16.15.0/bin:"<buildroot>/output/host/bin:<buildroot>/output/host/sbin:/home/aardelean/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" LDFLAGS=" -latomic" LD="<buildroot>/output/host/bin/aarch64-none-linux-gnu-g++"
ninja -C out/Release
ninja: Entering directory `out/Release'
ninja: error: obj.host/tools/v8_gypfiles/run_torque.ninja:1356: multiple rules generate gen/torque-generated/bit-fields.h [-w dupbuild=err]

make[2]: *** [Makefile:127: node] Error 1
make[1]: *** [package/pkg-generic.mk:293: <buildroot>/output/build/nodejs-16.15.0/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2

```

Maybe it's not the final patch, but it's good enough to get us going.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
---
 ...lude-obj-name-in-shared-intermediate.patch | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 package/nodejs/0002-include-obj-name-in-shared-intermediate.patch
diff mbox series

Patch

diff --git a/package/nodejs/0002-include-obj-name-in-shared-intermediate.patch b/package/nodejs/0002-include-obj-name-in-shared-intermediate.patch
new file mode 100644
index 0000000000..6628499362
--- /dev/null
+++ b/package/nodejs/0002-include-obj-name-in-shared-intermediate.patch
@@ -0,0 +1,24 @@ 
+--- a/tools/gyp/pylib/gyp/generator/ninja.py	2022-04-27 01:03:31.000000000 +0300
++++ b/tools/gyp/pylib/gyp/generator/ninja.py	2022-07-13 10:20:33.573771172 +0300
+@@ -42,7 +42,7 @@
+     # the start of a string, while $| is used for variables that can appear
+     # anywhere in a string.
+     "INTERMEDIATE_DIR": "$!INTERMEDIATE_DIR",
+-    "SHARED_INTERMEDIATE_DIR": "$!PRODUCT_DIR/gen",
++    "SHARED_INTERMEDIATE_DIR": "$!PRODUCT_DIR/$|OBJ/gen",
+     "PRODUCT_DIR": "$!PRODUCT_DIR",
+     "CONFIGURATION_NAME": "$|CONFIGURATION_NAME",
+     # Special variables that may be used by gyp 'rule' targets.
+@@ -285,6 +285,12 @@
+         CONFIGURATION_NAME = "$|CONFIGURATION_NAME"
+         path = path.replace(CONFIGURATION_NAME, self.config_name)
+ 
++        obj = "obj"
++        if self.toolset != "target":
++            obj += "." + self.toolset
++
++        path = path.replace("$|OBJ", obj)
++
+         return path
+ 
+     def ExpandRuleVariables(self, path, root, dirname, source, ext, name):