Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#2280 Won't build with gcc 4.9


I just tried building sdcc on my Debian GNU/Linux system. I have gcc 4.9.0 installed. I get lots of warnings, and the build fails due to errors:

make[5]: Entering directory '/home/philipp/sdcc/support/sdbinutils/bfd'
/bin/bash ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_asxxxx_vec -DBINDIR='"/usr/local/bin"' -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT opncls.lo -MD -MP -MF .deps/opncls.Tpo -c -o opncls.lo opncls.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_asxxxx_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT opncls.lo -MD -MP -MF .deps/opncls.Tpo -c opncls.c -o opncls.o
In file included from opncls.c:26:0:
opncls.c: In Funktion »bfd_fopen«:
bfd.h:529:65: Fehler: right-hand operand of comma expression has no effect [-Werror=unused-value]
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
opncls.c:261:5: Anmerkung: bei Substitution des Makros »bfd_set_cacheable«
bfd_set_cacheable (nbfd, TRUE);
cc1: Alle Warnungen werden als Fehler behandelt

This seems to be due to the -Werror.



  • Ben Shi
    Ben Shi

    -Werror seems to be a serious problem in newer gcc / clang ? Bug #2279 also due to that.

  • Since we don't have any control over when compilers (other than sdcc) emit a warning, I suggest we drop the -Werror.


  • Also, this being an issue with binutils, we might want to upgrade to a newer version of binutils (AFAIK sdcc binutils are basically gnu bintuils with a few small changes) soon.


  • Maarten Brock
    Maarten Brock

    Though I have objection to upgrading/synchronizing to a newer binutils, I did not get the impression this is already fixed upstream. They just recommend not to use -Werror as well and hope the deprecated function will not really disappear any time soon.

  • Erik Petrich
    Erik Petrich

    It has been fixed upstream, but it was a month after their last major release (2.24). You can see the changes in the current bleeding edge source, or take a look at the commit patch here:

    • Priority: 5 --> 8
  • IMO, using -Werror is stupid: It makes compilation conditional on what gcc developers might consider to be good or bad coding practice in the future. IMO, we should not use -Werro anywhere.
    I am also upgrading the priority of this bug, since gcc 4.9 seems to be the standard C compiler on GNU/Linux these days.


  • Erik Petrich
    Erik Petrich

    This was the problem building snapshots on derna after they upgraded their Debian distro. The simplest fix was to add --disable-werror to the configure command line (which is what I did since I don't have much free time at the moment). If I better understood how autoconf worked, I would change sdcc's configure.in so that it would append --disable-werror when it configures the binutils subpackage; that way there would be less to customize when resyncing our binutils with the latest upstream release and yet you wouldn't have to explicitly specify this when doing the top level configure.

  • Fixed in #9105 by disabling -Werror.


    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause