Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ jobs:
- 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`

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.

#1906 is merged now, so this should use the "toolset" mechanism.

- name: Cache library deps
uses: actions/cache@v5
with:
Expand Down
6 changes: 3 additions & 3 deletions cmake/macos-static.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# in order to generate executables compatible with old macOS versions.
# See our `macos-static` CMake preset for how it's meant to be used.

# The `-mmacosx-version-min=10.9` flag ensures that the binary only uses APIs available on Mac OS X 10.9 Mavericks.
# 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.
Comment on lines +5 to 11
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.


# Mac OS X has always provided zlib, so we can safely link dynamically against it.
Expand Down
Loading