Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add arm64 builds for macOS #1

Merged
merged 1 commit into from
Jul 24, 2023
Merged

Add arm64 builds for macOS #1

merged 1 commit into from
Jul 24, 2023

Conversation

17451k
Copy link
Contributor

@17451k 17451k commented Jul 21, 2023

This is a PR for the changes proposed in dafny-lang/dafny#4304. It adds arm64 builds for macOS 11 and 12 for z3-4.12.2. I've tried to add arm64 builds for Linux as well, but it is not possible to do using mk_make.py script alone: it seems one should use cmake directly instead. So, maybe next time.

Also I've changed the naming scheme of the generated artifacts: it now includes the arch of the binary. This requires changes to the Dafny code.

Btw, GitHub Actions matrix looks a bit convoluted now, but I wasn't able to find a simpler way of adding 2 specific builds into it.

Copy link
Member

@atomb atomb left a comment

Choose a reason for hiding this comment

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

This is great. I honestly should have included architectures in the archive file names from the beginning, but I'm happy to have them now. We'll need to update Dafny in minor ways to take advantage of 4.12.2, anyway, so adapting it to the new archive names won't really be any extra work.

(cd build && make -j4 && cp z3$EXECUTABLE_EXT $BIN/$SOLVER$EXECUTABLE_EXT)
strip $BIN/$SOLVER$EXECUTABLE_EXT
$BIN/$SOLVER$EXECUTABLE_EXT --version

if [[ "$ARCH" == 'x64' ]] ; then
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason this doesn't work on arm64?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

arm64 binaries are produced by cross compilation on an x64 github machine, so we can't just run and test them without using some kind of emulation. Any attempt to run it will fail with the Bad CPU type in executable error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the future we can try to replace cross compilation with native arm64 builds using github/roadmap#528

@atomb
Copy link
Member

atomb commented Jul 21, 2023

Ah, it failed in the same way I noticed when I first tried to add 4.12.2. I might revert my earlier change. Would you be up for adapting this to 4.12.1 if I do that?

@atomb
Copy link
Member

atomb commented Jul 21, 2023

I've reset main to the pre-4.12.2 change. If you rebase on that and change all your 4.12.2 references to 4.12.1, it should all work.

@17451k
Copy link
Contributor Author

17451k commented Jul 22, 2023

Done!

@atomb atomb merged commit 3d9e7f9 into dafny-lang:main Jul 24, 2023
12 checks passed
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.

None yet

2 participants