[MacPorts] #74234: gmp @6.3.0_0+universal produces corrupted gmp.h (contains ar-archive bytes instead of C header), breaking mpfr configure
MacPorts
noreply at macports.org
Sat Jul 18 18:08:13 UTC 2026
#74234: gmp @6.3.0_0+universal produces corrupted gmp.h (contains ar-archive bytes
instead of C header), breaking mpfr configure
-----------------------------------------------------+--------------------
Reporter: pleumann | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Keywords: universal, gmp, mpfr, arm64, corruption | Port: gmp
-----------------------------------------------------+--------------------
(I wrote this ticket with Claude, which I also used for debugging the
problem. I hope that's ok. If there are questions or you need more
information, please don't hesitate to contact me.)
Installing gmp with the +universal variant (pulled in as a dependency of
gdb, which uses the muniversal PortGroup) reliably produces a corrupted
/opt/local/include/gmp.h. Instead of valid C header content, the file
contains the start of a Unix ar archive:
{{{
!<arch>
#1/20 1784278209 0 0 100644 28 `
__.SYMDEF SORTED
}}}
file identifies it as:
{{{
/opt/local/include/gmp.h: current ar archive random library
}}}
This looks like libgmp.a (or a .symdef archive member) being written to
the gmp.h destination path during the universal build's merge/lipo step,
instead of the actual header.
As a result, any port depending on gmp's headers fails to configure. In my
case, mpfr fails with:
{{{
/opt/local/include/gmp.h:1:1: error: expected identifier or '('
/opt/local/include/gmp.h:2:3: error: invalid filename for line marker
directive
configure:19720: error: gmp.h can't be found, or is unusable.
}}}
Steps to reproduce:
1) sudo port install gdb (or directly sudo port install gmp +universal)
2) Confirm the corrupted header:
{{{
head -5 /opt/local/include/gmp.h
}}}
3) Attempt to build mpfr against it:
{{{
sudo port clean mpfr
sudo port install mpfr +universal
}}}
→ configure fails with gmp.h can't be found, or is unusable.
What I've ruled out:
- Reinstalling gmp from scratch (port -f uninstall + reinstall) reproduces
the corruption every time the +universal variant is built; a plain
arm64-only gmp build (when I could get one, before discovering gdb's
muniversal PortGroup forces universal regardless of variants.conf)
produced a clean header every time.
- Full reinstall of Command Line Tools (sudo rm -rf
/Library/Developer/CommandLineTools && sudo xcode-select --install) — no
change, still corrupts.
- Complete removal and fresh reinstall of MacPorts itself (removed
/opt/local, LaunchDaemons, receipts, Tcl packages, then reinstalled from
the official .pkg) — no change, still corrupts on the very first
+universal gmp build.
- Setting -universal in /opt/local/etc/macports/variants.conf has no
effect here, because gdb's Portfile uses PortGroup muniversal 1.0, which
forces universal builds of gdb and its key dependencies (including gmp)
independent of the global variants file or the multiarch variant.
Given it reproduces identically on a completely clean MacPorts install and
a completely clean CLT install, this looks like a genuine bug in the
universal build/merge logic for gmp on this platform, rather than local
environment corruption.
Environment:
- macOS: Tahoe 26.5.2 (Build 25F84)
- Architecture: arm64 (Apple Silicon)
- MacPorts: [paste output of `port version`]
- Xcode CLT: Apple clang version 21.0.0 (clang-2100.1.1.101), freshly
reinstalled
- gmp port version: 6.3.0_0+universal
- mpfr port version: 4.2.2_0
port info --variants gmp returns:
variants: native, universal
--
Ticket URL: <https://trac.macports.org/ticket/74234>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list