>Synopsis: wchar.h does not compile with clang++ -fmodules
>Category: library
>Environment:
System      : OpenBSD 8.0
Details     : OpenBSD 8.0 (GENERIC.MP) #117: Sat Oct  3 00:41:57 MDT 2026
[email protected]:/usr/src/sys/arch/arm64/compile/GENERIC.MP

Architecture: OpenBSD.arm64
Machine     : arm64
>Description:
wchar.h from libc++ does not compile with clang++ -fmodules with
redefinition errors.
>How-To-Repeat:
echo '#include <wchar.h>' | /usr/bin/clang -xc++ -fmodules -c - -o /dev/null
>Fix:
The problem appears related to the const-correctness overloads at the
bottom of the file. The following is a bodgy workaround:

--- /usr/include/c++/v1/wchar.h.orig    Sat Oct  3 17:45:17 2026
+++ /usr/include/c++/v1/wchar.h Sat Oct  3 17:52:29 2026
@@ -137,6 +137,7 @@

 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 #      if defined(__cplusplus) &&
!defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) &&
defined(_LIBCPP_PREFERRED_OVERLOAD)
+#if 0
 extern "C++" {
 inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcschr(const wchar_t*
__s, wchar_t __c) {
   return (wchar_t*)wcschr(__s, __c);
@@ -191,6 +192,7 @@
   return __libcpp_wmemchr(__s, __c, __n);
 }
 }
+#endif
 #      endif

 #      if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) ||
defined(__MVS__))

dmesg:
OpenBSD 8.0 (GENERIC.MP) #117: Sat Oct  3 00:41:57 MDT 2026
    [email protected]:/usr/src/sys/arch/arm64/compile/GENERIC.MP
real mem  = 67755433984 (64616MB)
avail mem = 65519521792 (62484MB)
random: good seed from bootblocks
mainbus0 at root: Apple Mac Studio (M2 Ultra, 2023)
efi0 at mainbus0: UEFI 2.10
efi0: Das U-Boot rev 0x20240100
cpu0 at mainbus0 mpidr 0: Apple Blizzard Max r1p0
cpu0: 128KB 64b/line 4-way L1 PIPT I-cache, 64KB 64b/line 8-way L1 D-cache
cpu0: 4096KB 128b/line 16-way L2 cache
cpu0: 
TLBIOS+IRANGE,TS+AXFLAG,FHM,DP,SHA3,RDM,Atomic,CRC32,SHA2+SHA512,SHA1,AES+PMULL,I8MM,BF16,SPECRES,SB,FRINTTS,GPI,LRCPC+LDAPUR,FCMA,JSCVT,API+EPAC2+FPAC,DPB+DCCVADP,ECV,SpecSEI,PAN+ATS1E1,LO,HPDS,VH,IDS,AT,CSV3,CSV2,DIT,RAS,AdvSIMD+HP,FP+HP,BT,SSBS+MSR
cpu1 at mainbus0 mpidr 1: Apple Blizzard Max r1p0
cpu1: 128KB 64b/line 4-way L1 PIPT I-cache, 64KB 64b/line 8-way L1 D-cache
cpu1: 4096KB 128b/line 16-way L2 cache
cpu2 at mainbus0 mpidr 2: Apple Blizzard Max r1p0
cpu2: 128KB 64b/line 4-way L1 PIPT I-cache, 64KB 64b/line 8-way L1 D-cache
cpu2: 4096KB 128b/line 16-way L2 cache
cpu3 at mainbus0 mpidr 3: Apple Blizzard Max r1p0
cpu3: 128KB 64b/line 4-way L1 PIPT I-cache, 64KB 64b/line 8-way L1 D-cache
cpu3: 4096KB 128b/line 16-way L2 cache
cpu4 at mainbus0 mpidr 10100: Apple Avalanche Max r1p0
cpu4: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu4: 16384KB 128b/line 16-way L2 cache
cpu5 at mainbus0 mpidr 10101: Apple Avalanche Max r1p0
cpu5: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu5: 16384KB 128b/line 16-way L2 cache
cpu6 at mainbus0 mpidr 10102: Apple Avalanche Max r1p0
cpu6: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu6: 16384KB 128b/line 16-way L2 cache
cpu7 at mainbus0 mpidr 10103: Apple Avalanche Max r1p0
cpu7: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu7: 16384KB 128b/line 16-way L2 cache
cpu8 at mainbus0 mpidr 10200: Apple Avalanche Max r1p0
cpu8: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu8: 16384KB 128b/line 16-way L2 cache
cpu9 at mainbus0 mpidr 10201: Apple Avalanche Max r1p0
cpu9: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu9: 16384KB 128b/line 16-way L2 cache
cpu10 at mainbus0 mpidr 10202: Apple Avalanche Max r1p0
cpu10: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu10: 16384KB 128b/line 16-way L2 cache
cpu11 at mainbus0 mpidr 10203: Apple Avalanche Max r1p0
cpu11: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu11: 16384KB 128b/line 16-way L2 cache
cpu12 at mainbus0 mpidr 800: Apple Blizzard Max r1p0
cpu12: 128KB 64b/line 4-way L1 PIPT I-cache, 64KB 64b/line 8-way L1 D-cache
cpu12: 4096KB 128b/line 16-way L2 cache
cpu13 at mainbus0 mpidr 801: Apple Blizzard Max r1p0
cpu13: 128KB 64b/line 4-way L1 PIPT I-cache, 64KB 64b/line 8-way L1 D-cache
cpu13: 4096KB 128b/line 16-way L2 cache
cpu14 at mainbus0 mpidr 802: Apple Blizzard Max r1p0
cpu14: 128KB 64b/line 4-way L1 PIPT I-cache, 64KB 64b/line 8-way L1 D-cache
cpu14: 4096KB 128b/line 16-way L2 cache
cpu15 at mainbus0 mpidr 803: Apple Blizzard Max r1p0
cpu15: 128KB 64b/line 4-way L1 PIPT I-cache, 64KB 64b/line 8-way L1 D-cache
cpu15: 4096KB 128b/line 16-way L2 cache
cpu16 at mainbus0 mpidr 10900: Apple Avalanche Max r1p0
cpu16: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu16: 16384KB 128b/line 16-way L2 cache
cpu17 at mainbus0 mpidr 10901: Apple Avalanche Max r1p0
cpu17: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu17: 16384KB 128b/line 16-way L2 cache
cpu18 at mainbus0 mpidr 10902: Apple Avalanche Max r1p0
cpu18: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu18: 16384KB 128b/line 16-way L2 cache
cpu19 at mainbus0 mpidr 10903: Apple Avalanche Max r1p0
cpu19: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu19: 16384KB 128b/line 16-way L2 cache
cpu20 at mainbus0 mpidr 10a00: Apple Avalanche Max r1p0
cpu20: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu20: 16384KB 128b/line 16-way L2 cache
cpu21 at mainbus0 mpidr 10a01: Apple Avalanche Max r1p0
cpu21: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu21: 16384KB 128b/line 16-way L2 cache
cpu22 at mainbus0 mpidr 10a02: Apple Avalanche Max r1p0
cpu22: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu22: 16384KB 128b/line 16-way L2 cache
cpu23 at mainbus0 mpidr 10a03: Apple Avalanche Max r1p0
cpu23: 192KB 64b/line 6-way L1 PIPT I-cache, 128KB 64b/line 8-way L1 D-cache
cpu23: 16384KB 128b/line 16-way L2 cache
"framebuffer" at mainbus0 not configured
"asc-firmware" at mainbus0 not configured
"asc-firmware" at mainbus0 not configured
"asc-firmware" at mainbus0 not configured
"flash" at mainbus0 not configured
"flash" at mainbus0 not configured
"uat-handoff" at mainbus0 not configured
"uat-pagetables" at mainbus0 not configured
"uat-ttbs" at mainbus0 not configured
apm0 at mainbus0
"smbios" at mainbus0 not configured
"opp-table-0" at mainbus0 not configured
"opp-table-1" at mainbus0 not configured
"opp-table-gpu" at mainbus0 not configured
"opp-table-gpu-cs" at mainbus0 not configured
"opp-table-gpu-afr" at mainbus0 not configured
"pmu-e" at mainbus0 not configured
"pmu-p" at mainbus0 not configured
agtimer0 at mainbus0: 24000 kHz
"clock-ref" at mainbus0 not configured
"clock-200m" at mainbus0 not configured
"clock-disp0" at mainbus0 not configured
"clock-dispext0" at mainbus0 not configured
"clock-dispext0_die1" at mainbus0 not configured
"clock-dispext1" at mainbus0 not configured
"clock-dispext1_die1" at mainbus0 not configured
"clock-ref-nco" at mainbus0 not configured
simplebus0 at mainbus0: "soc"
aplpmgr0 at simplebus0
aplpmgr1 at simplebus0
aplpmgr2 at simplebus0
aplpmgr3 at simplebus0
aplpmgr4 at simplebus0
aplintc0 at simplebus0 nirq 1961/4096 ndie 2/8
apldog0 at simplebus0
aplmbox0 at simplebus0
aplpinctrl0 at simplebus0
apldart0 at simplebus0 rev 2.0: 42 bits
aplmbox1 at simplebus0
apldart1 at simplebus0 rev 2.0: 42 bits
apldart2 at simplebus0 rev 2.0: 42 bits
apldart3 at simplebus0 rev 2.0: 42 bits
apldart4 at simplebus0 rev 2.0: 42 bits
aplpinctrl1 at simplebus0
aplefuse0 at simplebus0
aplpinctrl2 at simplebus0
aplpinctrl3 at simplebus0
apldart5 at simplebus0 rev 2.0: 42 bits
apldart6 at simplebus0 rev 2.0: 42 bits
apldart7 at simplebus0 rev 2.0: 42 bits
apldart8 at simplebus0 rev 2.0: 42 bits
apldart9 at simplebus0 rev 2.0: 42 bits
apldart10 at simplebus0 rev 2.0: 42 bits
apldart11 at simplebus0 rev 2.0: 42 bits
apldart12 at simplebus0 rev 2.0: 42 bits
aplnco0 at simplebus0
"power-management" at simplebus0 not configured
aplspmi0 at simplebus0
aplpmu0 at aplspmi0 sid 0xb
aplsmc0 at simplebus0
"display-subsystem" at simplebus0 not configured
apliic0 at simplebus0
iic0 at apliic0
tipd0 at iic0 addr 0x38
tipd1 at iic0 addr 0x3f
tipd2 at iic0 addr 0x3b
tipd3 at iic0 addr 0x3c
tipd4 at iic0 addr 0x39
tipd5 at iic0 addr 0x3a
apliic1 at simplebus0
iic1 at apliic1
sncodec0 at iic1 addr 0x38
apliic2 at simplebus0
iic2 at apliic2
"cirrus,cs42l84" at iic2 addr 0x4b not configured
aplspi0 at simplebus0
exuart0 at simplebus0
apldma0 at simplebus0
aplmca0 at simplebus0
"gpu" at simplebus0 not configured
aplpcie0 at simplebus0
pci0 at aplpcie0
ppb0 at pci0 dev 0 function 0 "Apple M1 PCIe" rev 0x01
pci1 at ppb0 bus 1
"Broadcom BCM4388" rev 0x04 at pci1 dev 0 function 0 not configured
vendor "Broadcom", unknown product 0x5f72 (class network subclass
miscellaneous, rev 0x04) at pci1 dev 0 function 1 not configured
ppb1 at pci0 dev 1 function 0 "Apple M1 PCIe" rev 0x01
pci2 at ppb1 bus 2
sdhc0 at pci2 dev 0 function 0 "Genesys Logic GL9755" rev 0x01: msi
sdhc0: SDHC 4.20, 50 MHz base clock
sdmmc0 at sdhc0: 4-bit, sd high-speed, mmc high-speed, dma
ppb2 at pci0 dev 2 function 0 "Apple M1 PCIe" rev 0x01
pci3 at ppb2 bus 3
aq0 at pci3 dev 0 function 0 "Aquantia AQC113" rev 0x03: msix, 8
queues, Atlantic2 B0, F/W version 1.3.27, address a4:fc:14:43:09:b7
ppb3 at pci0 dev 3 function 0 "Apple M1 PCIe" rev 0x01
pci4 at ppb3 bus 4
xhci0 at pci4 dev 0 function 0 "ASMedia ASM2142 xHCI" rev 0x00: msix, xHCI 1.10
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "ASMedia xHCI root hub" rev
3.00/1.00 addr 1
aplcpu0 at simplebus0
aplcpu1 at simplebus0
aplcpu2 at simplebus0
xhci1 at simplebus0, xHCI 1.10
usb1 at xhci1: USB revision 3.0
uhub1 at usb1 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
"phy" at simplebus0 not configured
xhci2 at simplebus0, xHCI 1.10
usb2 at xhci2: USB revision 3.0
uhub2 at usb2 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
"phy" at simplebus0 not configured
xhci3 at simplebus0, xHCI 1.10
usb3 at xhci3: USB revision 3.0
uhub3 at usb3 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
"phy" at simplebus0 not configured
xhci4 at simplebus0, xHCI 1.10
usb4 at xhci4: USB revision 3.0
uhub4 at usb4 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
"phy" at simplebus0 not configured
simplebus1 at mainbus0: "soc"
aplpmgr5 at simplebus1
aplpmgr6 at simplebus1
aplpmgr7 at simplebus1
aplpmgr8 at simplebus1
aplpmgr9 at simplebus1
apldart13 at simplebus1 rev 2.0: 42 bits, locked
apldart14 at simplebus1 rev 2.0: 42 bits, locked
aplmbox2 at simplebus1
aplpinctrl4 at simplebus1
aplefuse1 at simplebus1
aplpinctrl5 at simplebus1
aplpinctrl6 at simplebus1
apldart15 at simplebus1 rev 2.0: 42 bits
apldart16 at simplebus1 rev 2.0: 42 bits
apldart17 at simplebus1 rev 2.0: 42 bits
apldart18 at simplebus1 rev 2.0: 42 bits
aplmbox3 at simplebus1
aplcpu3 at simplebus1
aplcpu4 at simplebus1
aplcpu5 at simplebus1
apldcp0 at simplebus1
"phy" at simplebus1 not configured
xhci5 at simplebus1, xHCI 1.10
usb5 at xhci5: USB revision 3.0
uhub5 at usb5 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
"phy" at simplebus1 not configured
xhci6 at simplebus1, xHCI 1.10
usb6 at xhci6: USB revision 3.0
uhub6 at usb6 configuration 1 interface 0 "Generic xHCI root hub" rev
3.00/1.00 addr 1
"phy" at simplebus1 not configured
aplsart0 at simplebus1
aplns0 at simplebus1
nvme0 at aplns0: NVMe 1.1
nvme0: APPLE SSD AP1024Z, firmware 373.120., serial 0ba020e2c488e424
nvme0: unable to allocate hibernate io queue
scsibus0 at nvme0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <NVMe, APPLE SSD AP1024, 373.>
sd0: 954204MB, 4096 bytes/sector, 244276265 sectors
aplaudio0 at mainbus0
audio0 at aplaudio0
uhidev0 at uhub0 port 3 configuration 1 interface 0 "Lenovo TrackPoint
Keyboard II" rev 2.00/1.27 addr 2
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 6 key codes
wskbd0 at ukbd0: console keyboard
uhidev1 at uhub0 port 3 configuration 1 interface 1 "Lenovo TrackPoint
Keyboard II" rev 2.00/1.27 addr 2
uhidev1: iclass 3/1, 22 report ids
ums0 at uhidev1 reportid 1: 3 buttons, Z and W dir
wsmouse0 at ums0 mux 0
uhid0 at uhidev1 reportid 5: input=1, output=0, feature=0
ucc0 at uhidev1 reportid 16: 767 usages, 20 keys, array
wskbd1 at ucc0 mux 1
uhid1 at uhidev1 reportid 18: input=1, output=0, feature=0
uhid2 at uhidev1 reportid 19: input=7, output=0, feature=7
uhid3 at uhidev1 reportid 21: input=2, output=0, feature=0
uhid4 at uhidev1 reportid 22: input=2, output=0, feature=0
uhidev2 at uhub0 port 3 configuration 1 interface 2 "Lenovo TrackPoint
Keyboard II" rev 2.00/1.27 addr 2
uhidev2: iclass 3/0, 4 report ids
uhid5 at uhidev2 reportid 4: input=0, output=0, feature=31
vscsi0 at root
scsibus1 at vscsi0: 256 targets
softraid0 at root
scsibus2 at softraid0: 256 targets
root on sd0a (f33ffeebd79cac91.a) swap on sd0b dump on sd0b
simplefb0 at mainbus0: 1920x1080, 32bpp
wsdisplay0 at simplefb0 mux 1: console (std, vt100 emulation), using wskbd0
wskbd1: connecting to wsdisplay0
wsdisplay0: screen 1-5 added (std, vt100 emulation)

usbdevs:
Controller /dev/usb0:
addr 01: 1b21:0000 ASMedia, xHCI root hub
super speed, self powered, config 1, rev 1.00
driver: uhub0
addr 02: 17ef:60ee Lenovo, TrackPoint Keyboard II
full speed, power 100 mA, config 1, rev 1.27
driver: uhidev0
driver: uhidev1
driver: uhidev2
Controller /dev/usb1:
addr 01: 0000:0000 Generic, xHCI root hub
super speed, self powered, config 1, rev 1.00
driver: uhub1
Controller /dev/usb2:
addr 01: 0000:0000 Generic, xHCI root hub
super speed, self powered, config 1, rev 1.00
driver: uhub2
Controller /dev/usb3:
addr 01: 0000:0000 Generic, xHCI root hub
super speed, self powered, config 1, rev 1.00
driver: uhub3
Controller /dev/usb4:
addr 01: 0000:0000 Generic, xHCI root hub
super speed, self powered, config 1, rev 1.00
driver: uhub4
Controller /dev/usb5:
addr 01: 0000:0000 Generic, xHCI root hub
super speed, self powered, config 1, rev 1.00
driver: uhub5
Controller /dev/usb6:
addr 01: 0000:0000 Generic, xHCI root hub
super speed, self powered, config 1, rev 1.00
driver: uhub6

Reply via email to