Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ci): force Xcode linker for macOS desktop (#5574)

Sean Ayeadf0a47f212a
diff --git a/.github/workflows/build_desktop_on_tag.yml b/.github/workflows/build_desktop_on_tag.yml
index 15ee947ed5..86e5430305 100644
--- a/.github/workflows/build_desktop_on_tag.yml
+++ b/.github/workflows/build_desktop_on_tag.yml
@@ -275,7 +275,11 @@ jobs:
- name: Build DMG with Nix
run: |
set -euo pipefail
- nix build --impure --option sandbox false --print-build-logs ".#packages.aarch64-darwin.tauri-desktop-dmg"
+
+ nix build --impure --option sandbox false --print-build-logs \
+ ".#packages.aarch64-darwin.tauri-desktop-apple-linker-smoke"
+ nix build --impure --option sandbox false --print-build-logs \
+ ".#packages.aarch64-darwin.tauri-desktop-dmg"
shell: bash
- name: Collect DMG artifact
run: |
diff --git a/.github/workflows/build_dmg_on_tag.yml b/.github/workflows/build_dmg_on_tag.yml
index fa605875f4..310586a704 100644
--- a/.github/workflows/build_dmg_on_tag.yml
+++ b/.github/workflows/build_dmg_on_tag.yml
@@ -102,7 +102,11 @@ jobs:
- name: Build DMG with Nix
run: |
set -euo pipefail
- nix build --impure --option sandbox false --print-build-logs ".#packages.aarch64-darwin.tauri-desktop-dmg"
+
+ nix build --impure --option sandbox false --print-build-logs \
+ ".#packages.aarch64-darwin.tauri-desktop-apple-linker-smoke"
+ nix build --impure --option sandbox false --print-build-logs \
+ ".#packages.aarch64-darwin.tauri-desktop-dmg"
shell: bash
- name: Collect DMG artifact
run: |
diff --git a/nix/tauri-desktop.nix b/nix/tauri-desktop.nix
index d1315cfb1c..398b96f904 100644
--- a/nix/tauri-desktop.nix
+++ b/nix/tauri-desktop.nix
@@ -506,12 +506,49 @@
};
};
tauriDesktopDmgSigningIdentity = builtins.getEnv "APPLE_SIGNING_IDENTITY";
+ tauriDesktopDmgAppleLd = pkgs.writeShellScriptBin "ld" ''
+ appleLd=$(/usr/bin/xcrun --sdk macosx --find ld)
+ if [ ! -x "$appleLd" ]; then
+ echo "xcrun did not return an executable Apple linker: $appleLd" >&2
+ exit 1
+ fi
+ case "$appleLd" in
+ /nix/store/*)
+ echo "xcrun unexpectedly selected a Nix linker: $appleLd" >&2
+ exit 1
+ ;;
+ esac
+ if [ -n "''${TAURI_DESKTOP_APPLE_LD_MARKER:-}" ]; then
+ printf '%s\n' "$appleLd" > "$TAURI_DESKTOP_APPLE_LD_MARKER"
+ fi
+ exec "$appleLd" "$@"
+ '';
tauriDesktopDmgAppleLinker = pkgs.writeShellScript "tauri-desktop-apple-linker" ''
- # Apple clang looks up `ld` on PATH. Keep Nix's cctools wrapper from
- # intercepting the link by putting the native macOS tools first.
- export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
- exec /usr/bin/clang -B/usr/bin "$@"
+ # Point clang at a known-present ld shim. The macOS clang driver ignored
+ # /usr/bin in -B/PATH and otherwise kept selecting Nix's cctools wrapper.
+ export PATH="${tauriDesktopDmgAppleLd}/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
+ exec /usr/bin/clang -B"${tauriDesktopDmgAppleLd}/bin" "$@"
'';
+ tauriDesktopDmgAppleLinkerSmoke = pkgs.stdenv.mkDerivation {
+ name = "tauri-desktop-apple-linker-smoke";
+ dontUnpack = true;
+ buildPhase = ''
+ cat > smoke.c <<'EOF'
+ int main(void) { return 0; }
+ EOF
+ export TAURI_DESKTOP_APPLE_LD_MARKER="$PWD/apple-ld-used"
+ ${tauriDesktopDmgAppleLinker} -v smoke.c -o smoke
+ if [ ! -s "$TAURI_DESKTOP_APPLE_LD_MARKER" ]; then
+ echo "Apple clang did not invoke the xcrun-backed ld shim" >&2
+ exit 1
+ fi
+ echo "Apple linker smoke test used $(cat "$TAURI_DESKTOP_APPLE_LD_MARKER")"
+ ./smoke
+ '';
+ installPhase = ''
+ touch "$out"
+ '';
+ };
tauriDesktopDmgConfig = builtins.toJSON (
lib.recursiveUpdate
{
@@ -830,6 +867,7 @@
// lib.optionalAttrs isAarch64Darwin {
tauri-frontend = frontend;
tauri-desktop-dmg = tauriDesktopDmg;
+ tauri-desktop-apple-linker-smoke = tauriDesktopDmgAppleLinkerSmoke;
tauri-desktop-cargo-artifacts = tauri.cargoArtifacts;
};
};
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/build_dmg.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/build_dmg.sh
index c36b3793a1..9d3d490520 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/build_dmg.sh
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/build_dmg.sh
@@ -1,2 +1,6 @@
set -euo pipefail
-nix build --impure --option sandbox false --print-build-logs ".#packages.aarch64-darwin.tauri-desktop-dmg"
+
+nix build --impure --option sandbox false --print-build-logs \
+ ".#packages.aarch64-darwin.tauri-desktop-apple-linker-smoke"
+nix build --impure --option sandbox false --print-build-logs \
+ ".#packages.aarch64-darwin.tauri-desktop-dmg"