bug-bash
[Top][All Lists]
Advanced

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

Bash build issues in `devel' branch due to -Werror compiler flag


From: Eduardo A . Bustamante López
Subject: Bash build issues in `devel' branch due to -Werror compiler flag
Date: Sat, 15 Dec 2018 23:35:49 -0800
User-agent: Mutt/1.10.1 (2018-07-13)

Commit 9d80be9ab5cc17011c634e0348c64c15fcba95bf adds the following compiler 
flag:

  dualbus@debian:~/src/gnu/bash$ cat -n configure.ac | grep Werror -C3
    1159                CFLAGS="$CFLAGS -Wno-parentheses -Wno-format-security"
    1160                if test -n "$DEBUG"
    1161                then
  ~>1162                        CFLAGS="$CFLAGS -Werror"
    1163                fi
    1164        fi
    1165        

During build (with gcc):

  dualbus@debian:~/src/gnu/bash$ make -j$(nproc) -s
  make[1]: warning: -j4 forced in submake: resetting jobserver mode.
  ./parse.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
  make[1]: warning: -j4 forced in submake: resetting jobserver mode.
  expr.c:217:17: error: conflicting types for built-in function ‘exp2’ 
[-Werror=builtin-declaration-mismatch]
   static intmax_t exp2 __P((void));
                   ^~~~
  cc1: all warnings being treated as errors


I know the `exp2' function here has nothing to do with the built-in exponential
function, and that it has had that name for a long time, but the build breaks 
due to that.

To hack around it, I renamed it from `exp2' to `exp22', and then it broke here:

  dualbus@debian:~/src/gnu/bash$ make -j$(nproc) -s
  make[1]: warning: -j4 forced in submake: resetting jobserver mode.
  
        ***********************************************************
        *                                                         *
        * GNU bash, version 5.0.0(1)-rc1 (x86_64-pc-linux-gnu)
        *                                                         *
        ***********************************************************
  
  making lib/glob/libglob.a in ./lib/glob
  make[1]: warning: -j4 forced in submake: resetting jobserver mode.
  smatch.c: In function ‘_fnmatch_fallback_wc’:
  smatch.c:318:11: error: implicit declaration of function ‘fnmatch’; did you 
mean ‘gmatch’? [-Werror=implicit-function-declaration]
     return (fnmatch ((const char *)w2, (const char *)w1, 0));
             ^~~~~~~
             gmatch


Which I believe is an actual issue and I assume the fix is along the lines of:

  dualbus@debian:~/src/gnu/bash$ git diff -- lib/
  diff --git a/lib/glob/smatch.c b/lib/glob/smatch.c
  index 3826c93e..9150a28e 100644
  --- a/lib/glob/smatch.c
  +++ b/lib/glob/smatch.c
  @@ -25,6 +25,7 @@
                                  
   #include "strmatch.h"
   #include <chartypes.h>
  +#include <fnmatch.h>
   
   #include "bashansi.h"
   #include "shmbutil.h"


I'm not sure what to do about `exp2' though. Personally, I'd love for these
functions to have slighly more meaningful names.


I also tried clang version 7.0.1-+rc3-2, which gives an additional error:

  making lib/sh/libsh.a in ./lib/sh
  (...)
  getenv.c:55:7: error: comparison of nonnull parameter 'name' equal to a null 
pointer is 'false' on first encounter [-Werror,-Wtautological-pointer-compare]
    if (name == 0 || *name == '\0')
        ^~~~    ~
  /usr/include/stdlib.h:631:50: note: declared 'nonnull' here
  extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;
                                                   ^
  /usr/include/x86_64-linux-gnu/sys/cdefs.h:293:44: note: expanded from macro 
'__nonnull'
  # define __nonnull(params) __attribute__ ((__nonnull__ params))


This is due to the stdlib.h header being pulled by bashansi.h in
lib/sh/getenv.c, thus, providing a function signature that doesn't match Bash's
re-definition of getenv():

  dualbus@debian:~/src/gnu/bash$ grep bashansi.h lib/sh/getenv.c 
  #include <bashansi.h>
  
  dualbus@debian:~/src/gnu/bash$ grep stdlib.h bashansi.h 
  #  include <stdlib.h>
  #  include "ansi_stdlib.h"


~~~


Additional information:

gcc:

  dualbus@debian:~/src/gnu/bash$ cc -v
  Using built-in specs.
  COLLECT_GCC=cc
  COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
  OFFLOAD_TARGET_NAMES=nvptx-none
  OFFLOAD_TARGET_DEFAULT=1
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Debian 8.2.0-12' 
--with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs 
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr 
--with-gcc-major-version-only --program-suffix=-8 
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--with-default-libstdcxx-abi=new --enable-gnu-unique-object 
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie 
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto 
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic 
--enable-offload-targets=nvptx-none --without-cuda-driver 
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu 
--target=x86_64-linux-gnu
  Thread model: posix
  gcc version 8.2.0 (Debian 8.2.0-12) 

clang:

  dualbus@debian:~/src/gnu/bash$ clang -v
  clang version 7.0.1-+rc3-2 (tags/RELEASE_701/rc3)
  Target: x86_64-pc-linux-gnu
  Thread model: posix
  InstalledDir: /usr/bin
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
  Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
  Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
  Candidate multilib: .;@m64
  Selected multilib: .;@m64



reply via email to

[Prev in Thread] Current Thread [Next in Thread]