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

No arm64e in fat layer binary #2858

Closed
wants to merge 2 commits into from
Closed
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
25 changes: 12 additions & 13 deletions .github/workflows/arch_dylib_sign.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"source": [
"target/aarch64-apple-darwin/release/libmirrord_layer.dylib",
"target/aarch64-apple-darwin/release/libmirrord_layer_arm64e.dylib",
"target/x86_64-apple-darwin/release/libmirrord_layer.dylib"
],
"bundle_id": "com.metalbear.mirrord",
"apple_id": {
"username": "@env:AC_USERNAME",
"password": "@env:AC_PASSWORD"
},
"sign": {
"application_identity": "Developer ID Application: METALBEAR TECH LTD (8W42TQ6PFA)"
}
"source": [
"target/aarch64-apple-darwin/release/libmirrord_layer.dylib",
"target/x86_64-apple-darwin/release/libmirrord_layer.dylib"
],
"bundle_id": "com.metalbear.mirrord",
"apple_id": {
"username": "@env:AC_USERNAME",
"password": "@env:AC_PASSWORD"
},
"sign": {
"application_identity": "Developer ID Application: METALBEAR TECH LTD (8W42TQ6PFA)"
}
}
12 changes: 2 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,9 @@ jobs:
brew install mitchellh/gon/gon
- name: build mirrord-layer x86-64
run: cargo +nightly-2024-09-12 build --release -p mirrord-layer --target=x86_64-apple-darwin
- name: build mirrord-layer macOS arm/arm64e
# Editing the arm64 binary, since arm64e can be loaded into both arm64 & arm64e
# >> target/debug/libmirrord_layer.dylib: Mach-O 64-bit dynamically linked shared library arm64
# >> magic bits: 0000000 facf feed 000c 0100 0000 0000 0006 0000
# >> After editing using dd -
# >> magic bits: 0000000 facf feed 000c 0100 0002 0000 0006 0000
# >> target/debug/libmirrord_layer.dylib: Mach-O 64-bit dynamically linked shared library arm64e
- name: build mirrord-layer macOS arm64
run: |
cargo +nightly-2024-09-12 build --release -p mirrord-layer --target=aarch64-apple-darwin
cp target/aarch64-apple-darwin/release/libmirrord_layer.dylib target/aarch64-apple-darwin/release/libmirrord_layer_arm64e.dylib
printf '\x02' | dd of=target/aarch64-apple-darwin/release/libmirrord_layer_arm64e.dylib bs=1 seek=8 count=1 conv=notrunc
- name: Sign layer binaries
env:
AC_USERNAME: ${{ secrets.APPLE_DEVELOPER }}
Expand All @@ -93,7 +85,7 @@ jobs:
- name: create universal target dir
run: mkdir -p /tmp/target/universal-apple-darwin/release
- name: create universal dylib
run: lipo -create -output /tmp/target/universal-apple-darwin/release/libmirrord_layer.dylib target/aarch64-apple-darwin/release/libmirrord_layer.dylib target/x86_64-apple-darwin/release/libmirrord_layer.dylib target/aarch64-apple-darwin/release/libmirrord_layer_arm64e.dylib
run: lipo -create -output /tmp/target/universal-apple-darwin/release/libmirrord_layer.dylib target/aarch64-apple-darwin/release/libmirrord_layer.dylib target/x86_64-apple-darwin/release/libmirrord_layer.dylib
- name: Sign layer universal
env:
AC_USERNAME: ${{ secrets.APPLE_DEVELOPER }}
Expand Down
1 change: 1 addition & 0 deletions changelog.d/2846.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The dymaic library injected by mirrord ("the layer") no longer inlcludes an arm64e binary in its fat binary on macos.
6 changes: 2 additions & 4 deletions scripts/build_fat_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
set -e
cargo build -p mirrord-layer --target=x86_64-apple-darwin
cargo build -p mirrord-layer --target=aarch64-apple-darwin
cp target/aarch64-apple-darwin/debug/libmirrord_layer.dylib target/aarch64-apple-darwin/debug/libmirrord_layer_arm64e.dylib
printf '\x02' | dd of=target/aarch64-apple-darwin/debug/libmirrord_layer_arm64e.dylib bs=1 seek=8 count=1 conv=notrunc
codesign -f -s - target/aarch64-apple-darwin/debug/libmirrord_layer_arm64e.dylib
codesign -f -s - target/aarch64-apple-darwin/debug/libmirrord_layer.dylib
codesign -f -s - target/x86_64-apple-darwin/debug/libmirrord_layer.dylib
mkdir -p target/universal-apple-darwin/debug
lipo -create -output target/universal-apple-darwin/debug/libmirrord_layer.dylib target/aarch64-apple-darwin/debug/libmirrord_layer.dylib target/x86_64-apple-darwin/debug/libmirrord_layer.dylib target/aarch64-apple-darwin/debug/libmirrord_layer_arm64e.dylib
lipo -create -output target/universal-apple-darwin/debug/libmirrord_layer.dylib target/aarch64-apple-darwin/debug/libmirrord_layer.dylib target/x86_64-apple-darwin/debug/libmirrord_layer.dylib
codesign -f -s - target/universal-apple-darwin/debug/libmirrord_layer.dylib
MIRRORD_LAYER_FILE=../../../target/universal-apple-darwin/debug/libmirrord_layer.dylib cargo build -p mirrord --target=aarch64-apple-darwin
MIRRORD_LAYER_FILE=../../../target/universal-apple-darwin/debug/libmirrord_layer.dylib cargo build -p mirrord --target=x86_64-apple-darwin
Expand Down
Loading