Menu

#2245 problem compiling sdcc on OSX - sbrk deprecated

closed-duplicate
nobody
sbrk (1)
Tools
5
2014-12-30
2014-02-02
Kio
No

when compiling sdcc from source on OSX 10.8 compilation of $SDCC/support/binutils fails:

gcc -DHAVE_CONFIG_H -I. -I. -I. -I../bfd -I./../bfd -I./../include -DLOCALEDIR="\"/tmp/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT nm.o -MD -MP -MF .deps/nm.Tpo -c -o nm.o nm.c
nm.c:1697:28: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations]
char lim = (char ) sbrk (0);
^
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void *sbrk(int);
^
1 error generated.

This can be fixed by adding command line option -Wno-deprecated e.g. export CFLAGS=-Wno-deprecated or maybe by improved handling of #ifdef HAVE_SBRK.

Tested with sdcc 3.3.0 and current svn trunk head.

Discussion

  • Maarten Brock

    Maarten Brock - 2014-02-02

    SDCC doesn't have support/binutils. It has support/sdbinutils instead. This is a fork of GNU binutils 2.23.2. Do they have a fix or workaround in place in a later version?

     
  • Maarten Brock

    Maarten Brock - 2014-02-02
     
  • Robert Baruch

    Robert Baruch - 2014-03-15

    I ran into this, also. sbrk is marked as deprecated as of OS 10.9

    Homebrew builds binutils by just specifying --disable-werror on the configure command line. For now that seems to be best, but if Apple actually chooses the nuclear option and removes sbrk completely, I'd look to Homebrew for the solution, since they're used by everyone.

    So anyway, for now, configure SDCC using ./configure --disable-werror

     
  • Ben Shi

    Ben Shi - 2014-12-30
    • status: open --> closed-duplicate
     
  • Ben Shi

    Ben Shi - 2014-12-30

    duplicated to #2279. -disable-werror is a walkaround, maybe a better way is to improve code quality to fit more strict clang/llvm.

     

Log in to post a comment.