NetBSD Problem Report #53758

From bjjl@bsdvm.lorenz.place  Sat Dec  1 16:50:23 2018
Return-Path: <bjjl@bsdvm.lorenz.place>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6A69C7A1D0
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  1 Dec 2018 16:50:23 +0000 (UTC)
Message-Id: <20181201153124.03D3A44B5C@bsdvm.lorenz.place>
Date: Sat,  1 Dec 2018 16:31:23 +0100 (CET)
From: ben@pocket.services
To: gnats-bugs@NetBSD.org
Subject: lang/nodejs build error
X-Send-Pr-Version: 3.95

>Number:         53758
>Category:       pkg
>Synopsis:       lang/nodejs build error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    fhajny
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 01 16:55:00 +0000 2018
>Last-Modified:  Mon Dec 24 05:25:00 +0000 2018
>Originator:     Benjamin Lorenz
>Release:        NetBSD 8.0
>Organization:

>Environment:


System: NetBSD bsdvm.lorenz.place 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
System with pkgsrc-2018Q3 
Building from -current

In file included from ../deps/openssl/openssl/include/../../config/opensslconf.h:9:0,
                 from ../deps/openssl/openssl/include/openssl/opensslconf.h:1,
                 from ../deps/openssl/openssl/include/openssl/e_os2.h:13,
                 from ../deps/openssl/openssl/include/openssl/crypto.h:22,
                 from ../deps/openssl/openssl/ssl/bio_ssl.c:14:
../deps/openssl/openssl/include/../../config/./opensslconf_asm.h:112:62: fatal error: ./archs/BSD-x86/asm/include/openssl/opensslconf.h: No such file or directory
compilation terminated.
gmake[1]: *** [deps/openssl/openssl.target.mk:804: /home/bjjl/NetBSD/pkgsrc/lang/nodejs/work/node-v10.14.0/out/Release/obj.target/openssl/deps/openssl/openssl/ssl/bio_ssl.o] Error 1
gmake[1]: *** Waiting for unfinished jobs....
rm 4a042366e6582ffe535474129b2ad0a35dd32706.intermediate
gmake: *** [Makefile:99: node] Error 2
*** Error code 2

Stop.
make[1]: stopped in /home/bjjl/NetBSD/pkgsrc/lang/nodejs
*** Error code 1


>How-To-Repeat:

>Fix:


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->fhajny
Responsible-Changed-By: leot@NetBSD.org
Responsible-Changed-When: Sat, 01 Dec 2018 22:00:04 +0000
Responsible-Changed-Why:
Filip, can you please give it a look?
(over to MAINTAINER)


From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: pkg/53758: lang/nodejs build error
Date: Sat, 8 Dec 2018 23:14:03 +0900

 It seems there are several problems on pkgsrc-2018Q3 lang/nodejs
 for NetBSD/i386 8.0 (no problem on NetBSD/amd64 8.0):

 (1) There is no deps/openssl/config/archs/BSD-x86 for BSD ia32 systems
     in the distribution, but deps/openssl/config/opensslconf_asm.h
     still refers it for FreeBSD and OpenBSD (and NetBSD by pkgsrc patches).

 (2) According to comments in the opensslconf_asm.h, all ia32 systems
     that has no OS specific support imlicitly use
     deps/openssl/config/archs/linux-elf/asm for linux ia32.

 (3) But even for NetBSD/i386,
     deps/openssl/config/archs/linux-elf/asm/openssl-cl.gypi has
     Linux specific library (-ldl) definitions, so it causes link errors
     later.

 (4) Node.js seems to also use 64 bit atomic ops, so extra atomic libraries
     (or Pentium class CPUs) are required for __atomic_*_8() functions.

 I wrote a dumb patch to work around these issue:

 (1) Remove BSD-x86 leftovers in deps/openssl/config/opensslconf_asm.h

 (2) Use linux-elf for NetBSD/i386
     (no idea what we can do for non-x86 systems though)

 (3) Add a 'conditions' block to check linux for library definitions
     in deps/openssl/config/archs/linux-elf/asm/openssl-cl.gypi

 (4) Explicitly specify "CPPFLAGS+= i586" in Makefile.
     Also add "CPPFLAGS+= -mstackrealign for SSE instructions
     as pkgsrc/www/firefox/mozilla.mk does.
     (I'm not sure if these should rather be in Makefile.common though)

  https://gist.github.com/tsutsui/8f5d83a46dd317b8604071521bbec255

 ---
 ? patches/patch-deps_openssl_config_archs_linux-elf_asm_openssl-cl.gypi
 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/nodejs/Makefile,v
 retrieving revision 1.145
 diff -u -p -d -r1.145 Makefile
 --- Makefile	20 Sep 2018 14:05:25 -0000	1.145
 +++ Makefile	8 Dec 2018 11:32:17 -0000
 @@ -23,6 +23,13 @@ CONFIGURE_ARGS+=	--with-intl=system-icu

  CHECK_PORTABILITY_SKIP+=	deps/openssl/openssl/.travis-create-release.sh

 +.if ${MACHINE_ARCH} == "i386"
 +# 64 bit atomic ops are required
 +CXXFLAGS+=		-march=i586
 +# required for SSE2 code under i386.
 +CXXFLAGS+=		-mstackrealign
 +.endif
 +
  .include "options.mk"

  .include "../../lang/nodejs/Makefile.common"
 Index: distinfo
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/nodejs/distinfo,v
 retrieving revision 1.135
 diff -u -p -d -r1.135 distinfo
 --- distinfo	20 Sep 2018 14:05:25 -0000	1.135
 +++ distinfo	8 Dec 2018 11:32:17 -0000
 @@ -6,7 +6,8 @@ SHA512 (node-v10.11.0.tar.gz) = 0d1bce55
  Size (node-v10.11.0.tar.gz) = 36198226 bytes
  SHA1 (patch-common.gypi) = de37949f38d9bd39a18b59d59ec74e528bd323ac
  SHA1 (patch-deps_cares_cares.gyp) = 2235eb44bc984fa2e745fdf1786f1ae6de6ef80f
 -SHA1 (patch-deps_openssl_config_opensslconf__asm.h) = 7b074ebd5353dff662ac66cf4012926f12dd7b7e
 +SHA1 (patch-deps_openssl_config_archs_linux-elf_asm_openssl-cl.gypi) = f92f5547728cf67de5ccfd652f23cc4ab8f5b207
 +SHA1 (patch-deps_openssl_config_opensslconf__asm.h) = 86b1c42bbe0f7b9e6412a62e5771da316bd8b96c
  SHA1 (patch-deps_openssl_config_opensslconf__no-asm.h) = 4b2eb51f6369c2acd328421cd896b8471234c0c8
  SHA1 (patch-deps_openssl_openssl-cl__asm.gypi) = a7966d08e45120c55ff5ec62c6f6bf944212af2d
  SHA1 (patch-deps_openssl_openssl-cl__no__asm.gypi) = f90a0cbdbe5d2088f892fdc6586d0fe9c612b8d5
 Index: patches/patch-deps_openssl_config_opensslconf__asm.h
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/nodejs/patches/patch-deps_openssl_config_opensslconf__asm.h,v
 retrieving revision 1.1
 diff -u -p -d -r1.1 patch-deps_openssl_config_opensslconf__asm.h
 --- patches/patch-deps_openssl_config_opensslconf__asm.h	3 May 2018 21:19:16 -0000	1.1
 +++ patches/patch-deps_openssl_config_opensslconf__asm.h	8 Dec 2018 11:32:17 -0000
 @@ -2,15 +2,14 @@ $NetBSD: patch-deps_openssl_config_opens

  Add support for NetBSD.

 ---- deps/openssl/config/opensslconf_asm.h.orig	2018-04-24 14:41:19.000000000 +0000
 +--- deps/openssl/config/opensslconf_asm.h.orig	2018-09-20 07:28:30.000000000 +0000
  +++ deps/openssl/config/opensslconf_asm.h
 -@@ -108,9 +108,9 @@
 +@@ -108,9 +108,7 @@
   # include "./archs/VC-WIN32/asm/include/openssl/opensslconf.h"
   #elif defined(_WIN32) && defined(_M_X64)
   # include "./archs/VC-WIN64A/asm/include/openssl/opensslconf.h"
  -#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__i386__)
 -+#elif (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)) && defined(__i386__)
 - # include "./archs/BSD-x86/asm/include/openssl/opensslconf.h"
 +-# include "./archs/BSD-x86/asm/include/openssl/opensslconf.h"
  -#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__x86_64__)
  +#elif (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)) && defined(__x86_64__)
   # include "./archs/BSD-x86_64/asm/include/openssl/opensslconf.h"
 --- /dev/null	2018-12-08 20:31:04.725130460 +0900
 +++ patches/patch-deps_openssl_config_archs_linux-elf_asm_openssl-cl.gypi	2018-12-08 20:17:05.055217148 +0900
 @@ -0,0 +1,23 @@
 +$NetBSD$
 +
 +--- deps/openssl/config/archs/linux-elf/asm/openssl-cl.gypi.orig	2018-09-20 07:28:30.000000000 +0000
 ++++ deps/openssl/config/archs/linux-elf/asm/openssl-cl.gypi
 +@@ -28,8 +28,16 @@
 +     'openssl_cflags_linux-elf': [
 +       '-Wall -O3 -pthread -DL_ENDIAN -fomit-frame-pointer',
 +     ],
 +-    'openssl_ex_libs_linux-elf': [
 +-      '-ldl -pthread',
 ++    'conditions': [
 ++      ['OS=="linux"', {
 ++        'openssl_ex_libs_linux-elf': [
 ++          '-ldl -pthread',
 ++        ],
 ++      }, {
 ++        'openssl_ex_libs_linux-elf': [
 ++          '',
 ++        ],
 ++      }],
 +     ],
 +     'openssl_cli_srcs_linux-elf': [
 +       'openssl/apps/app_rand.c',


 ---

 This patch is for pkgsrc-2018Q3 (i.e. nodejs-10.11.0, while the latest
 pkgsrc-current has 10.14.0), but I can build working firefox 63.0.3
 binary for NetBSD/i386 8.0, using partially updated pkgsrc-2018Q3 tree.

 (note the patch is not tested on Linux ia32 systems)

 I'm not sure nodejs (and firefox) actually require OpenSSL functions,
 but it looks the "real fix" is to use pkgsrc openssl 1.1, as pkgsrc log
 messages said?
  http://mail-index.netbsd.org/pkgsrc-changes/2018/05/03/msg175076.html

 ---
 Izumi Tsutsui

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: pkg/53758: lang/nodejs build error
Date: Mon, 24 Dec 2018 14:24:32 +0900

 I wrote:
 > This patch is for pkgsrc-2018Q3 (i.e. nodejs-10.11.0, while the latest
 > pkgsrc-current has 10.14.0)

 Here is a patch for pkgsrc HEAD:

 ---
 ? patches/patch-deps_openssl_config_archs_linux-elf_asm_openssl-cl.gypi
 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/nodejs/Makefile,v
 retrieving revision 1.150
 diff -u -p -d -r1.150 Makefile
 --- Makefile	15 Dec 2018 17:32:38 -0000	1.150
 +++ Makefile	24 Dec 2018 05:14:31 -0000
 @@ -24,6 +24,13 @@ CONFIGURE_ARGS+=	--with-intl=system-icu

  CHECK_PORTABILITY_SKIP+=	deps/openssl/openssl/.travis-create-release.sh

 +.if ${MACHINE_ARCH} == "i386"
 +# 64 bit atomic ops are required
 +CXXFLAGS+=	-march=i586
 +# required for SSE2 code under i386.
 +CXXFLAGS+=	-mstackrealign
 +.endif
 +
  .include "options.mk"

  .include "../../lang/nodejs/Makefile.common"
 Index: distinfo
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/nodejs/distinfo,v
 retrieving revision 1.140
 diff -u -p -d -r1.140 distinfo
 --- distinfo	15 Dec 2018 17:32:38 -0000	1.140
 +++ distinfo	24 Dec 2018 05:14:31 -0000
 @@ -6,7 +6,8 @@ SHA512 (node-v10.14.2.tar.gz) = 72e78f88
  Size (node-v10.14.2.tar.gz) = 36299908 bytes
  SHA1 (patch-common.gypi) = de37949f38d9bd39a18b59d59ec74e528bd323ac
  SHA1 (patch-deps_cares_cares.gyp) = 2235eb44bc984fa2e745fdf1786f1ae6de6ef80f
 -SHA1 (patch-deps_openssl_config_opensslconf__asm.h) = 7b074ebd5353dff662ac66cf4012926f12dd7b7e
 +SHA1 (patch-deps_openssl_config_archs_linux-elf_asm_openssl-cl.gypi) = f92f5547728cf67de5ccfd652f23cc4ab8f5b207
 +SHA1 (patch-deps_openssl_config_opensslconf__asm.h) = f60ebbb92b804c1d2625c24c73c580a6da7aa046
  SHA1 (patch-deps_openssl_config_opensslconf__no-asm.h) = 4b2eb51f6369c2acd328421cd896b8471234c0c8
  SHA1 (patch-deps_openssl_openssl-cl__asm.gypi) = a7966d08e45120c55ff5ec62c6f6bf944212af2d
  SHA1 (patch-deps_openssl_openssl-cl__no__asm.gypi) = f90a0cbdbe5d2088f892fdc6586d0fe9c612b8d5
 Index: patches/patch-deps_openssl_config_opensslconf__asm.h
 ===================================================================
 RCS file: /cvsroot/pkgsrc/lang/nodejs/patches/patch-deps_openssl_config_opensslconf__asm.h,v
 retrieving revision 1.1
 diff -u -p -d -r1.1 patch-deps_openssl_config_opensslconf__asm.h
 --- patches/patch-deps_openssl_config_opensslconf__asm.h	3 May 2018 21:19:16 -0000	1.1
 +++ patches/patch-deps_openssl_config_opensslconf__asm.h	24 Dec 2018 05:14:31 -0000
 @@ -2,15 +2,14 @@ $NetBSD: patch-deps_openssl_config_opens

  Add support for NetBSD.

 ---- deps/openssl/config/opensslconf_asm.h.orig	2018-04-24 14:41:19.000000000 +0000
 +--- deps/openssl/config/opensslconf_asm.h.orig	2018-12-10 21:19:03.000000000 +0000
  +++ deps/openssl/config/opensslconf_asm.h
 -@@ -108,9 +108,9 @@
 +@@ -108,9 +108,7 @@
   # include "./archs/VC-WIN32/asm/include/openssl/opensslconf.h"
   #elif defined(_WIN32) && defined(_M_X64)
   # include "./archs/VC-WIN64A/asm/include/openssl/opensslconf.h"
  -#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__i386__)
 -+#elif (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)) && defined(__i386__)
 - # include "./archs/BSD-x86/asm/include/openssl/opensslconf.h"
 +-# include "./archs/BSD-x86/asm/include/openssl/opensslconf.h"
  -#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__x86_64__)
  +#elif (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)) && defined(__x86_64__)
   # include "./archs/BSD-x86_64/asm/include/openssl/opensslconf.h"
 --- /dev/null	2018-12-24 13:59:53.779148582 +0900
 +++ patches/patch-deps_openssl_config_archs_linux-elf_asm_openssl-cl.gypi	2018-12-24 13:44:34.882408263 +0900
 @@ -0,0 +1,23 @@
 +$NetBSD$
 +
 +--- deps/openssl/config/archs/linux-elf/asm/openssl-cl.gypi.orig	2018-09-20 07:28:30.000000000 +0000
 ++++ deps/openssl/config/archs/linux-elf/asm/openssl-cl.gypi
 +@@ -28,8 +28,16 @@
 +     'openssl_cflags_linux-elf': [
 +       '-Wall -O3 -pthread -DL_ENDIAN -fomit-frame-pointer',
 +     ],
 +-    'openssl_ex_libs_linux-elf': [
 +-      '-ldl -pthread',
 ++    'conditions': [
 ++      ['OS=="linux"', {
 ++        'openssl_ex_libs_linux-elf': [
 ++          '-ldl -pthread',
 ++        ],
 ++      }, {
 ++        'openssl_ex_libs_linux-elf': [
 ++          '',
 ++        ],
 ++      }],
 +     ],
 +     'openssl_cli_srcs_linux-elf': [
 +       'openssl/apps/app_rand.c',


 ---

 https://gist.github.com/tsutsui/de2b274a1fbf9d3708d6d56a7c7986ba

 ---
 Izumi Tsutsui

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.