Created attachment 684366 [details] build.log [...] FAILED: systemd-tmpfiles.standalone.p/src_tmpfiles_tmpfiles.c.o x86_64-gentoo-linux-musl-gcc -Isystemd-tmpfiles.standalone.p -I. -I../systemd-246 -Isrc/basic -I../systemd-246/src/basic -Isrc/boot -I../systemd-246/src/boot -Isrc/home -I../systemd-246/src/home -Isrc/shared -I../systemd-246/src/shared -Isrc/systemd -I../systemd-246/src/systemd -Isrc/journal -I../systemd-246/src/journal -Isrc/journal-remote -I../systemd-246/src/journal-remote -Isrc/nspawn -I../systemd-246/src/nspawn -Isrc/resolve -I../systemd-246/src/resolve -Isrc/timesync -I../systemd-246/src/timesync -I../systemd-246/src/time-wait-sync -Isrc/login -I../systemd-246/src/login -Isrc/udev -I../systemd-246/src/udev -Isrc/libudev -I../systemd-246/src/libudev -Isrc/core -I../systemd-246/src/core -Isrc/shutdown -I../systemd-246/src/shutdown -I../systemd-246/src/xdg-autostart-generator -I../systemd-246/src/libsystemd/sd-bus -I../systemd-246/src/libsystemd/sd-device -I../systemd-246/src/libsystemd/sd-event -I../systemd-246/src/libsystemd/sd-hwdb -I../systemd-246/src/libsystemd/sd-id128 -I../systemd-246/src/libsystemd/sd-netlink -I../systemd-246/src/libsystemd/sd-network -I../systemd-246/src/libsystemd/sd-resolve -Isrc/libsystemd-network -I../systemd-246/src/libsystemd-network -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -std=gnu99 -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Wno-format-signedness -Werror=undef -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wfloat-equal -Wsuggest-attribute=noreturn -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Werror=incompatible-pointer-types -Werror=format=2 -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wimplicit-fallthrough=5 -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Werror=overflow -Werror=shift-count-overflow -Werror=shift-overflow=2 -Wdate-time -Wnested-externs -Wno-maybe-uninitialized -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -ffunction-sections -fdata-sections -Werror=shadow -include config.h -Os -march=x86-64 -msse3 -mtune=athlon64-sse3 -MD -MQ systemd-tmpfiles.standalone.p/src_tmpfiles_tmpfiles.c.o -MF systemd-tmpfiles.standalone.p/src_tmpfiles_tmpfiles.c.o.d -o systemd-tmpfiles.standalone.p/src_tmpfiles_tmpfiles.c.o -c ../systemd-246/src/tmpfiles/tmpfiles.c In file included from ../systemd-246/src/tmpfiles/tmpfiles.c:21: ../systemd-246/src/basic/alloc-util.h:100:35: error: static declaration of 'reallocarray' follows non-static declaration 100 | _alloc_(2, 3) static inline void *reallocarray(void *p, size_t need, size_t size) { | ^~~~~~~~~~~~ In file included from ../systemd-246/src/tmpfiles/tmpfiles.c:11: /usr/include/stdlib.h:148:7: note: previous declaration of 'reallocarray' was here 148 | void *reallocarray (void *, size_t, size_t); | ^~~~~~~~~~~~ In file included from ../systemd-246/src/basic/fileio.h:9, from ../systemd-246/src/tmpfiles/tmpfiles.c:31: /usr/include/sys/fcntl.h:1:2: warning: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Wcpp] 1 | #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> | ^~~~~~~ ninja: build stopped: subcommand failed.
Created attachment 684369 [details] emerge --info
Building systemd-tmpfiles-246 seems an issue since I upgraded to musl-1.2.2-r1 and re-emerged world.
I don't think it's entirely musl-specific given looks a lot like bug #764041, seems varied options/tools may trigger it.
Hmm... interesting! I thought it was musl-specific as I hit 2 very similar issues there: https://github.com/gentoo/musl/issues/372 https://github.com/gentoo/musl/issues/373 Posted these 2 on the musl issue tracker as they were ::musl ebuilds.
Had a quick look on the source. musl-1.2.2 has *reallocarray defined in /usr/include/stdlib.h: [...] #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #include <alloca.h> char *mktemp (char *); int mkstemps (char *, int); int mkostemps (char *, int, int); void *valloc (size_t); void *memalign(size_t, size_t); int getloadavg(double *, int); int clearenv(void); #define WCOREDUMP(s) ((s) & 0x80) #define WIFCONTINUED(s) ((s) == 0xffff) void *reallocarray (void *, size_t, size_t); #endif [...] So for musl-1.2.2 .../systemd-246/src/basic/alloc-util.h defines *reallocarray via stdlib.h but afterwards tries to redefine it as a static variable: [...] #if !HAVE_REALLOCARRAY _alloc_(2, 3) static inline void *reallocarray(void *p, size_t need, size_t size) { if (size_multiply_overflow(size, need)) return NULL; return realloc(p, size * need ?: 1); } #endif [...] So at least on musl-1.2.2 it is clear why the build fails. On musl-1.2.1 no *reallocarray in stdlib.h so no problem.
Created attachment 686037 [details, diff] reallocarray.patch Based on Anarchy's musl-patch for networkmanager (https://github.com/gentoo/musl/commit/424c11684631ac417069214602b73a064524898d). Fixes build on musl-1.2.2-r1.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fad8143675dd45c9f725c02bd94bf8fe815851e3 commit fad8143675dd45c9f725c02bd94bf8fe815851e3 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2021-02-17 18:49:11 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2021-02-17 18:49:29 +0000 sys-apps/systemd-tmpfiles: fix build on recent musl Thanks-to: ernsteiswuerfel <erhard_f@mailbox.org> Closes: https://bugs.gentoo.org/766833 Package-Manager: Portage-3.0.14, Repoman-3.0.2 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> sys-apps/systemd-tmpfiles/files/musl-1.2.2.patch | 14 ++++++++++++++ sys-apps/systemd-tmpfiles/systemd-tmpfiles-246.ebuild | 1 + 2 files changed, 15 insertions(+)
thanks! seems to build fine, but I left patch conditional just in case, for musl systems only.
(In reply to Georgy Yakovlev from comment #8) > thanks! > seems to build fine, but I left patch conditional just in case, for musl > systems only. no need to make it conditional, it is just gonna check both headers to find the support, it will not break on glibc systems as it will find it in malloc.h
I already have conditional block for musl, because big musl patchset significantly changes some internals and we can't apply it on glibc systems at all. so no big loss to apply extra patch conditionally. normally I'd be against conditional patching ofc, but it's a special case. new versions do not need that patch at all.