[Bug 289746] no support for c++ standard library module

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 21 Sep 2025 21:37:04 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289746

            Bug ID: 289746
           Summary: no support for c++ standard library module
           Product: Base System
           Version: 14.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: ingo@hannover.ccc.de

C++23 specifies a new feature to import the std:: namespace as module (
https://wg21.link/P2465R3 ). This still needs some support from the build
system, but should be supported since clang 17; see
https://0xstubs.org/using-the-c23-std-module-with-clang-18/
And I can confirm it works with clang 19.1.7 on Devuan Linux.

However the FreeBSD base system is missing the std.cppm file needed to build
the std module. There is a std.cppm.in in
/usr/src/contrib/llvm-project/libcxx/modules/ but it never gets installes into
the base system.

There is a std.cppm in wasi-libcxx19 but that is for generatin web assembly
binaries and the processed file is not provided by the base sources.

As expected that std.cppm is incompatible with the base includes:

$ clang++ -std=c++23 -stdlib=libc++ -Wno-reserved-identifier
-Wno-reserved-module-identifier --precompile -o std.pcm
/usr/local/share/wasi-sysroot/share/libc++/v1/std.cppm
In file included from
/usr/local/share/wasi-sysroot/share/libc++/v1/std.cppm:230:
/usr/local/share/wasi-sysroot/share/libc++/v1/std/cfenv.inc:16:14: error: using
declaration referring to 'feclearexcept' with internal linkage cannot be
exported
   16 |   using std::feclearexcept _LIBCPP_USING_IF_EXISTS;
      |              ^
/usr/include/fenv.h:265:1: note: target of using declaration
  265 | feclearexcept(int __excepts)
      | ^
In file included from
/usr/local/share/wasi-sysroot/share/libc++/v1/std.cppm:230:
/usr/local/share/wasi-sysroot/share/libc++/v1/std/cfenv.inc:17:14: error: using
declaration referring to 'fegetexceptflag' with internal linkage cannot be
exported
   17 |   using std::fegetexceptflag _LIBCPP_USING_IF_EXISTS;
      |              ^
/usr/include/fenv.h:283:1: note: target of using declaration
  283 | fegetexceptflag(fexcept_t *__flagp, int __excepts)
      | ^
In file included from
/usr/local/share/wasi-sysroot/share/libc++/v1/std.cppm:230:
/usr/local/share/wasi-sysroot/share/libc++/v1/std/cfenv.inc:20:14: error: using
declaration referring to 'fetestexcept' with internal linkage cannot be
exported
   20 |   using std::fetestexcept _LIBCPP_USING_IF_EXISTS;
      |              ^
/usr/include/fenv.h:295:1: note: target of using declaration
  295 | fetestexcept(int __excepts)
      | ^
In file included from
/usr/local/share/wasi-sysroot/share/libc++/v1/std.cppm:230:
/usr/local/share/wasi-sysroot/share/libc++/v1/std/cfenv.inc:22:14: error: using
declaration referring to 'fegetround' with internal linkage cannot be exported
   22 |   using std::fegetround _LIBCPP_USING_IF_EXISTS;
      |              ^
/usr/include/fenv.h:111:1: note: target of using declaration
  111 | fegetround(void)
      | ^
In file included from
/usr/local/share/wasi-sysroot/share/libc++/v1/std.cppm:230:
/usr/local/share/wasi-sysroot/share/libc++/v1/std/cfenv.inc:23:14: error: using
declaration referring to 'fesetround' with internal linkage cannot be exported
   23 |   using std::fesetround _LIBCPP_USING_IF_EXISTS;
      |              ^
/usr/include/fenv.h:306:1: note: target of using declaration
  306 | fesetround(int __round)
      | ^
In file included from
/usr/local/share/wasi-sysroot/share/libc++/v1/std.cppm:230:
/usr/local/share/wasi-sysroot/share/libc++/v1/std/cfenv.inc:27:14: error: using
declaration referring to 'fesetenv' with internal linkage cannot be exported
   27 |   using std::fesetenv _LIBCPP_USING_IF_EXISTS;
      |              ^
/usr/include/fenv.h:328:1: note: target of using declaration
  328 | fesetenv(const fenv_t *__envp)
      | ^
6 errors generated.

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