From fba998a3d897e6297baca74068e4ec1db7adaeec Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Mon, 22 Aug 2022 22:02:53 +0100 Subject: [PATCH] tools/build: Unbreak bmake bootstrap on Linux Currently make.py has a hack to add the cross-build headers to the include search path when bootstrapping bmake on Linux (but not macOS). This is a bit of an abuse of these headers, and e9ba1fd5eda2 was not prepared for this, since sys/bitcount.h won't exist in that instance (it gets copied into WORLDTMP during the legacy build). Work around this until we can wean the bmake bootstrap off using these headers by not including sys/bitcount.h when it doesn't exist. Fixes: e9ba1fd5eda2 ("tools/build: Provide FreeBSD's bitstring API when cross-building") --- tools/build/cross-build/include/common/sys/types.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/build/cross-build/include/common/sys/types.h b/tools/build/cross-build/include/common/sys/types.h index 82436e7e9224..0bfe2bac2aea 100644 --- a/tools/build/cross-build/include/common/sys/types.h +++ b/tools/build/cross-build/include/common/sys/types.h @@ -69,7 +69,15 @@ struct cap_rights; typedef struct cap_rights cap_rights_t; +/* + * make.py uses these headers during the bmake bootstrap on Linux only, at + * which point sys/bitcount.h won't yet exist, so don't include it there. + * + * TODO: Untangle this mess. + */ +#if __has_include() /* Needed for bitstring */ #include +#endif #endif