All of lore.kernel.org
 help / color / mirror / Atom feed
From: "André Draszik" <git@andred.net>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-oe][PATCH 1/5] nodejs: ensure to use correct compiler & flags always
Date: Sun, 10 Nov 2019 22:05:06 +0000	[thread overview]
Message-ID: <20191110220510.10077-1-git@andred.net> (raw)

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



             reply	other threads:[~2019-11-10 22:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-10 22:05 André Draszik [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191110220510.10077-1-git@andred.net \
    --to=git@andred.net \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.