NetBSD Problem Report #54909

From mlelstv@hoppa.1st.de  Thu Jan 30 05:36:43 2020
Return-Path: <mlelstv@hoppa.1st.de>
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 85DA17A110
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 30 Jan 2020 05:36:43 +0000 (UTC)
Message-Id: <20200130053615.D4A149D@hoppa.1st.de>
Date: Thu, 30 Jan 2020 06:36:15 +0100 (CET)
From: mlelstv@serpens.de
Reply-To: mlelstv@serpens.de
To: gnats-bugs@NetBSD.org
Subject: glib2 build fails for gsize type
X-Send-Pr-Version: 3.95

>Number:         54909
>Category:       pkg
>Synopsis:       glib2 build fails for gsize type
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    prlw1
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 30 05:40:00 +0000 2020
>Closed-Date:    Mon Jul 20 07:41:53 +0000 2020
>Last-Modified:  Mon Jul 20 07:41:53 +0000 2020
>Originator:     Michael van Elst
>Release:        NetBSD 9.0
>Organization:

>Environment:


System: NetBSD egghed 9.0 NetBSD 9.0 (LIBKVER) #0: Tue Jan 19 00:00:00 UTC 2038 root@localhost:/sys/arch/evbarm/compile/LIBKVER evbarm
Architecture: earmv6hf
Machine: evbarm
>Description:

Build of glib2 in a netbsd-9 chroot on earmv6hf fails with:

In file included from ../glib/galloca.h:32:0,
                 from ../glib/glib.h:30,
                 from ../glib/tests/overflow.c:14:
../glib/gtypes.h:475:24: note: expected 'guint32 * {aka unsigned int *}' but argument is of type 'gsize * {aka long unsigned int *}'
 static inline gboolean _GLIB_CHECKED_ADD_U32 (guint32 *dest, guint32 a, guint32 b) {
                        ^~~~~~~~~~~~~~~~~~~~~
In file included from ../glib/glib.h:85:0,
                 from ../glib/tests/overflow.c:14:
../glib/tests/overflow.c: In function 'test_checked_gsize_mul':
../glib/tests/overflow.c:180:67: warning: passing argument 1 of '_GLIB_CHECKED_MUL_U32' from incompatible pointer type [-Wincompatible-pointer-types]


This is caused by netbsd-9 gcc defining

#define __SIZE_TYPE__ long unsigned int

on this 32bit system and a patch we apply to glib2 forces it to use size_t as
the gsize type.

The glib2 upstream code doesn't trust size_t but deduces the shortest integer
type that matches size_t (which is 'unsigned int' not 'long unsigned int')
and the glib2 code then relies on that decision.


The patch was introduced to solve pkg/54298. So reverting this will
probably cause build problems on netbsd-8 again.

>How-To-Repeat:
Build glib2 package on NetBSD-9 on earm6hf (or possibly any 32bit arch).

>Fix:


>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->prlw1
Responsible-Changed-By: leot@NetBSD.org
Responsible-Changed-When: Thu, 30 Jan 2020 09:09:39 +0000
Responsible-Changed-Why:
Patrick, can you please give it a look?
(over to MAINTAINER)


From: Patrick Welche <prlw1@cam.ac.uk>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/54909: glib2 build fails for gsize type
Date: Thu, 30 Jan 2020 09:32:47 +0000

 On Thu, Jan 30, 2020 at 05:40:00AM +0000, mlelstv@serpens.de wrote:
 > The glib2 upstream code doesn't trust size_t but deduces the shortest integer
 > type that matches size_t (which is 'unsigned int' not 'long unsigned int')
 > and the glib2 code then relies on that decision.

 and the patch in pkg/54298 simply uses size_t instead of what meson/glib
 decides is equivalent.

 > ../glib/tests/overflow.c: In function 'test_checked_gsize_mul':

 I didn't consider the tests when doing the switch to size_t (!)

 > The patch was introduced to solve pkg/54298. So reverting this will
 > probably cause build problems on netbsd-8 again.

 In their wisdom, upstream decided to carry on ignoring the existence of
 size_t, and added more complexity in

   https://gitlab.gnome.org/GNOME/glib/commit/505c9544247f27cb6ebf749d0902d53c33dac308

 which may solve the build problems that existed on netbsd-8.

 Thoughts on the options
 1) soldier on and teach glib about c99 types
 2) give up, have an easier life, and minimise difference with "upstream"

 ?

From: Michael van Elst <mlelstv@serpens.de>
To: gnats-bugs@netbsd.org
Cc: prlw1@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/54909: glib2 build fails for gsize type
Date: Thu, 30 Jan 2020 20:59:27 +0100

 On Thu, Jan 30, 2020 at 09:35:01AM +0000, Patrick Welche wrote:

 >  Thoughts on the options
 >  1) soldier on and teach glib about c99 types
 >  2) give up, have an easier life, and minimise difference with "upstream"

 2. is the way to go. We only create a package, we don't enforce a design.

 Greetings,
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: "Patrick Welche" <prlw1@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/54909 CVS commit: pkgsrc/devel/glib2
Date: Fri, 7 Feb 2020 17:05:15 +0000

 Module Name:	pkgsrc
 Committed By:	prlw1
 Date:		Fri Feb  7 17:05:14 UTC 2020

 Modified Files:
 	pkgsrc/devel/glib2: Makefile distinfo
 	pkgsrc/devel/glib2/patches: patch-meson.build
 Removed Files:
 	pkgsrc/devel/glib2/patches: patch-glib_glibconfig.h.in
 	    patch-glib_gtypes.h

 Log Message:
 Apply upstream's

   Check size_t compatibility with various other types
   commit 505c9544247f27cb6ebf749d0902d53c33dac308

 which will hopefully fix PR pkg/54909 and not break PR pkg/54298


 To generate a diff of this commit:
 cvs rdiff -u -r1.266 -r1.267 pkgsrc/devel/glib2/Makefile \
     pkgsrc/devel/glib2/distinfo
 cvs rdiff -u -r1.1 -r0 pkgsrc/devel/glib2/patches/patch-glib_glibconfig.h.in
 cvs rdiff -u -r1.4 -r0 pkgsrc/devel/glib2/patches/patch-glib_gtypes.h
 cvs rdiff -u -r1.8 -r1.9 pkgsrc/devel/glib2/patches/patch-meson.build

 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: prlw1@NetBSD.org
State-Changed-When: Mon, 20 Jul 2020 07:41:53 +0000
State-Changed-Why:
fixed


>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.