Closed peterthomassen closed 9 months ago
Thanks for the report. I don't have this problem with gcc (Debian 13.2.0-7) 13.2.0
so I'm not sure yet it's really related to gcc13.
Does it work on the same Alpine version when you force the use of gcc12?
I'd rather guess that maybe the definition of struct stat64
has moved somewhere else on the newer Alpine version, so gcc13 thinks it's declared within libfaketime when it is just used by it. All the errors you get seem to be somehow related to this.
On my Debian machine, both stat
and stat64
are defined in /usr/include/asm-generic/stat.h
. How does this look on Alpine?
Does it compile without errors if you remove -DFAKE_STAT
from libfaketime's src/Makefile
?
Thank you for the pointers; indeed, it's an Alpine problem. For context, see this discussion and this commit, which seems to trigger the issue.
On my Debian machine, both
stat
andstat64
are defined in/usr/include/asm-generic/stat.h
. How does this look on Alpine?
It's in /usr/include/sys/stat.h, which is modified by the above commit.
Does it compile without errors if you remove
-DFAKE_STAT
from libfaketime'ssrc/Makefile
?
No, but there are significantly less errors then:
# make
make -C src all
make[1]: Entering directory '/usr/local/src/libfaketime/src'
cc -o libfaketime.o -c -std=gnu99 -Wall -Wextra -Werror -DFAKE_PTHREAD -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'/usr/local'"' -DLIBDIRNAME='"'/lib/faketime'"' -Wno-nonnull-compare libfaketime.c
libfaketime.c:191:72: error: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
191 | static int (*real_xstat64) (int, const char *, struct stat64 *);
| ^~~~~~
libfaketime.c:192:64: error: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
192 | static int (*real_fxstat64) (int, int , struct stat64 *);
| ^~~~~~
libfaketime.c:193:78: error: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
193 | static int (*real_fxstatat64) (int, int , const char *, struct stat64 *, int);
| ^~~~~~
libfaketime.c:194:72: error: 'struct stat64' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
194 | static int (*real_lxstat64) (int, const char *, struct stat64 *);
| ^~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:161: libfaketime.o] Error 1
make[1]: Leaving directory '/usr/local/src/libfaketime/src'
make: *** [Makefile:8: all] Error 2
Anyway, the solution is to not use Alpine 3.19 for building. Thanks!
I'm not quite sure how that qualifies as "a solution" for people actually using alpine 3.19/recent musl... But anyway, it looks like that while musl didn't keep the _FILE_OFFSET_BITS=64 glibc compat code, it kept _LARGEFILE64_SOURCE -- I've opened #453 that delays the problem by just adding that define for now.
When building with gcc 12 (e.g. Alpine 3.18), all is fine. With gcc 13 (e.g. Alpine 3.19), the following happens: