public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [BUG] newlib-4.4.0 fails to build for m68k-elf
@ 2024-01-14 15:47 Mikael Pettersson
  2024-01-14 15:59 ` Joel Sherrill
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Pettersson @ 2024-01-14 15:47 UTC (permalink / raw)
  To: newlib

Building newlib-4.4.0 for m68k-unknown-elf fails with

m68k-unknown-elf-gcc -B/tmp/objdir/m68k-unknown-elf/newlib/ -isystem /tmp/objdir/m68k-unknown-elf/newlib/targ-include -isystem /tmp/newlib-4.4.0.20231231/newlib/libc/include -B/tmp/objdir/m68k-unknown-elf/libgloss/m68k -L/tmp/objdir/m68k-unknown-elf/libgloss/libnosys -L/tmp/newlib-4.4.0.20231231/libgloss/m68k    -g -O2 -O2 -I. -I/tmp/newlib-4.4.0.20231231/libgloss/m68k/.. -I./.. -idirafter /tmp/newlib-4.4.0.20231231/libgloss/m68k/../../include -c -g -O2 /tmp/newlib-4.4.0.20231231/libgloss/m68k/../read.c
/tmp/newlib-4.4.0.20231231/libgloss/m68k/../read.c:24:1: error: conflicting types for 'read'; have 'int(int,  void *, size_t)' {aka 'int(int,  void *, long unsigned int)'}
   24 | read (int fd,
      | ^~~~
In file included from /tmp/newlib-4.4.0.20231231/newlib/libc/include/unistd.h:4,
                 from /tmp/newlib-4.4.0.20231231/libgloss/m68k/../glue.h:16,
                 from /tmp/newlib-4.4.0.20231231/libgloss/m68k/../read.c:15:
/tmp/newlib-4.4.0.20231231/newlib/libc/include/sys/unistd.h:179:25: note: previous declaration of 'read' with type '_ssize_t(int,  void *, size_t)' {aka 'long int(int,  void *, long unsigned int)'}
  179 | _READ_WRITE_RETURN_TYPE read (int __fd, void *__buf, size_t __nbyte);
      |                         ^~~~
make[4]: *** [Makefile:528: read.o] Error 1
make[4]: Leaving directory '/tmp/objdir/m68k-unknown-elf/libgloss/m68k'
make[3]: *** [Makefile:4954: all-recursive] Error 1
make[3]: Leaving directory '/tmp/objdir/m68k-unknown-elf/libgloss'
make[2]: *** [Makefile:1225: all] Error 2
make[2]: Leaving directory '/tmp/objdir/m68k-unknown-elf/libgloss'
make[1]: *** [Makefile:9528: all-target-libgloss] Error 2
make[1]: Leaving directory '/tmp/objdir'
make: *** [Makefile:879: all] Error 2

Toolchain built from binutils-2.41 and gcc-13.2.0.

newlib-4.3.0 built fine, the issue started with:

# first new commit: [3d10b04f1ed9bf53c282081c88165951e8c32cec] Fix various c99/gcc-14 issues in generic libgloss code

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] newlib-4.4.0 fails to build for m68k-elf
  2024-01-14 15:47 [BUG] newlib-4.4.0 fails to build for m68k-elf Mikael Pettersson
@ 2024-01-14 15:59 ` Joel Sherrill
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Sherrill @ 2024-01-14 15:59 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: newlib

[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]

On Sun, Jan 14, 2024 at 9:47 AM Mikael Pettersson <mikpelinux@gmail.com>
wrote:

> Building newlib-4.4.0 for m68k-unknown-elf fails with
>
> m68k-unknown-elf-gcc -B/tmp/objdir/m68k-unknown-elf/newlib/ -isystem
> /tmp/objdir/m68k-unknown-elf/newlib/targ-include -isystem
> /tmp/newlib-4.4.0.20231231/newlib/libc/include
> -B/tmp/objdir/m68k-unknown-elf/libgloss/m68k
> -L/tmp/objdir/m68k-unknown-elf/libgloss/libnosys
> -L/tmp/newlib-4.4.0.20231231/libgloss/m68k    -g -O2 -O2 -I.
> -I/tmp/newlib-4.4.0.20231231/libgloss/m68k/.. -I./.. -idirafter
> /tmp/newlib-4.4.0.20231231/libgloss/m68k/../../include -c -g -O2
> /tmp/newlib-4.4.0.20231231/libgloss/m68k/../read.c
> /tmp/newlib-4.4.0.20231231/libgloss/m68k/../read.c:24:1: error:
> conflicting types for 'read'; have 'int(int,  void *, size_t)' {aka
> 'int(int,  void *, long unsigned int)'}
>    24 | read (int fd,
>       | ^~~~
> In file included from
> /tmp/newlib-4.4.0.20231231/newlib/libc/include/unistd.h:4,
>                  from
> /tmp/newlib-4.4.0.20231231/libgloss/m68k/../glue.h:16,
>                  from
> /tmp/newlib-4.4.0.20231231/libgloss/m68k/../read.c:15:
> /tmp/newlib-4.4.0.20231231/newlib/libc/include/sys/unistd.h:179:25: note:
> previous declaration of 'read' with type '_ssize_t(int,  void *, size_t)'
> {aka 'long int(int,  void *, long unsigned int)'}
>   179 | _READ_WRITE_RETURN_TYPE read (int __fd, void *__buf, size_t
> __nbyte);
>       |                         ^~~~
>

Per https://pubs.opengroup.org/onlinepubs/009604599/functions/read.html,
read() returns ssize_t. It looks like READ_WRITE_RETURN_TYPE should be
ssize_t.

--joel


> make[4]: *** [Makefile:528: read.o] Error 1
> make[4]: Leaving directory '/tmp/objdir/m68k-unknown-elf/libgloss/m68k'
> make[3]: *** [Makefile:4954: all-recursive] Error 1
> make[3]: Leaving directory '/tmp/objdir/m68k-unknown-elf/libgloss'
> make[2]: *** [Makefile:1225: all] Error 2
> make[2]: Leaving directory '/tmp/objdir/m68k-unknown-elf/libgloss'
> make[1]: *** [Makefile:9528: all-target-libgloss] Error 2
> make[1]: Leaving directory '/tmp/objdir'
> make: *** [Makefile:879: all] Error 2
>
> Toolchain built from binutils-2.41 and gcc-13.2.0.
>
> newlib-4.3.0 built fine, the issue started with:
>
> # first new commit: [3d10b04f1ed9bf53c282081c88165951e8c32cec] Fix various
> c99/gcc-14 issues in generic libgloss code
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-14 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-14 15:47 [BUG] newlib-4.4.0 fails to build for m68k-elf Mikael Pettersson
2024-01-14 15:59 ` Joel Sherrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).