NetBSD Problem Report #46292
From www@NetBSD.org Wed Apr 4 16:26:21 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 3222763BBEC
for <gnats-bugs@gnats.NetBSD.org>; Wed, 4 Apr 2012 16:26:21 +0000 (UTC)
Message-Id: <20120404162620.217EE63B946@www.NetBSD.org>
Date: Wed, 4 Apr 2012 16:26:20 +0000 (UTC)
From: mf+ml.pkgsrc-users@netzwerkagentursaarland.de
Reply-To: mf+ml.pkgsrc-users@netzwerkagentursaarland.de
To: gnats-bugs@NetBSD.org
Subject: pkgsrc on Linux: Patches for bootstrap-mk-files (NOGCCERROR, -Wno-error)
X-Send-Pr-Version: www-1.0
>Number: 46292
>Category: pkg
>Synopsis: pkgsrc on Linux: Patches for bootstrap-mk-files (NOGCCERROR, -Wno-error)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: linux-pkg-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 04 16:30:00 +0000 2012
>Closed-Date: Fri Oct 20 06:09:09 +0000 2017
>Last-Modified: Fri Oct 20 06:09:09 +0000 2017
>Originator: Matthias Ferdinand
>Release:
>Organization:
one4vision GmbH
>Environment:
Ubuntu 10.04: Linux pkgsrc1004-32 2.6.32-33-generic-pae #72-Ubuntu SMP Fri Jul 29 22:06:29 UTC 2011 i686 GNU/Linux
Ubuntu 6.06: Linux pkgsrc606 2.6.24-28-server #1 SMP Sat Oct 16 17:53:34 UTC 2010 i686 GNU/Linux
>Description:
Hi,
on Linux, $PREFIX/share/mk/sys.mk contains a conditional setting of
CFLAGS with "-Wno-error":
86
87 # At least Ubuntu 8.1 sets __attribute__((warn_unused_result)) on fwrite()
88 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
89 .if !defined(NOGCCERROR)
90 CFLAGS+= -Wno-error
91 .endif
92
this file is copied from
pkgtools/bootstrap-mk-files/files/mods/Linux.sys.mk.
Indeed, on Ubuntu 10.04, bootstrapping will fail without this setting:
ftp.c: In function 'ftp_cwd':
ftp.c:328: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result
while on Ubuntu 8.04 and 6.06 there are no problems without
"-Wno-error".
There is a similar section in $PREFIX/share/mk/bsd.sys.mk
24 .if !defined(NOGCCERROR)
25 CFLAGS+= -Werror
26 .endif
which also uses $NOGCCERROR, but with the opposite result. AFAICT bsd.sys.mk is not read under Linux.
Without explicitly setting NOGCCERROR on the command line, CFLAGS always
gets the "-Wno-error" setting from sys.mk. While this is harmless in
most cases, with net/socat it is not. For some if its tests, the configure script requires the compiler to throw errors on warnings and explicitly uses "-Werror" to this end. But then the bmake CFLAGS are appended, resulting in a sequence "-Werror -Wno-error", and the latter option wins. Some of the configure tests then do not fail as they should, and configure continues with wrong assumptions about the architecture:
checking for equivalent simple type of size_t... 1 /* short */
checking for equivalent simple type of mode_t... 1 /* short */
checking for equivalent simple type of pid_t... 1 /* short */
checking for equivalent simple type of uid_t... 1 /* short */
checking for equivalent simple type of gid_t... 1 /* short */
checking for equivalent simple type of time_t... 1 /* short */
checking for equivalent simple type of socklen_t... 1 /* short */
checking for equivalent simple type of off_t... 1 /* short */
checking for equivalent simple type of off64_t... 1 /* short */
which later results in build errors:
compat.h:117:4: error: #error "HAVE_BASIC_SIZE_T is out of range:" HAVE_BASIC_SIZE_T
compat.h:280:2: error: #error "HAVE_BASIC_OFF_T is out of range:" HAVE_BASIC_OFF_T
Actually it is still possible to build net/socat, using "bmake
NOGCCERROR=1". But since sys.mk is always read first, this cannot be
automated with variables in e.g. $PREFIX/etc/mk.conf. If there was an
update for net/socat, I could not use pkg_chk or pkg_rolling-replace,
but would have to manually call "bmake NOGCCERROR=1".
I propose to change the sense of NOGCCERROR in
pkgtools/bootstrap-mk-files/files/mods/Linux.sys.mk.
With the patch below, the pkgsrc bootstrap script pkgsrc/bootstrap/bootstrap would have to explicitly export NOGCCERROR=1 or it will fail on Ubuntu 10.04 (although it works fine on 6.06 and 8.04).
pro: - makes net/socat buildable and upgradeable using standard tools
- effect of NOGCCERROR is more in line with the variable name
con: - on current Linux systems (i.e. glibc systems), bootstrap needs
"env NOGCCERROR=1" to succeed. This needs to be documented or to
be automated in the bootstrap script itself upon detecting Linux.
"-Wno-error" is only needed for bootstrapping (at least on Ubuntu
10.04).
>How-To-Repeat:
>Fix:
--- pkgtools/bootstrap-mk-files/files/mods/Linux.sys.mk.orig 2012-04-04 18:20:20.000000000 +0200
+++ pkgtools/bootstrap-mk-files/files/mods/Linux.sys.mk 2012-04-04 18:20:42.000000000 +0200
@@ -86,7 +86,7 @@
# At least Ubuntu 8.1 sets __attribute__((warn_unused_result)) on fwrite()
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
-.if !defined(NOGCCERROR)
+.if defined(NOGCCERROR)
CFLAGS+= -Wno-error
.endif
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->linux-pkg-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Wed, 04 Apr 2012 23:04:57 +0000
Responsible-Changed-Why:
Linux pkgsrc PR
State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Fri, 20 Oct 2017 06:09:09 +0000
State-Changed-Why:
I removed -Werror bootstrap-mk-files a while back, I see we should've done that long ago.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.