Error using `bsd/stdlib.h` on musl when building minizip-ng
Hi,
I'm not sure if this is a minizip-ng or a libbsd issue, but I figured I'd file it here because if it is a minizip-ng issue, you might be able to give a hint as to how headers are possibly being misused.
When building minizip-ng with OpenSSL support off (-DMZ_OPENSSL=OFF
) on a musl system, I get the following:
FAILED: CMakeFiles/minizip-ng.dir/mz_strm.c.o
/usr/bin/x86_64-gentoo-linux-musl-gcc -DHAVE_ARC4RANDOM_BUF -DHAVE_BZIP2 -DHAVE_GETRANDOM -DHAVE_ICONV -DHAVE_INTTYPES_H -DHAVE_LIBBSD -DHAVE_LZMA -DHAVE_PKCRYPT -DHAVE_STDINT_H -DHAVE_ZLIB -DLZMA_API_STATIC -DMZ_EXPORTS -DMZ_ZIP_NO_CRYPTO -D_POSIX_C_SOURCE=200112L -I/usr/include/bsd -I/var/tmp/portage/sys-libs/minizip-ng-3.0.8/work/minizip-ng-3.0.8 -pipe -march=native -fno-diagnostics-color -O2 -fPIC -fno-diagnostics-color -std=gnu99 -MD -MT CMakeFiles/minizip-ng.dir/mz_strm.c.o -MF CMakeFiles/minizip-ng.dir/mz_strm.c.o.d -o CMakeFiles/minizip-ng.dir/mz_strm.c.o -c /var/tmp/portage/sys-libs/minizip-ng-3.0.8/work/minizip-ng-3.0.8/mz_strm.c
In file included from /usr/include/bsd/stdlib.h:32,
from /usr/include/bsd/stdlib.h:32,
[.. snipped many of the exact same line .. ]
from /var/tmp/portage/sys-libs/minizip-ng-3.0.8/work/minizip-ng-3.0.8/mz.h:164,
from /var/tmp/portage/sys-libs/minizip-ng-3.0.8/work/minizip-ng-3.0.8/mz_strm.c:11:
/usr/include/bsd/stdlib.h:32:20: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
32 | #include <stdlib.h>
| ^
/usr/include/bsd/stdlib.h:39:25: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
39 | #include <bsd/libutil.h>
| ^
/usr/include/bsd/stdlib.h:48:27: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
48 | #include <bsd/sys/cdefs.h>
| ^
/usr/include/bsd/stdlib.h:50:22: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
50 | #include <sys/stat.h>
| ^
/usr/include/bsd/stdlib.h:51:20: error: #include nested depth 200 exceeds maximum of 200 (use -fmax-include-depth=DEPTH to increase the maximum)
51 | #include <stdint.h>
| ^
/usr/include/bsd/stdlib.h:55:20: error: missing binary operator before token "("
55 | !__GLIBC_PREREQ(2, 36) || \
| ^
/usr/include/bsd/stdlib.h:53:14: error: expected ';' before 'void'
53 | __BEGIN_DECLS
| ^
| ;
......
61 | void arc4random_stir(void);
| ~~~~
/usr/include/bsd/stdlib.h:64:40: error: unknown type name 'int64_t'
64 | int dehumanize_number(const char *str, int64_t *size);
| ^~~~~~~
/usr/include/bsd/stdlib.h:1:1: note: 'int64_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?
+++ |+#include <stdint.h>
1 | /*
/usr/include/bsd/stdlib.h:69:22: error: unknown type name 'size_t'
69 | int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
| ^~~~~~
/usr/include/bsd/stdlib.h:1:1: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
+++ |+#include <stddef.h>
1 | /*
Initially reported downstream in Gentoo at https://bugs.gentoo.org/889266. Full log (bzip2'd) at https://bugs.gentoo.org/attachment.cgi?id=846360.
Any ideas what's going on? Thanks!