Hi,

gzip 1.14 build fails with GCC 4.1. I bisected the failure to gnulib commit
1911f9d4 (switching from AC_COMPILE_IFELSE to AC_LINK_IFELSE in endian_h.m4).

The error:
```
$ make lib/byteswap.o V=1
depbase=`echo lib/byteswap.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
mips64-octeon-linux-gnu-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I..
-I./lib  -I../lib    -g -O2 -MT lib/byteswap.o -MD -MP -MF
$depbase.Tpo -c -o lib/byteswap.o ../lib/byteswap.c &&\
mv -f $depbase.Tpo $depbase.Po
In file included from ../lib/byteswap.c:21:
./lib/byteswap.h:62: error: conflicting types for 'bswap_16'
./lib/endian.h:187: error: previous implicit declaration of 'bswap_16' was here
./lib/byteswap.h:76: error: conflicting types for 'bswap_32'
./lib/endian.h:197: error: previous implicit declaration of 'bswap_32' was here
./lib/byteswap.h:93: error: conflicting types for 'bswap_64'
./lib/endian.h:208: error: previous implicit declaration of 'bswap_64' was here
```

There's a circular dependency: `byteswap.c` -> `byteswap.h` -> `stdint.h` ->
`sys/types.h` -> `endian.h` (sys/types.h intends to include the system header,
but gets gnulib's substitute) -> `byteswap.h` (blocked by include guard).

endian.h uses bswap_* functions before they're declared, causing
implicit declarations.

Reverting the commit avoids compilation errors but restores the
original link error (`undefined reference to le64toh`).

config.log: https://gist.github.com/orgads/8fb08a5e5631ce863dcabb86c58e0fa3

In my case, commenting out #include <byteswap.h> in byteswap.c solves
the issue (guess they're inline).

- Orgad

Reply via email to