[Bug 295589] LLVM futures and _LIBCPP_REMOVE_TRANSITIVE_INCLUDES now: vs. buildworld

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 25 May 2026 21:46:48 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295589

            Bug ID: 295589
           Summary: LLVM futures and _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
                    now: vs. buildworld
           Product: Base System
           Version: 16.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: marklmi26-fbsd@yahoo.com
                CC: jhb@FreeBSD.org

[There is no "Component" to reference toolchain with
and "standards" did not seem appropriate. So I guessed
bin. I do not have control of Assignee directly. I
picked 16.0-CURRENT because it progressed to being
LLVM21 based.]

https://discourse.llvm.org/t/rfc-remove-unused-transitive-includes-from-the-libc-headers/90157/3

is about libc++ cleaning up its header pollution by removing
unused transitive includes, with plans to make the issue
non-optional in llvm24.

For now, something like:

CXXFLAGS.clang+= -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES

avoids the libc++ transitive includes for the
_LIBCPP_STD_VER targeted.

In my quick tests, kernel-toolchain and build kernel
built just fine.

But buildworld did not get far and so seems to be
working via header pollution in normal use, at least
for libutil++ where it stopped (so I cc'd jhb@, not
intending overall coverage):

. . .
Building static sysdecode library
Building
/usr/obj/BUILDs/main-ZNV4-nodbg-clang/usr/main-src/amd64.amd64/lib/libutil++/stringf.o
/usr/main-src/lib/libutil++/stringf.cc:21:3: error: use of undeclared
identifier 'errno'
   21 |                 errno = ENOMEM;
      |                 ^~~~~
/usr/main-src/lib/libutil++/stringf.cc:21:11: error: use of undeclared
identifier 'ENOMEM'
   21 |                 errno = ENOMEM;
      |                         ^~~~~~
/usr/main-src/lib/libutil++/stringf.cc:24:3: error: use of undeclared
identifier 'errno'
   24 |                 errno = EFBIG;
      |                 ^~~~~
/usr/main-src/lib/libutil++/stringf.cc:24:11: error: use of undeclared
identifier 'EFBIG'
   24 |                 errno = EFBIG;
      |                         ^~~~~
4 errors generated.
*** Error code 1

Stop.
make[5]: stopped making "all" in /usr/main-src/lib/libutil++
.ERROR_TARGET='stringf.o'
.ERROR_META_FILE='/usr/obj/BUILDs/main-ZNV4-nodbg-clang/usr/main-src/amd64.amd64/lib/libutil++/stringf.o.meta'
.MAKE.LEVEL='5'
MAKEFILE=''
.MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose'
_ERROR_CMD='c++  -target x86_64-unknown-freebsd16.0
--sysroot=/usr/obj/BUILDs/main-ZNV4-nodbg-clang/usr/main-src/amd64.amd64/tmp
-B/usr/obj/BUILDs/main-ZNV4-nodbg-clang/usr/main-src/amd64.amd64/tmp/usr/bin 
-O2 -pipe -fno-common -DNDEBUG -g -gz=zlib -Wno-format-zero-length
-fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W
-Wno-unused-parameter -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings
-Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wdate-time
-Wmissing-variable-declarations -Wthread-safety -Wno-empty-body
-Wno-string-plus-int -Wno-unused-const-variable
-Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch
-Qunused-arguments    -g -gz=zlib -std=gnu++17  -Wno-c++20-extensions
-Wno-c++23-lambda-attributes -Wno-nullability-completeness 
-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES    -c
/usr/main-src/lib/libutil++/stringf.cc -o stringf.o;'
. . .

NOTE:

The experiments are preliminary and used my personal
build environment for my personal kernel and world
builds.

Nor was I attempting to fix anything, just getting an
idea of the status for the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.