NetBSD Problem Report #54402

From www@netbsd.org  Tue Jul 23 18:11:27 2019
Return-Path: <www@netbsd.org>
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 B767F7A1AB
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 23 Jul 2019 18:11:27 +0000 (UTC)
Message-Id: <20190723181126.9F0FF7A1D3@mollari.NetBSD.org>
Date: Tue, 23 Jul 2019 18:11:26 +0000 (UTC)
From: davshao@gmail.com
Reply-To: davshao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: graphics/gdk-pixbuf2: Unrestricted definition of _XOPEN_SOURCE breaks build on FreeBSD 12
X-Send-Pr-Version: www-1.0

>Number:         54402
>Category:       pkg
>Synopsis:       graphics/gdk-pixbuf2: Unrestricted definition of _XOPEN_SOURCE breaks build on FreeBSD 12
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 23 18:15:01 +0000 2019
>Last-Modified:  Tue Jul 30 05:50:01 +0000 2019
>Originator:     David Shao
>Release:        current pkgsrc
>Organization:
>Environment:
FreeBSD xxxxxx.xxx 12.0-RELEASE-p7 FreeBSD 12.0-RELEASE-p7 ee05953cd38(releng120) GENERIC  amd64
>Description:
A recent commit for graphics/gdk-pixbuf2 patches meson.build to define
-D_XOPEN_SOURCE=500

This kind of definition with a specific number such as 500 for _XOPEN_SOURCE is almost never a good thing on FreeBSD, probably other BSDs.  For this case, such a definition causes a simple function such as double round(double) from math.h to no longer be declared.

I believe what happens on FreeBSD is when _XOPEN_SOURCE is defined without a number, sys/cdefs.h will be able to set __BSD_VISIBLE enabling everything to be visible.  But once one defines _XOPEN_SOURCE to be some number in the hundreds, __BSD_VISIBLE does not get defined, throwing out visibility of anything not strictly in the standards.


>How-To-Repeat:

>Fix:
Would it be possible to restrict the change to SunOS such as:

@@ -8,7 +8,11 @@ project('gdk-pixbuf', 'c',
         ],
         meson_version: '>= 0.46.0')

-add_project_arguments([ '-D_POSIX_C_SOURCE=200809L', '-D_DEFAULT_SOURCE', '-D_XOPEN_SOURCE' ], language: 'c')
+if host_machine.system() == 'sunos'
+  add_project_arguments([ '-D_POSIX_C_SOURCE=200809L', '-D_DEFAULT_SOURCE', '-D_XOPEN_SOURCE=500' ], language: 'c')
+else
+  add_project_arguments([ '-D_POSIX_C_SOURCE=200809L', '-D_DEFAULT_SOURCE', '-D_XOPEN_SOURCE' ], language: 'c')
+endif

 cc = meson.get_compiler('c')
 host_system = host_machine.system()

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/54402: graphics/gdk-pixbuf2: Unrestricted definition of
 _XOPEN_SOURCE breaks build on FreeBSD 12
Date: Tue, 30 Jul 2019 07:46:03 +0200

 Hi!

 Can you please try if jperkin's latest commit (bumping it to 600) fixes the problem?

 Thanks,
  Thomas

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.