diff options
author | Warner Losh <imp@FreeBSD.org> | 2024-05-26 17:38:30 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2024-05-26 17:38:30 +0000 |
commit | 364c014d9ba052758f32d2e3e1b0c297c64ac730 (patch) | |
tree | f9afeae0b7cbf01a31710b0a2b055d4a07b56060 | |
parent | 9c975a0d90f1ee5259e53bebb48f9d7a5c2dd376 (diff) | |
download | src-364c014d9ba052758f32d2e3e1b0c297c64ac730.tar.gz src-364c014d9ba052758f32d2e3e1b0c297c64ac730.zip |
cross-tools: fts has different types for cmp routine
fts has different types for its compare rotuine. Other systems, not
4.4BSD based, have a non-const version. Before we tested against
__GLIBC__, but now we test against __linux__ because that's Linux's API
and musl doesn't define __GLIBC__.
In addition, link against libftl on this platform since musl doesn't
include ftl routines in libc, but rather in libftl.
Co-authored-by: Val Packett <val@packett.cool>
Sponsored by: Netflix
Pull Request: https://github.com/freebsd/freebsd-src/pull/1066
Reviewed by: val_packett.cool
Differential Revision: https://reviews.freebsd.org/D45349
-rw-r--r-- | contrib/mandoc/config.h | 2 | ||||
-rw-r--r-- | lib/libpmc/pmu-events/jevents.c | 2 | ||||
-rw-r--r-- | tools/build/mk/Makefile.boot | 4 | ||||
-rw-r--r-- | usr.sbin/kldxref/kldxref.c | 2 |
4 files changed, 7 insertions, 3 deletions
diff --git a/contrib/mandoc/config.h b/contrib/mandoc/config.h index 91957717b3fc..ea6d70042670 100644 --- a/contrib/mandoc/config.h +++ b/contrib/mandoc/config.h @@ -13,7 +13,7 @@ #define HAVE_ENDIAN 0 #define HAVE_ERR 1 #define HAVE_FTS 1 -#if defined(__GLIBC__) || defined(__APPLE__) +#if defined(__linux__) || defined(__APPLE__) #define HAVE_FTS_COMPARE_CONST 0 #else #define HAVE_FTS_COMPARE_CONST 1 diff --git a/lib/libpmc/pmu-events/jevents.c b/lib/libpmc/pmu-events/jevents.c index 7059b31da2ba..628ed26c6f9d 100644 --- a/lib/libpmc/pmu-events/jevents.c +++ b/lib/libpmc/pmu-events/jevents.c @@ -1355,7 +1355,7 @@ err_out: #include <fts.h> static int -#if defined(__GLIBC__) || defined(__APPLE__) +#if defined(__linux__) || defined(__APPLE__) fts_compare(const FTSENT **a, const FTSENT **b) #else fts_compare(const FTSENT * const *a, const FTSENT * const *b) diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot index 9f63a7499592..b8a5c7780948 100644 --- a/tools/build/mk/Makefile.boot +++ b/tools/build/mk/Makefile.boot @@ -50,6 +50,10 @@ CFLAGS+= -I${SRCTOP}/tools/build/cross-build/include/linux CFLAGS+= -D_GNU_SOURCE=1 # Needed for sem_init, etc. on Linux (used by usr.bin/sort) LDADD+= -pthread +.if exists(/usr/lib/libfts.so) || exists(/usr/lib/libfts.a) || exists(/lib/libfts.so) || exists(/lib/libfts.a) +# Needed for fts_open, etc. on musl (used by usr.bin/grep) +LDADD+= -lfts +.endif .elif ${.MAKE.OS} == "Darwin" CFLAGS+= -D_DARWIN_C_SOURCE=1 diff --git a/usr.sbin/kldxref/kldxref.c b/usr.sbin/kldxref/kldxref.c index c88769ce1824..122551940ac7 100644 --- a/usr.sbin/kldxref/kldxref.c +++ b/usr.sbin/kldxref/kldxref.c @@ -745,7 +745,7 @@ usage(void) } static int -#if defined(__GLIBC__) || defined(__APPLE__) +#if defined(__linux__) || defined(__APPLE__) compare(const FTSENT **a, const FTSENT **b) #else compare(const FTSENT *const *a, const FTSENT *const *b) |