pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/46292: pkgsrc on Linux: Patches for bootstrap-mk-files (NOGCCERROR, -Wno-error)



>Number:         46292
>Category:       pkg
>Synopsis:       pkgsrc on Linux: Patches for bootstrap-mk-files (NOGCCERROR, 
>-Wno-error)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 04 16:30:00 +0000 2012
>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
 



Home | Main Index | Thread Index | Old Index