[MacPorts] #74423: libcxx: Fix compilation failures on legacy Darwin (i386/PowerPC) due to broken __atomic_locked utility layout

MacPorts noreply at macports.org
Sun Sep 13 05:23:21 UTC 2026


#74423: libcxx: Fix compilation failures on legacy Darwin (i386/PowerPC) due to
broken __atomic_locked utility layout
--------------------------------------+--------------------
 Reporter:  PotMJ                     |      Owner:  (none)
     Type:  defect                    |     Status:  new
 Priority:  Normal                    |  Milestone:
Component:  ports                     |    Version:
 Keywords:  __atomic_locked haspatch  |       Port:  libcxx
--------------------------------------+--------------------
 === Problem Description ===
 When compiling a simple C++ program utilizing the `-stdlib=libc++` flag on
 legacy Darwin platforms (specifically verified on OS X 10.5.8 Leopard
 targets running both i386 and PowerPC architectures with `gcc15`),
 compilation drops dead inside the internal header tree.

 The compilation pass fails on `__atomic_locked` due to missing or broken
 low-level symbol mappings for 32-bit atomic operations. While discovered
 during my `gcc15` testing passes, this issue impacts any toolchain pulling
 from this specific library track.

 === Solution ===
 The attached patch resolves this bottleneck directly inside the
 `include/__atomic_locked` structure. By introducing clean, vintage-safe
 fallback mapping tracks for the atomic utility wrappers, the compilation
 tree successfully aligns itself on 32-bit target architectures without
 regressing newer system builds.


 === Staging Notes for Leopard 10.5.8 Users ===
 As noticed in #64932, on Leopard the binaries did not automatically unpack
 for me from the installed `.tbz` archive. If you encounter missing library
 or header tracks, you must manually unpack the root system assets by
 running:

 {{{
 sudo tar -xf /opt/local/var/system_roots/libcxx-5.0.1-5.tgz -C /
 }}}

 You may also need to manually provide the include headers if the directory
 does not exist (it should be owned by MacPorts), however something like
 this might work :-

 {{{
 # Establish the missing system include directory slot
 sudo mkdir -p /opt/local/include/c++/v1

 # Synchronise the complete, modern LLVM 16 template headers into the new
 system lane
 sudo cp -Rv /opt/local/libexec/llvm-16/include/c++/v1/
 /opt/local/include/c++/v1/
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/74423>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list