The header file sysctl.h uses BEGIN_DECLS/END_DECLS which are not defined by musl.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The header file sysctl.h uses BEGIN_DECLS/END_DECLS which are not defined by musl.
I don't understand. What's the issue?
The issue here is that the header file "sysctl.h" uses some macros (BEGIN_DECLS/END_DECLS) which are only defined by glibc and not by musl libc (refer to https://wiki.musl-libc.org/faq.html). Therefore, when we build with musl libc, we are seeing the following build failures.
usr/include/sys/sysctl.h:65:1: error: unknown type name '__BEGIN_DECLS' __BEGIN_DECLS ^
This patch tries to guard the include of sysctl.h with !defined(_LIBCPP_HAS_MUSL_LIBC) so that the header file is not included when musl libc is used. We started to see the libcxx build failure above after 477a687 landed. 477a687 removed some #if guards which seem to have exposed the issue. Before 477a687, those guards actually prevented sysctl.h from being included in our build. However, I think the root cause is not 477a687, but the unconditional include of sysctl.h. I hope this gives a little bit more background on what this patch is trying to fix.
Can you please let me know if https://reviews.llvm.org/D92135 solves your issue? I believe https://reviews.llvm.org/D92135 is superior, since it also simplifies our implementation to use POSIX functionality.