NetBSD Problem Report #54826

From tsutsui@ceres.dti.ne.jp  Thu Jan  2 21:12:59 2020
Return-Path: <tsutsui@ceres.dti.ne.jp>
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 BF9AF7A1AB
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  2 Jan 2020 21:12:59 +0000 (UTC)
Message-Id: <202001022112.002LCnJH002815@ceres.dti.ne.jp>
Date: Fri, 3 Jan 2020 06:12:49 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: pkgsrc-2019Q4 libreoffice build failure on NetBSD/i386 9.0_RC1
X-Send-Pr-Version: 3.95

>Number:         54826
>Category:       pkg
>Synopsis:       pkgsrc-2019Q4 libreoffice build failure on NetBSD/i386 9.0_RC1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ryoon
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 02 21:15:00 +0000 2020
>Closed-Date:    Sat Apr 18 11:23:00 +0000 2020
>Last-Modified:  Sat Apr 18 11:23:00 +0000 2020
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0_RC1
>Organization:
>Environment:
System: NetBSD mirage 9.0_RC1 NetBSD 9.0_RC1 (GENERIC) #11: Thu Jan 2 14:19:17 JST 2020 tsutsui@mirage:/s/netbsd-9/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
There two problems.

(1) 64bit atomic ops

configure fails:
---
checking whether c++ supports C++17... yes (-std=gnu++17)
checking whether std::atomic can be used without link library... no
checking whether std::atomic needs -latomic... no
configure: error: in `/s/obj.i386/pkgsrc/misc/libreoffice/work.i386/libreoffice-6.3.3.2':
configure: error: cannot figure our how to use std::atomic
See `config.log' for more details
Error running configure at /s/obj.i386/pkgsrc/misc/libreoffice/work.i386/libreoffice-6.3.3.2/autogen.sh line 302.
*** Error code 25

Stop.
make[2]: stopped in /usr/pkgsrc/misc/libreoffice
*** Error code 1
---

(2) memalign not found

Even after (1) is workarounded, the next error is:
---
[build DEP] LNK:Executable/gengal.bin
[build LNK] Executable/gengal.bin
ld: /s/obj.i386/pkgsrc/misc/libreoffice/work.i386/libreoffice-6.3.3.2/instdir/program/libpdfiumlo.so: undefined reference to `memalign'
gmake[1]: *** [/s/obj.i386/pkgsrc/misc/libreoffice/work.i386/libreoffice-6.3.3.2/svx/Executable_gengal.mk:20: /s/obj.i386/pkgsrc/misc/libreoffice/work.i386/libreoffice-6.3.3.2/instdir/program/gengal.bin] Error 1
gmake: *** [Makefile:167: Executable_gengal] Error 2
*** Error code 2

Stop.
make[1]: stopped in /usr/pkgsrc/misc/libreoffice
*** Error code 1
---

>How-To-Repeat:
Build pkgsrc-2019Q4 misc/libreoffice on NetBSD/i386 9.0_RC1

>Fix:
(1) 64bit atomic ops

Adding "-march=i386" to CXXFLAGS works around,
as pkgsrc/www/firefox/mozilla.mk does.

---
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/misc/libreoffice/Makefile,v
retrieving revision 1.215
diff -u -p -r1.215 Makefile
--- Makefile	1 Dec 2019 04:59:43 -0000	1.215
+++ Makefile	2 Jan 2020 19:57:55 -0000
@@ -263,6 +263,11 @@ BUILD_MAKE_FLAGS+=	VERBOSE=true
 BUILDLINK_TRANSFORM+=	rm:-ldl
 .endif

+.if ${MACHINE_ARCH} == "i386"
+# For 64 bit atomic ops
+CXXFLAGS+=		-march=i586
+.endif
+
 INSTALLATION_DIRS=	bin share/applications

 .PHONY: debugrun
---

(2) memalign not found

The problem is the following definitions in
external/pdfium/third_party/libopenjpeg20/opj_malloc.h:

---
  #elif defined(__FreeBSD__)
    #define HAVE_POSIX_MEMALIGN
  /* Linux x86_64 and OSX always align allocations to 16 bytes */
  #elif !defined(__amd64__) && !defined(__APPLE__) && !defined(_AIX)
    #define HAVE_MEMALIGN*** Error code 1
---

This why there is no problem on NetBSD/amd64 9.0_RC1.

The following change to pkgsrc.patch.1 works around.

Index: patches/patch-external_pdfium_pkgsrc.patch.1
===================================================================
RCS file: /cvsroot/pkgsrc/misc/libreoffice/patches/patch-external_pdfium_pkgsrc.patch.1,v
retrieving revision 1.3
diff -u -p -r1.3 patch-external_pdfium_pkgsrc.patch.1
--- patches/patch-external_pdfium_pkgsrc.patch.1	15 Nov 2019 13:26:02 -0000	1.3
+++ patches/patch-external_pdfium_pkgsrc.patch.1	2 Jan 2020 19:57:59 -0000
@@ -4,9 +4,9 @@ $NetBSD: patch-external_pdfium_pkgsrc.pa
 * Do no conflict with FreeType 2.10.1 from pkgsrc
 * Add pkgsrc font path

---- external/pdfium/pkgsrc.patch.1.orig	2019-10-18 00:59:38.822575812 +0000
+--- external/pdfium/pkgsrc.patch.1.orig	2020-01-02 11:52:46.713477239 +0000
 +++ external/pdfium/pkgsrc.patch.1
-@@ -0,0 +1,54 @@
+@@ -0,0 +1,65 @@
 +--- pdfium/core/fxcrt/cfx_fileaccess_posix.h.orig	2019-05-10 17:07:53.000000000 +0000
 ++++ pdfium/core/fxcrt/cfx_fileaccess_posix.h
 +@@ -12,7 +12,7 @@
@@ -61,3 +61,14 @@ $NetBSD: patch-external_pdfium_pkgsrc.pa
 +   }
 +   return std::move(pInfo);
 + }
++--- pdfium/third_party/libopenjpeg20/opj_malloc.h.orig	2019-05-10 17:07:53.000000000 +0000
+++++ pdfium/third_party/libopenjpeg20/opj_malloc.h
++@@ -98,7 +98,7 @@ Allocate memory aligned to a 16 byte bou
++ #else /* Not _WIN32 */
++   #if defined(__sun)
++     #define HAVE_MEMALIGN
++-  #elif defined(__FreeBSD__)
+++  #elif defined(__FreeBSD__) || defined(__NetBSD__)
++     #define HAVE_POSIX_MEMALIGN
++   /* Linux x86_64 and OSX always align allocations to 16 bytes */
++   #elif !defined(__amd64__) && !defined(__APPLE__) && !defined(_AIX)

---
Izumi Tsutsui

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->ryoon
Responsible-Changed-By: leot@NetBSD.org
Responsible-Changed-When: Thu, 02 Jan 2020 21:21:53 +0000
Responsible-Changed-Why:
Ryo, can you please give it a look?
(over to MAINTAINER)


From: "Izumi Tsutsui" <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54826 CVS commit: pkgsrc/misc/libreoffice
Date: Sat, 18 Apr 2020 11:16:31 +0000

 Module Name:	pkgsrc
 Committed By:	tsutsui
 Date:		Sat Apr 18 11:16:31 UTC 2020

 Modified Files:
 	pkgsrc/misc/libreoffice: Makefile

 Log Message:
 libreoffice: add "CXXFLAGS+= -march=i586" on i386 for 64bit atomic ops.

 Fixes the first part of PR/54826.  libreoffice-6.4.2.2 from
 pkgsrc-2020Q1 on NetBSD/i386 9.0 builds and works with this change.
 Note the second part of the PR (memalign error) was already fixed as
 patches/patch-external_pdfium_pkgsrc2.patch.1 in the following commit:
  https://mail-index.netbsd.org/pkgsrc-changes/2020/02/07/msg206251.html


 To generate a diff of this commit:
 cvs rdiff -u -r1.225 -r1.226 pkgsrc/misc/libreoffice/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Sat, 18 Apr 2020 11:23:00 +0000
State-Changed-Why:
Fixes have been committed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.