pkgsrc-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Patches for Linux bootstrap (NOGCCERROR, -Wno-error)
Hi,
on Linux, $PREFIX/share/mk/sys.mk contains a conditional setting of
CFLAGS with "-Wno-error":
8 # At least Ubuntu 8.1 sets __attribute__((warn_unused_result)) on
fwrite()
9 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
10 .if !defined(NOGCCERROR)
11 CFLAGS+= -Wno-error
12 .endif
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. bsd.sys.mk is
not read on Linux (neither is it on NetBSD, but I am not too confident
of my testing there).
Without explicitly setting NOGCCERROR on the command line, CFLAGS always
get 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 */
which results in build errors:
In file included from socat.c:14:
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
In file included from socat.c:21:
xio.h:356:4: error: #error "unexpected size of off_t, please report this as
bug"
xio.h:365:7: error: #error "unexpected size of off64_t, please report this as
bug"
socat.c: In function 'gettimestamp':
socat.c:1113: warning: format '%06hd' expects type 'int', but argument 3 has
type '__suseconds_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:
--- pkgtools/bootstrap-mk-files/files/mods/Linux.sys.mk.orig 2011-08-02
21:49:02.000000000 +0200
+++ pkgtools/bootstrap-mk-files/files/mods/Linux.sys.mk 2011-08-03
15:14:32.000000000 +0200
@@ -7,7 +7,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
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).
A patch for the bootstrap script could be as simple as this:
--- pkgsrc/bootstrap/bootstrap.orig 2011-06-14 05:36:35.000000000 +0200
+++ pkgsrc/bootstrap/bootstrap 2011-08-03 17:31:12.000000000 +0200
@@ -589,22 +589,25 @@
Linux)
if [ -f /etc/ssdlinux_version ]; then
root_group=wheel
else
root_group=root
fi
need_bsd_install=no
need_awk=no
need_sed=no
set_opsys=no
machine_arch=`uname -m | sed -e 's/i.86/i386/'`
+ # At least Ubuntu 8.10 sets __attribute__((warn_unused_result)) on
fwrite()
+ # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
+ NOGCCERROR=1; export NOGCCERROR
;;
MirBSD)
root_group=wheel
need_pax=yes
need_mtree=no
need_bsd_install=no
need_awk=no
need_sed=no
set_opsys=no
check_prog mtreeprog mtree
machine_arch=`arch -s`
With both patches applied, both the bootstrap and "bmake package-install" in
net/socat on Ubuntu 10.04 succeed.
Both patches are attached.
Regards
Matthias
--- pkgsrc/pkgtools/bootstrap-mk-files/files/mods/Linux.sys.mk.orig
2011-08-02 21:49:02.000000000 +0200
+++ pkgsrc/pkgtools/bootstrap-mk-files/files/mods/Linux.sys.mk 2011-08-03
15:14:32.000000000 +0200
@@ -7,7 +7,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
--- pkgsrc/bootstrap/bootstrap.orig 2011-06-14 05:36:35.000000000 +0200
+++ pkgsrc/bootstrap/bootstrap 2011-08-03 17:31:12.000000000 +0200
@@ -589,22 +589,25 @@
Linux)
if [ -f /etc/ssdlinux_version ]; then
root_group=wheel
else
root_group=root
fi
need_bsd_install=no
need_awk=no
need_sed=no
set_opsys=no
machine_arch=`uname -m | sed -e 's/i.86/i386/'`
+ # At least Ubuntu 8.10 sets __attribute__((warn_unused_result)) on
fwrite()
+ # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
+ NOGCCERROR=1; export NOGCCERROR
;;
MirBSD)
root_group=wheel
need_pax=yes
need_mtree=no
need_bsd_install=no
need_awk=no
need_sed=no
set_opsys=no
check_prog mtreeprog mtree
machine_arch=`arch -s`
Home |
Main Index |
Thread Index |
Old Index