Skip to content

Target an even older version of macOS#1948

Draft
ISSOtm wants to merge 1 commit intogbdev:masterfrom
ISSOtm:oldass-macos
Draft

Target an even older version of macOS#1948
ISSOtm wants to merge 1 commit intogbdev:masterfrom
ISSOtm:oldass-macos

Conversation

@ISSOtm
Copy link
Copy Markdown
Member

@ISSOtm ISSOtm commented Apr 14, 2026

We can, so let's not ask if we should!

Okay, so, turns out that Apple's linker just... throws an assertion failure:

ld: warning: support for macOS with 10.4 minimum deployment target is deprecated and will be removed in future release
0  0x104707474  __assert_rtn + 140
1  0x104714158  ld::passes::stubs::arm::StubHelperAtom::StubHelperAtom(ld::passes::stubs::Pass&, ld::Atom const&, ld::Atom const*, bool) (.cold.1) + 0
2  0x10465ea48  ld::passes::stubs::x86_64::classic::StubHelperAtom::~StubHelperAtom() + 0
3  0x10465bcd4  ld::passes::stubs::Pass::makeStub(ld::Atom const&, bool) + 4740
4  0x10465cef4  ld::passes::stubs::Pass::process(ld::Internal&) + 1396
5  0x10465d42c  ld::passes::stubs::doPass(Options const&, ld::Internal&) + 100
6  0x1044ff028  main + 664
A linker snapshot was created at:
    /tmp/script-x86_64.out-2026-04-13-230001.ld-snapshot
ld: Assertion failed: (targetAtom != NULL), function Fixup, file ld.hpp, line 1045.

So we have to use LLD instead, which needs to be installed explicitly. I'm doing it as a bodge in the initial version of this PR, as I want to use the “toolset” mechanism from #1906 to do that properly.

We can, so let's not ask if we should!
@ISSOtm ISSOtm added enhancement Typically new features; lesser priority than bugs builds This affects the build process or release artifacts labels Apr 14, 2026
- name: Install deps
run: |
./.github/scripts/install_deps.sh macos
brew install lld
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if this is meant as a temporary solution prior to #1906, it's still a niche enough use case that it should be clearly commented.

Suggested change
brew install lld
brew install lld # Apple's linker cannot support Mac OS X 10.4, so we use `lld`

Comment thread cmake/macos-static.cmake
Comment on lines +5 to 11
# The `-mmacosx-version-min=10.4` flag ensures that the binary only uses APIs available on Mac OS X 10.4 Tiger.
# The `-arch` flags build a "fat binary" that works on both Apple architectures:
# older Intel x64 Macs and newer ARM "Apple Silicon" ones.
set(secret_sauce -mmacosx-version-min=10.9 "SHELL:-arch x86_64" "SHELL:-arch arm64") # Avoid `-arch` being dedup'd.
set(secret_sauce -mmacosx-version-min=10.4 "SHELL:-arch x86_64" "SHELL:-arch arm64") # Avoid `-arch` being dedup'd.
add_compile_options(${secret_sauce})
add_link_options(${secret_sauce})
add_link_options(${secret_sauce} -fuse-ld=lld) # Apple's linker just crashes.
set(PNG_HARDWARE_OPTIMIZATIONS OFF) # These do not play well with a dual-arch build.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's never been a problem with Apple's ld on 10.9 or above, and supporting 10.9 Mavericks from 2013 is already niche enough -- so any changes that are needed for 10.4 Tiger from 2005, over two decades ago, really ought to be explained.

Suggested change
# The `-mmacosx-version-min=10.4` flag ensures that the binary only uses APIs available on Mac OS X 10.4 Tiger.
# The `-arch` flags build a "fat binary" that works on both Apple architectures:
# older Intel x64 Macs and newer ARM "Apple Silicon" ones.
set(secret_sauce -mmacosx-version-min=10.9 "SHELL:-arch x86_64" "SHELL:-arch arm64") # Avoid `-arch` being dedup'd.
set(secret_sauce -mmacosx-version-min=10.4 "SHELL:-arch x86_64" "SHELL:-arch arm64") # Avoid `-arch` being dedup'd.
add_compile_options(${secret_sauce})
add_link_options(${secret_sauce})
add_link_options(${secret_sauce} -fuse-ld=lld) # Apple's linker just crashes.
set(PNG_HARDWARE_OPTIMIZATIONS OFF) # These do not play well with a dual-arch build.
# The `-mmacosx-version-min=10.4` flag ensures that the binary only uses APIs available on Mac OS X 10.4 Tiger.
# The `-arch` flags build a "fat binary" that works on both Apple architectures:
# older Intel x64 Macs and newer ARM "Apple Silicon" ones.
set(secret_sauce -mmacosx-version-min=10.4 "SHELL:-arch x86_64" "SHELL:-arch arm64") # Avoid `-arch` being dedup'd.
add_compile_options(${secret_sauce})
# The `-fuse-ld=lld` flag specifies an alternative to Apple's linker, because recent versions warn that
# "support for macOS with 10.4 minimum deployment target is deprecated and will be removed in future release",
# and may crash with an assertion failure.
add_link_options(${secret_sauce} -fuse-ld=lld)
set(PNG_HARDWARE_OPTIMIZATIONS OFF) # These do not play well with a dual-arch build.

@Rangi42 Rangi42 added this to the 1.0.2 milestone Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds This affects the build process or release artifacts enhancement Typically new features; lesser priority than bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants