[PATCH] newlib: install ftw.h only when libc/posix is built

Bernie Innocenti bernie@codewiz.org
Fri Oct 16 04:32:48 GMT 2026


ftw() and nftw() are built in libc/posix, which only cygwin, netware,
esp and powerpcle-pe enable through posix_dir.  libc/include/ftw.h is
installed for every target, though, so on the others (arm, riscv,
m68k-elf, ...) configure scripts find the header and then fail to link
against the missing functions.  gcc's gcov-tool, built to run on such a
target, is one case.

Leave the header out when posix_dir is empty, as is already done for the
rpc headers when xdr_dir is empty.

Fixes: d8ee63450642 ("FTW Port for Newlib")
Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Bernie Innocenti <bernie@codewiz.org>
---
 newlib/configure.host | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/configure.host b/newlib/configure.host
index 3c30bf8a7..86de81839 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -962,6 +962,11 @@ if [ "x${xdr_dir}" = "x" ]; then
 	noinclude="${noinclude} rpc/types.h rpc/xdr.h"
 fi
 
+# Remove ftw.h if posix_dir not specified: ftw() and nftw() are in libc/posix
+if [ "x${posix_dir}" = "x" ]; then
+	noinclude="${noinclude} ftw.h"
+fi
+
 # Have init/finit if not explicitly specified otherwise
 if [ "x${have_init_fini}" != "xno" ]; then
 	newlib_cflags="${newlib_cflags} -D_HAVE_INIT_FINI"
-- 
2.56.0



More information about the Newlib mailing list