All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH 1/5] nodejs: ensure to use correct compiler & flags always
@ 2019-11-10 22:05 André Draszik
  2019-11-10 22:05 ` [meta-oe][PATCH 2/5] nodejs: delete all bundled deps in do_unpack() if needed André Draszik
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: André Draszik @ 2019-11-10 22:05 UTC (permalink / raw)
  To: openembedded-devel

NodeJS comes with an embedded, patched, version of gyp.

Normally, gyp supports compiling for the build machine, e.g.
native tools that need to be compiled to run during the build,
and for the host, using different variables, e.g. CC and
CC.host, etc.
Most of this has been patched out in the NodeJS version of gyp,
and essentially it only supports compiling using one compiler -
${CC}. This modification excludes LDFLAGS for native tools, and
those still evaluate LDFLAGS.host (only).

While this modified behaviour is OK for the OE use-case of building
native and target tools separately, it means that this recipe can
not work as-is with standard gyp, and wrong LDFLAGS are being used
for some of the tools compiled (torque) in either case.

By setting the make variables that gyp-generated makefiles inspect,
we support use of unpatched gyp, and we ensure that all tools
are compiled with correct LDFLAGS in either case.

This now also allows us to drop the patch that had been applied to
work-around this problem.

Signed-off-by: André Draszik <git@andred.net>
---
 .../nodejs/0006-Use-target-ldflags.patch      | 24 -------------------
 .../recipes-devtools/nodejs/nodejs_10.17.0.bb | 13 +++++++++-
 2 files changed, 12 insertions(+), 25 deletions(-)
 delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
deleted file mode 100644
index f6569cd57..000000000
--- a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-The target LDFLAGS have been ignored. Tools like torque
-have been loaded from system libraries, even if a native
-one was the target.
-|$ ldd torque 
-|    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1
-|    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
-|    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
-|    libicui18n.so.63 => not found
-|    libicuuc.so.63 => not found
-...
-
-Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
-
-diff -Naur node-v10.15.1/deps/v8/gypfiles/toolchain.gypi node-v10.15.1/deps/v8/gypfiles/toolchain.gypi
---- node-v10.15.1/deps/v8/gypfiles/toolchain.gypi	2019-03-18 15:01:39.000000000 +0100
-+++ node-v10.15.1/deps/v8/gypfiles/toolchain.gypi	2019-03-18 15:04:08.628361308 +0100
-@@ -1106,6 +1106,7 @@
-             'cflags': [ '-fno-strict-aliasing' ],
-           }],
-         ],  # conditions
-+        'ldflags+': [ '$(LDFLAGS)' ],
-       }],
-       ['OS=="solaris"', {
-         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
index 4013c6931..9c514e6be 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
@@ -19,7 +19,6 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
            file://0004-Make-compatibility-with-gcc-4.8.patch \
            file://0005-Link-atomic-library.patch \
-           file://0006-Use-target-ldflags.patch \
            "
 SRC_URI_append_class-target = " \
            file://0002-Using-native-torque.patch \
@@ -58,6 +57,18 @@ PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
 PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
 PACKAGECONFIG[zlib] = "--shared-zlib,,zlib"
 
+# We don't want to cross-compile during target compile,
+# and we need to use the right flags during host compile,
+# too.
+EXTRA_OEMAKE_append = "\
+    CC.host='${CC}' \
+    CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \
+    CXX.host='${CXX}' \
+    CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \
+    LDFLAGS.host='${LDFLAGS}' \
+    AR.host='${AR}' \
+"
+
 # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
 do_configure () {
     rm -rf ${S}/deps/openssl
-- 
2.23.0.rc1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [meta-oe][PATCH 2/5] nodejs: delete all bundled deps in do_unpack() if needed
  2019-11-10 22:05 [meta-oe][PATCH 1/5] nodejs: ensure to use correct compiler & flags always André Draszik
@ 2019-11-10 22:05 ` André Draszik
  2019-11-10 22:05 ` [meta-oe][PATCH 3/5] nodejs: allow use of system gyp André Draszik
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: André Draszik @ 2019-11-10 22:05 UTC (permalink / raw)
  To: openembedded-devel

We can delete bundled deps where system-provided counterparts
should be used instead.
Amongst others, this ensures they are not used accidentally.

Signed-off-by: André Draszik <git@andred.net>
---
 .../recipes-devtools/nodejs/nodejs_10.17.0.bb   | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
index 9c514e6be..53149af5e 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
@@ -69,9 +69,24 @@ EXTRA_OEMAKE_append = "\
     AR.host='${AR}' \
 "
 
+python do_unpack() {
+    import shutil
+
+    bb.build.exec_func('base_do_unpack', d)
+
+    shutil.rmtree(d.getVar('S') + '/deps/openssl', True)
+    if 'ares' in d.getVar('PACKAGECONFIG'):
+        shutil.rmtree(d.getVar('S') + '/deps/cares', True)
+    if 'libuv' in d.getVar('PACKAGECONFIG'):
+        shutil.rmtree(d.getVar('S') + '/deps/uv', True)
+    if 'nghttp2' in d.getVar('PACKAGECONFIG'):
+        shutil.rmtree(d.getVar('S') + '/deps/nghttp2', True)
+    if 'zlib' in d.getVar('PACKAGECONFIG'):
+        shutil.rmtree(d.getVar('S') + '/deps/zlib', True)
+}
+
 # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
 do_configure () {
-    rm -rf ${S}/deps/openssl
     export LD="${CXX}"
     GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
     # $TARGET_ARCH settings don't match --dest-cpu settings
-- 
2.23.0.rc1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [meta-oe][PATCH 3/5] nodejs: allow use of system gyp
  2019-11-10 22:05 [meta-oe][PATCH 1/5] nodejs: ensure to use correct compiler & flags always André Draszik
  2019-11-10 22:05 ` [meta-oe][PATCH 2/5] nodejs: delete all bundled deps in do_unpack() if needed André Draszik
@ 2019-11-10 22:05 ` André Draszik
  2019-11-10 22:05 ` [meta-oe][PATCH 4/5] nodejs: use OE-provided compiler flags (arm) André Draszik
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: André Draszik @ 2019-11-10 22:05 UTC (permalink / raw)
  To: openembedded-devel

Now that there is a gyp (python2) recipe in meta-python,
allow its use instead of the bundled one for when
meta-python is enabled.

At the same time, unconditionally inherit pythonnative
as in either case gyp actually uses python, and the
build machine's python and installed modules should
never be used.

Signed-off-by: André Draszik <git@andred.net>
---
 meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
index 53149af5e..7c3728cc6 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=be980eb7ccafe287cb438076a65e888c"
 DEPENDS = "openssl"
 DEPENDS_append_class-target = " nodejs-native"
 
-inherit pkgconfig
+inherit pkgconfig pythonnative
 
 COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*"
 COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*"
@@ -52,6 +52,7 @@ ARCHFLAGS ?= ""
 
 PACKAGECONFIG ??= "ares icu libuv zlib"
 PACKAGECONFIG[ares] = "--shared-cares,,c-ares"
+PACKAGECONFIG[gyp] = ",,gyp-py2-native"
 PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu"
 PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
 PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
@@ -77,6 +78,8 @@ python do_unpack() {
     shutil.rmtree(d.getVar('S') + '/deps/openssl', True)
     if 'ares' in d.getVar('PACKAGECONFIG'):
         shutil.rmtree(d.getVar('S') + '/deps/cares', True)
+    if 'gyp' in d.getVar('PACKAGECONFIG'):
+        shutil.rmtree(d.getVar('S') + '/tools/gyp', True)
     if 'libuv' in d.getVar('PACKAGECONFIG'):
         shutil.rmtree(d.getVar('S') + '/deps/uv', True)
     if 'nghttp2' in d.getVar('PACKAGECONFIG'):
-- 
2.23.0.rc1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [meta-oe][PATCH 4/5] nodejs: use OE-provided compiler flags (arm)
  2019-11-10 22:05 [meta-oe][PATCH 1/5] nodejs: ensure to use correct compiler & flags always André Draszik
  2019-11-10 22:05 ` [meta-oe][PATCH 2/5] nodejs: delete all bundled deps in do_unpack() if needed André Draszik
  2019-11-10 22:05 ` [meta-oe][PATCH 3/5] nodejs: allow use of system gyp André Draszik
@ 2019-11-10 22:05 ` André Draszik
  2019-11-10 22:05 ` [meta-oe][PATCH 5/5] nodejs: support long directory names for ${B} / ${S} André Draszik
  2019-11-13  9:58 ` [meta-oe][PATCH] nodejs: ensure to use correct compiler & flags always André Draszik
  4 siblings, 0 replies; 8+ messages in thread
From: André Draszik @ 2019-11-10 22:05 UTC (permalink / raw)
  To: openembedded-devel

This overrides yocto-provided build flags with its own, e.g we get
    arm-poky-linux-musleabi-g++  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 \
                                 ... \
                                  -march=armv7-a -mfpu=neon -mfloat-abi=hard -marm

Causing the latter to override the former, and compiler warnings:
    cc1plus: warning: switch '-mcpu=cortex-a7' conflicts with '-march=armv7-a' switch

Patch this out, so that yocto-provided flags take precedence.
Note that in reality the same should probably be done for all the other
supported architectures, too.

Note that this also switches to Thumb(2) mode (in my case). No obvious
problems have been noted during compilation or runtime.

Upstream-Status: Inappropriate [oe-specific]
Signed-off-by: André Draszik <git@andred.net>
---
 .../0007-v8-don-t-override-ARM-CFLAGS.patch   | 102 ++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_10.17.0.bb |   1 +
 2 files changed, 103 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0007-v8-don-t-override-ARM-CFLAGS.patch

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0007-v8-don-t-override-ARM-CFLAGS.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0007-v8-don-t-override-ARM-CFLAGS.patch
new file mode 100644
index 000000000..eb2cbfb8b
--- /dev/null
+++ b/meta-oe/recipes-devtools/nodejs/nodejs/0007-v8-don-t-override-ARM-CFLAGS.patch
@@ -0,0 +1,102 @@
+From 47ee5cc5501289205d3e8e9f27ea9daf18cebac1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net>
+Date: Sat, 9 Nov 2019 14:45:30 +0000
+Subject: [PATCH] v8: don't override ARM CFLAGS
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This overrides yocto-provided build flags with its own, e.g we get
+    arm-poky-linux-musleabi-g++  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 \
+                                 ... \
+                                  -march=armv7-a -mfpu=neon -mfloat-abi=hard -marm
+
+Causing the latter to override the former, and compiler warnings:
+    cc1plus: warning: switch '-mcpu=cortex-a7' conflicts with '-march=armv7-a' switch
+
+Patch this out, so that yocto-provided flags take precedence.
+Note that in reality the same should probably be done for all the other
+supported architectures, too.
+
+Note that this also switches to Thumb(2) mode (in my case). No obvious
+problems have been noted during compilation or runtime.
+
+Upstream-Status: Inappropriate [oe-specific]
+Signed-off-by: André Draszik <git@andred.net>
+---
+ deps/v8/gypfiles/toolchain.gypi | 52 ++-------------------------------
+ 1 file changed, 2 insertions(+), 50 deletions(-)
+
+diff --git a/deps/v8/gypfiles/toolchain.gypi b/deps/v8/gypfiles/toolchain.gypi
+index 910a212..1390b15 100644
+--- a/deps/v8/gypfiles/toolchain.gypi
++++ b/deps/v8/gypfiles/toolchain.gypi
+@@ -199,31 +199,7 @@
+         'target_conditions': [
+           ['_toolset=="host"', {
+             'conditions': [
+-              ['v8_target_arch==host_arch', {
+-                # Host built with an Arm CXX compiler.
+-                'conditions': [
+-                  [ 'arm_version==7', {
+-                    'cflags': ['-march=armv7-a',],
+-                  }],
+-                  [ 'arm_version==7 or arm_version=="default"', {
+-                    'conditions': [
+-                      [ 'arm_fpu!="default"', {
+-                        'cflags': ['-mfpu=<(arm_fpu)',],
+-                      }],
+-                    ],
+-                  }],
+-                  [ 'arm_float_abi!="default"', {
+-                    'cflags': ['-mfloat-abi=<(arm_float_abi)',],
+-                  }],
+-                  [ 'arm_thumb==1', {
+-                    'cflags': ['-mthumb',],
+-                  }],
+-                  [ 'arm_thumb==0', {
+-                    'cflags': ['-marm',],
+-                  }],
+-                ],
+-              }, {
+-                # 'v8_target_arch!=host_arch'
++              ['v8_target_arch!=host_arch', {
+                 # Host not built with an Arm CXX compiler (simulator build).
+                 'conditions': [
+                   [ 'arm_float_abi=="hard"', {
+@@ -242,31 +218,7 @@
+           }],  # _toolset=="host"
+           ['_toolset=="target"', {
+             'conditions': [
+-              ['v8_target_arch==target_arch', {
+-                # Target built with an Arm CXX compiler.
+-                'conditions': [
+-                  [ 'arm_version==7', {
+-                    'cflags': ['-march=armv7-a',],
+-                  }],
+-                  [ 'arm_version==7 or arm_version=="default"', {
+-                    'conditions': [
+-                      [ 'arm_fpu!="default"', {
+-                        'cflags': ['-mfpu=<(arm_fpu)',],
+-                      }],
+-                    ],
+-                  }],
+-                  [ 'arm_float_abi!="default"', {
+-                    'cflags': ['-mfloat-abi=<(arm_float_abi)',],
+-                  }],
+-                  [ 'arm_thumb==1', {
+-                    'cflags': ['-mthumb',],
+-                  }],
+-                  [ 'arm_thumb==0', {
+-                    'cflags': ['-marm',],
+-                  }],
+-                ],
+-              }, {
+-                # 'v8_target_arch!=target_arch'
++              ['v8_target_arch!=target_arch', {
+                 # Target not built with an Arm CXX compiler (simulator build).
+                 'conditions': [
+                   [ 'arm_float_abi=="hard"', {
+-- 
+2.23.0.rc1
+
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
index 7c3728cc6..b189d2247 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
@@ -19,6 +19,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
            file://0004-Make-compatibility-with-gcc-4.8.patch \
            file://0005-Link-atomic-library.patch \
+           file://0007-v8-don-t-override-ARM-CFLAGS.patch \
            "
 SRC_URI_append_class-target = " \
            file://0002-Using-native-torque.patch \
-- 
2.23.0.rc1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [meta-oe][PATCH 5/5] nodejs: support long directory names for ${B} / ${S}
  2019-11-10 22:05 [meta-oe][PATCH 1/5] nodejs: ensure to use correct compiler & flags always André Draszik
                   ` (2 preceding siblings ...)
  2019-11-10 22:05 ` [meta-oe][PATCH 4/5] nodejs: use OE-provided compiler flags (arm) André Draszik
@ 2019-11-10 22:05 ` André Draszik
  2019-11-13  9:58 ` [meta-oe][PATCH] nodejs: ensure to use correct compiler & flags always André Draszik
  4 siblings, 0 replies; 8+ messages in thread
From: André Draszik @ 2019-11-10 22:05 UTC (permalink / raw)
  To: openembedded-devel

Part of the NodeJS build builds V8, which at some stage tries to call
ar with all objects with *absolute* paths (and printf the command line
first).

This will fail if the build path is too long:
    make[1]: execvp: printf: Argument list too long
when trying to create Release/obj.target/deps/v8/gypfiles/libv8_base.a
via below gyp-generated out/Makefile rule:
    cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
i.e. something like
    printf rm -f Release/obj.target/deps/v8/gypfiles/libv8_base.a && arm-poky-linux-musleabi-gcc-ar crsT Release/obj.target/deps/v8/gypfiles/libv8_base.a ...

The above failure happened on a build-directory S with 204 characters
on a Jenkins machine.

While one could probably increase the ulimit on that specific machine,
that would be a pretty specific build machine fix which would need to
be applied everywhere, or switch to non-verbose builds / compilation,
but fortunately we can change all object references to be relative to
the build directory itself by setting the builddir_name make variable
and thus avoid the other two possible work-arounds.

Signed-off-by: André Draszik <git@andred.net>
---
 meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
index b189d2247..205e24889 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
@@ -69,6 +69,8 @@ EXTRA_OEMAKE_append = "\
     CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \
     LDFLAGS.host='${LDFLAGS}' \
     AR.host='${AR}' \
+    \
+    builddir_name=./ \
 "
 
 python do_unpack() {
-- 
2.23.0.rc1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [meta-oe][PATCH] nodejs: ensure to use correct compiler & flags always
  2019-11-10 22:05 [meta-oe][PATCH 1/5] nodejs: ensure to use correct compiler & flags always André Draszik
                   ` (3 preceding siblings ...)
  2019-11-10 22:05 ` [meta-oe][PATCH 5/5] nodejs: support long directory names for ${B} / ${S} André Draszik
@ 2019-11-13  9:58 ` André Draszik
  2019-11-13 12:19   ` André Draszik
  4 siblings, 1 reply; 8+ messages in thread
From: André Draszik @ 2019-11-13  9:58 UTC (permalink / raw)
  To: openembedded-devel

NodeJS comes with an embedded, patched, version of gyp.

Normally, gyp supports compiling for the build machine, e.g.
native tools that need to be compiled to run during the build,
and for the host, using different variables, e.g. CC and
CC.host, etc.
Most of this has been patched out in the NodeJS version of gyp,
and essentially it only supports compiling using one compiler -
${CC}. This modification excludes LDFLAGS for native tools, and
those still evaluate LDFLAGS.host (only).

While this modified behaviour is OK for the OE use-case of building
native and target tools separately, it means that this recipe can
not work as-is with standard gyp, and wrong LDFLAGS are being used
for some of the tools compiled (torque) in either case.

By setting the make variables that gyp-generated makefiles inspect,
we support use of unpatched gyp, and we ensure that all tools
are compiled with correct LDFLAGS in either case.

This now also allows us to drop the patch that had been applied to
work-around this problem.

Signed-off-by: André Draszik <git@andred.net>

---
v2: _append not needed for EXTRA_OEMAKE
---
 .../nodejs/0006-Use-target-ldflags.patch      | 24 -------------------
 .../recipes-devtools/nodejs/nodejs_10.17.0.bb | 13 +++++++++-
 2 files changed, 12 insertions(+), 25 deletions(-)
 delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch

diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch b/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
deleted file mode 100644
index f6569cd57..000000000
--- a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-The target LDFLAGS have been ignored. Tools like torque
-have been loaded from system libraries, even if a native
-one was the target.
-|$ ldd torque 
-|    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1
-|    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
-|    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
-|    libicui18n.so.63 => not found
-|    libicuuc.so.63 => not found
-...
-
-Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
-
-diff -Naur node-v10.15.1/deps/v8/gypfiles/toolchain.gypi node-v10.15.1/deps/v8/gypfiles/toolchain.gypi
---- node-v10.15.1/deps/v8/gypfiles/toolchain.gypi	2019-03-18 15:01:39.000000000 +0100
-+++ node-v10.15.1/deps/v8/gypfiles/toolchain.gypi	2019-03-18 15:04:08.628361308 +0100
-@@ -1106,6 +1106,7 @@
-             'cflags': [ '-fno-strict-aliasing' ],
-           }],
-         ],  # conditions
-+        'ldflags+': [ '$(LDFLAGS)' ],
-       }],
-       ['OS=="solaris"', {
-         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
index 4013c6931..9af0d998c 100644
--- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
+++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
@@ -19,7 +19,6 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
            file://0004-Make-compatibility-with-gcc-4.8.patch \
            file://0005-Link-atomic-library.patch \
-           file://0006-Use-target-ldflags.patch \
            "
 SRC_URI_append_class-target = " \
            file://0002-Using-native-torque.patch \
@@ -58,6 +57,18 @@ PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
 PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
 PACKAGECONFIG[zlib] = "--shared-zlib,,zlib"
 
+# We don't want to cross-compile during target compile,
+# and we need to use the right flags during host compile,
+# too.
+EXTRA_OEMAKE = "\
+    CC.host='${CC}' \
+    CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \
+    CXX.host='${CXX}' \
+    CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \
+    LDFLAGS.host='${LDFLAGS}' \
+    AR.host='${AR}' \
+"
+
 # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
 do_configure () {
     rm -rf ${S}/deps/openssl
-- 
2.23.0.rc1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [meta-oe][PATCH] nodejs: ensure to use correct compiler & flags always
  2019-11-13  9:58 ` [meta-oe][PATCH] nodejs: ensure to use correct compiler & flags always André Draszik
@ 2019-11-13 12:19   ` André Draszik
  2019-11-13 16:12     ` Khem Raj
  0 siblings, 1 reply; 8+ messages in thread
From: André Draszik @ 2019-11-13 12:19 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-devel

Khem,

This is a rev2, as v1 is still in master-next, only.
I forgot to set the subject line right...

Cheers,
Andre'

On Wed, 2019-11-13 at 09:58 +0000, André Draszik wrote:
> NodeJS comes with an embedded, patched, version of gyp.
> 
> Normally, gyp supports compiling for the build machine, e.g.
> native tools that need to be compiled to run during the build,
> and for the host, using different variables, e.g. CC and
> CC.host, etc.
> Most of this has been patched out in the NodeJS version of gyp,
> and essentially it only supports compiling using one compiler -
> ${CC}. This modification excludes LDFLAGS for native tools, and
> those still evaluate LDFLAGS.host (only).
> 
> While this modified behaviour is OK for the OE use-case of building
> native and target tools separately, it means that this recipe can
> not work as-is with standard gyp, and wrong LDFLAGS are being used
> for some of the tools compiled (torque) in either case.
> 
> By setting the make variables that gyp-generated makefiles inspect,
> we support use of unpatched gyp, and we ensure that all tools
> are compiled with correct LDFLAGS in either case.
> 
> This now also allows us to drop the patch that had been applied to
> work-around this problem.
> 
> Signed-off-by: André Draszik <git@andred.net>
> 
> ---
> v2: _append not needed for EXTRA_OEMAKE
> ---
>  .../nodejs/0006-Use-target-ldflags.patch      | 24 -------------------
>  .../recipes-devtools/nodejs/nodejs_10.17.0.bb | 13 +++++++++-
>  2 files changed, 12 insertions(+), 25 deletions(-)
>  delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
> 
> diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch b/meta-oe/recipes-
> devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
> deleted file mode 100644
> index f6569cd57..000000000
> --- a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -The target LDFLAGS have been ignored. Tools like torque
> -have been loaded from system libraries, even if a native
> -one was the target.
> -|$ ldd torque 
> -|    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1
> -|    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
> -|    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
> -|    libicui18n.so.63 => not found
> -|    libicuuc.so.63 => not found
> -...
> -
> -Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
> -
> -diff -Naur node-v10.15.1/deps/v8/gypfiles/toolchain.gypi node-v10.15.1/deps/v8/gypfiles/toolchain.gypi
> ---- node-v10.15.1/deps/v8/gypfiles/toolchain.gypi	2019-03-18 15:01:39.000000000 +0100
> -+++ node-v10.15.1/deps/v8/gypfiles/toolchain.gypi	2019-03-18 15:04:08.628361308 +0100
> -@@ -1106,6 +1106,7 @@
> -             'cflags': [ '-fno-strict-aliasing' ],
> -           }],
> -         ],  # conditions
> -+        'ldflags+': [ '$(LDFLAGS)' ],
> -       }],
> -       ['OS=="solaris"', {
> -         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
> diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
> index 4013c6931..9af0d998c 100644
> --- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
> +++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
> @@ -19,7 +19,6 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
>             file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
>             file://0004-Make-compatibility-with-gcc-4.8.patch \
>             file://0005-Link-atomic-library.patch \
> -           file://0006-Use-target-ldflags.patch \
>             "
>  SRC_URI_append_class-target = " \
>             file://0002-Using-native-torque.patch \
> @@ -58,6 +57,18 @@ PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
>  PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
>  PACKAGECONFIG[zlib] = "--shared-zlib,,zlib"
>  
> +# We don't want to cross-compile during target compile,
> +# and we need to use the right flags during host compile,
> +# too.
> +EXTRA_OEMAKE = "\
> +    CC.host='${CC}' \
> +    CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \
> +    CXX.host='${CXX}' \
> +    CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \
> +    LDFLAGS.host='${LDFLAGS}' \
> +    AR.host='${AR}' \
> +"
> +
>  # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to
> workaround gypi
>  do_configure () {
>      rm -rf ${S}/deps/openssl



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [meta-oe][PATCH] nodejs: ensure to use correct compiler & flags always
  2019-11-13 12:19   ` André Draszik
@ 2019-11-13 16:12     ` Khem Raj
  0 siblings, 0 replies; 8+ messages in thread
From: Khem Raj @ 2019-11-13 16:12 UTC (permalink / raw)
  To: André Draszik; +Cc: openembeded-devel

On Wed, Nov 13, 2019 at 4:19 AM André Draszik <git@andred.net> wrote:
>
> Khem,
>
> This is a rev2, as v1 is still in master-next, only.
> I forgot to set the subject line right...
>

thanks for letting me know

> Cheers,
> Andre'
>
> On Wed, 2019-11-13 at 09:58 +0000, André Draszik wrote:
> > NodeJS comes with an embedded, patched, version of gyp.
> >
> > Normally, gyp supports compiling for the build machine, e.g.
> > native tools that need to be compiled to run during the build,
> > and for the host, using different variables, e.g. CC and
> > CC.host, etc.
> > Most of this has been patched out in the NodeJS version of gyp,
> > and essentially it only supports compiling using one compiler -
> > ${CC}. This modification excludes LDFLAGS for native tools, and
> > those still evaluate LDFLAGS.host (only).
> >
> > While this modified behaviour is OK for the OE use-case of building
> > native and target tools separately, it means that this recipe can
> > not work as-is with standard gyp, and wrong LDFLAGS are being used
> > for some of the tools compiled (torque) in either case.
> >
> > By setting the make variables that gyp-generated makefiles inspect,
> > we support use of unpatched gyp, and we ensure that all tools
> > are compiled with correct LDFLAGS in either case.
> >
> > This now also allows us to drop the patch that had been applied to
> > work-around this problem.
> >
> > Signed-off-by: André Draszik <git@andred.net>
> >
> > ---
> > v2: _append not needed for EXTRA_OEMAKE
> > ---
> >  .../nodejs/0006-Use-target-ldflags.patch      | 24 -------------------
> >  .../recipes-devtools/nodejs/nodejs_10.17.0.bb | 13 +++++++++-
> >  2 files changed, 12 insertions(+), 25 deletions(-)
> >  delete mode 100644 meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
> >
> > diff --git a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch b/meta-oe/recipes-
> > devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
> > deleted file mode 100644
> > index f6569cd57..000000000
> > --- a/meta-oe/recipes-devtools/nodejs/nodejs/0006-Use-target-ldflags.patch
> > +++ /dev/null
> > @@ -1,24 +0,0 @@
> > -The target LDFLAGS have been ignored. Tools like torque
> > -have been loaded from system libraries, even if a native
> > -one was the target.
> > -|$ ldd torque
> > -|    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1
> > -|    libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
> > -|    libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
> > -|    libicui18n.so.63 => not found
> > -|    libicuuc.so.63 => not found
> > -...
> > -
> > -Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
> > -
> > -diff -Naur node-v10.15.1/deps/v8/gypfiles/toolchain.gypi node-v10.15.1/deps/v8/gypfiles/toolchain.gypi
> > ---- node-v10.15.1/deps/v8/gypfiles/toolchain.gypi    2019-03-18 15:01:39.000000000 +0100
> > -+++ node-v10.15.1/deps/v8/gypfiles/toolchain.gypi    2019-03-18 15:04:08.628361308 +0100
> > -@@ -1106,6 +1106,7 @@
> > -             'cflags': [ '-fno-strict-aliasing' ],
> > -           }],
> > -         ],  # conditions
> > -+        'ldflags+': [ '$(LDFLAGS)' ],
> > -       }],
> > -       ['OS=="solaris"', {
> > -         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
> > diff --git a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
> > index 4013c6931..9af0d998c 100644
> > --- a/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
> > +++ b/meta-oe/recipes-devtools/nodejs/nodejs_10.17.0.bb
> > @@ -19,7 +19,6 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
> >             file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
> >             file://0004-Make-compatibility-with-gcc-4.8.patch \
> >             file://0005-Link-atomic-library.patch \
> > -           file://0006-Use-target-ldflags.patch \
> >             "
> >  SRC_URI_append_class-target = " \
> >             file://0002-Using-native-torque.patch \
> > @@ -58,6 +57,18 @@ PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
> >  PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
> >  PACKAGECONFIG[zlib] = "--shared-zlib,,zlib"
> >
> > +# We don't want to cross-compile during target compile,
> > +# and we need to use the right flags during host compile,
> > +# too.
> > +EXTRA_OEMAKE = "\
> > +    CC.host='${CC}' \
> > +    CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \
> > +    CXX.host='${CXX}' \
> > +    CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \
> > +    LDFLAGS.host='${LDFLAGS}' \
> > +    AR.host='${AR}' \
> > +"
> > +
> >  # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to
> > workaround gypi
> >  do_configure () {
> >      rm -rf ${S}/deps/openssl
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-13 16:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-10 22:05 [meta-oe][PATCH 1/5] nodejs: ensure to use correct compiler & flags always André Draszik
2019-11-10 22:05 ` [meta-oe][PATCH 2/5] nodejs: delete all bundled deps in do_unpack() if needed André Draszik
2019-11-10 22:05 ` [meta-oe][PATCH 3/5] nodejs: allow use of system gyp André Draszik
2019-11-10 22:05 ` [meta-oe][PATCH 4/5] nodejs: use OE-provided compiler flags (arm) André Draszik
2019-11-10 22:05 ` [meta-oe][PATCH 5/5] nodejs: support long directory names for ${B} / ${S} André Draszik
2019-11-13  9:58 ` [meta-oe][PATCH] nodejs: ensure to use correct compiler & flags always André Draszik
2019-11-13 12:19   ` André Draszik
2019-11-13 16:12     ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.