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

Support for MacOS Apple Silicon build for the ank CLI #80

Open
3 tasks
inf17101 opened this issue Nov 9, 2023 · 6 comments
Open
3 tasks

Support for MacOS Apple Silicon build for the ank CLI #80

inf17101 opened this issue Nov 9, 2023 · 6 comments
Labels
enhancement New feature or request. Issue will appear in the change log "Features" good first issue Good for newcomers
Milestone

Comments

@inf17101
Copy link
Contributor

inf17101 commented Nov 9, 2023

Description

Pre-built binaries ank CLI would be nice to have for MacOS. As the arm64 Silicon is quite dominant, we should support that in the first place.

Goals

Having MacOS pre-built binaries of the CLI in release.

Final result

Summary

To be filled when the final solution is sketched.

Tasks

  • Task 1
  • Task 2
  • ...
@inf17101 inf17101 added the enhancement New feature or request. Issue will appear in the change log "Features" label Nov 9, 2023
@inf17101 inf17101 self-assigned this Nov 9, 2023
@inf17101
Copy link
Contributor Author

inf17101 commented Nov 9, 2023

I have tested crossbuilds in our current devcontainer for MacOS x86_64 and arm64 Silicon and both builds work.

I have documented all the steps here below and the build(s) could be added to the CI / CD pipeline, but before few points must be clarified:

# Install build dependencies
apt install \
    clang \
    gcc \
    g++ \
   cmake \
    zlib1g-dev \
    libmpc-dev \
    libmpfr-dev \
    libgmp-dev

# Add macOS Rust target
rustup target add x86_64-apple-darwin aarch64-apple-darwin

mkdir target && cd target

git clone https://github.com/tpoechtrager/osxcross
cd osxcross
# download cross compilation MacOSX here https://github.com/joseluisq/macosx-sdks/releases
wget -nc https://github.com/joseluisq/macosx-sdks/releases/download/13.3/MacOSX13.3.sdk.tar.xz
mv MacOSX13.3.sdk.tar.xz tarballs/
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh


Insert the following to cargo.toml
[target.aarch64-apple-darwin]
linker = "aarch64-apple-darwin22.4-clang"
ar = "aarch64-apple-darwin22.4-ar"

[target.x86_64-apple-darwin]
linker = "x86_64-apple-darwin14-clang"
ar = "x86_64-apple-darwin14-ar"

If you've used a different macOS SDK version, you might need to replace darwin14 with darwinXY. To check what binary to use, look in osxcross/target/bin.

# Add --release to build in release mode
PATH="/workspaces/ankaios/target/osxcross/target/bin:$PATH" \
cargo build --target x86_64-apple-darwin

PATH="/workspaces/ankaios/target/osxcross/target/bin:$PATH" \
cargo build --target aarch64-apple-darwin

Which version of MacOS SDK do we want to support? I know that arm64 Silicon crossbuild requires macOS 11.0 SDK (or later)

Further I must check if we can optimize the workflow by for example preinstall clang into the devcontainer.

Also we must change the install script accordingly and the question is the testing on target(s).
I know that GH action supports x86_64 MacOS image , but not for arm64.

@inf17101 inf17101 added this to the backlog milestone Nov 9, 2023
@windsource
Copy link
Contributor

While I see the need for the Ankaios CLI running on Mac/darwin, I am not sure about the server and agent as we need a Linux to run those. Even if we create binaries for server and agent, in which context will those run?

@krucod3 krucod3 modified the milestones: backlog, v0.5 May 2, 2024
@krucod3
Copy link
Contributor

krucod3 commented May 2, 2024

@windsource also suggested windows support for the CLI

@krucod3 krucod3 changed the title Support for MacOS x86_64 and arm64 Silicon build Support for MacOS and Windows x86_64 and arm64 Silicon build for the ank CLI Jun 26, 2024
@windsource
Copy link
Contributor

I propose to add the following variants to the release which contain the ank resp. ank.exe file:

  • ank_cli_darwin_arm64.tgz
  • ank_cli_darwin_amd64.tgz
  • ank_cli_windows_amd64.zip
  • ank_cli_windows_arm64.zip

The last variant is for the growing number of laptops with Snapdragon X CPUs.

In order not to blow up the dev container maybe we can add the toolchains on the fly in Github action.

@krucod3 krucod3 added the good first issue Good for newcomers label Aug 6, 2024
@inf17101 inf17101 removed their assignment Aug 6, 2024
@windsource
Copy link
Contributor

When we support the CLI for Windows, shell completions must be adapted as well for Powershell and Cmd.

@krucod3 krucod3 modified the milestones: v0.5, v0.6 Oct 29, 2024
@windsource windsource changed the title Support for MacOS and Windows x86_64 and arm64 Silicon build for the ank CLI Support for MacOS Apple Silicon build for the ank CLI Dec 3, 2024
@windsource
Copy link
Contributor

I have spitted the Windows part in a new issue #419. This issue keeps existing for MacOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request. Issue will appear in the change log "Features" good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants