Skip to content

Conversation

colinsullivan
Copy link
Collaborator

@colinsullivan colinsullivan commented Jul 3, 2025

Enables macOS arm 19 & 20
DRY DCMAKE_OSX_DEPLOYMENT_TARGET flag

Closes #76
Closes #77

Squashed commit of the following:

commit 91f1840
Author: Colin Sullivan <[email protected]>
Date:   Thu Jul 3 11:20:55 2025 -0700

    uncomment

commit d21315b
Author: Colin Sullivan <[email protected]>
Date:   Wed Jul 2 13:55:22 2025 -0700

    19 w macosx

commit f61824d
Author: Colin Sullivan <[email protected]>
Date:   Wed Jul 2 13:53:57 2025 -0700

    try 19 too

commit cda94cd
Author: Colin Sullivan <[email protected]>
Date:   Wed Jul 2 12:36:28 2025 -0700

    std static linking as a CXX flag

commit 1603f38
Author: Colin Sullivan <[email protected]>
Date:   Wed Jul 2 10:33:14 2025 -0700

    Try zstd static linking flag added to all macos builds

commit 8e6d2bf
Author: Colin Sullivan <[email protected]>
Date:   Wed Jul 2 10:32:31 2025 -0700

    Moves macOS target to shared MACOS_CMAKE_ARGS variable

commit 1ccf586
Merge: 5ed997e 8b0dab3
Author: Colin Sullivan <[email protected]>
Date:   Wed Jul 2 10:23:18 2025 -0700

    Merge remote-tracking branch 'upstream/master' into macos-arm-20

commit 5ed997e
Author: Colin Sullivan <[email protected]>
Date:   Wed Jun 25 16:14:10 2025 -0700

    comment other versions for testing

commit 233f508
Author: Colin Sullivan <[email protected]>
Date:   Wed Jun 25 16:13:31 2025 -0700

    unexclude macos-arm 20
@colinsullivan colinsullivan force-pushed the macos-arm-20-rebase branch from 3dc610f to f1ce96d Compare July 3, 2025 18:25
@colinsullivan
Copy link
Collaborator Author

@@ -74,7 +74,7 @@ jobs:
# Uses a macOS arm image here
# https://github.com/actions/runner-images
runner: macos-14
os-cmake-args: '-DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -flto" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 ${POSIX_CMAKE_ARGS} ${MACOS_CMAKE_ARGS} -DLLVM_TARGETS_TO_BUILD=AArch64'
os-cmake-args: '-DCMAKE_CXX_FLAGS="-static-libgcc -static-libstdc++ -flto -DZSTD_STATIC_LINKING_ONLY" ${POSIX_CMAKE_ARGS} ${MACOS_CMAKE_ARGS} -DLLVM_TARGETS_TO_BUILD=AArch64'
Copy link

Choose a reason for hiding this comment

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

the error you are showing is about libz.dylib -- I don't see this flag documented anywhere other than in facebook/folly where it refers to the zstd compression library they use.

Assuming the intent is to link libz aka zlib statically you will probably have to supply both compiler and linker directives to accomplish this.

However I think you should investigate the root cause of why it cannot locate the libz.dylib which is meant to be supplied by macOS. My theory posted on the other thread is that there is a CPU architecture mismatch of some kind

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes that helps , thank you...

Maybe my method of requesting arm hosts from GitHub is flawed ? I will look into that...

@colinsullivan colinsullivan marked this pull request as ready for review August 29, 2025 15:29
@colinsullivan
Copy link
Collaborator Author

Yay we've got macOS arm builds finally

CC @echoix @shenxianpeng

@echoix
Copy link
Contributor

echoix commented Aug 29, 2025

Good job!

@echoix
Copy link
Contributor

echoix commented Aug 29, 2025

If you look at the logs of the macOS 14 arm with llvm 19, what does the warnings at the end of the build step mean? (Object files built for newer->14 than linked ->10.15)

Is it problematic?

@colinsullivan
Copy link
Collaborator Author

If you look at the logs of the macOS 14 arm with llvm 19, what does the warnings at the end of the build step mean? (Object files built for newer->14 than linked ->10.15)

Is it problematic?

hmm I'll check this out - usually this is related to versioning of macOS and their supported APIs - I would think for our purposes it does not matter but could lead to compatibility issues on old macOS systems

@colinsullivan
Copy link
Collaborator Author

✅ Tested clang-format-14 on macOS 10.15.7 and macOS 13.6.3

@colinsullivan
Copy link
Collaborator Author

✅ Tested clang-format-19 on macOS 13.6.3 (arm)
❌ Tested clang-format-19 on macOS 10.15.7 (amd64) - here I got the libzstd.1.dylib error

@colinsullivan
Copy link
Collaborator Author

❌ Tested clang-format-19 on macOS 11.7.2 (amd64) - here I got the libzstd.1.dylib error too

@colinsullivan
Copy link
Collaborator Author

❌ Tested clang-format-19 on macOS 13.2.1 (amd64) - here I got the libzstd.1.dylib error too

Seems this is architecture related, not OS compatibility related, and the "integration" test in the repo does not succeed in catching it...

@kevin--
Copy link

kevin-- commented Sep 2, 2025

If you look at the logs of the macOS 14 arm with llvm 19, what does the warnings at the end of the build step mean? (Object files built for newer->14 than linked ->10.15)
Is it problematic?

hmm I'll check this out - usually this is related to versioning of macOS and their supported APIs - I would think for our purposes it does not matter but could lead to compatibility issues on old macOS systems

having a consistent CMAKE_OSX_DEPLOYMENT_TARGET for every target being built should resolve this setting. If you are supporting ARM, then you cannot go lower than macOS 11.0

I believe this warning could lead to crashes if you use new APIs on an older OS -- the macOS SDK will shim or replace OS calls that do not exist on older OS's when building, but does nothing if your API level and deployment target match.

How much this matters for the llvm codebase, I have no idea

Disable zstd and zlib for macos
@colinsullivan
Copy link
Collaborator Author

disabling zlib and zstd merged, this one should pass and I will merge it

@colinsullivan colinsullivan merged commit 1f39e46 into master Sep 5, 2025
193 of 234 checks passed
@colinsullivan colinsullivan deleted the macos-arm-20-rebase branch September 5, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS arm: v19 is disabled macOS arm: v20 is disabled
3 participants