Skip to content

Commit 036b933

Browse files
huydhnfacebook-github-bot
authored andcommitted
Reinstall buck2 arm64 binary on MacOS if the wrong version (x86) is installed (#129)
Summary: This fixes the flaky linking issue on MacOS where the x86 version of `libtorch.dylib` instead of the correct arm64 version. The root cause turns out to be buck2 binary itself where its x86 version was wrongly installed on some runners (probably my fault when adding macos support). With the current logic, buck2 is installed only once when the binary isn't there, so when a wrong version sneaks in, it stays and causes troubles for all future jobs. The fix here is to check for the arch of the binary to ensure that we have the correct 64-bit arm64 buck2 installed. Pull Request resolved: #129 Test Plan: Confirm with a case where buck2 (x86) was reinstalled with the correct arch (arm64) https://github.com/pytorch/executorch/actions/runs/5970665911/job/16198657346#step:9:56 Reviewed By: larryliu0820 Differential Revision: D48670950 Pulled By: huydhn fbshipit-source-id: dc8ddbeab7d07d525a7671b97d478b342f957dcd
1 parent 1c92891 commit 036b933

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.ci/scripts/setup-macos.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,20 @@ install_buck() {
2727
brew install wget
2828
fi
2929

30+
BUCK2_NOT_AVAILABLE=false
3031
if ! command -v buck2 &> /dev/null; then
32+
BUCK2_NOT_AVAILABLE=true
33+
else
34+
BUCK2_BINARY=$(which buck2)
35+
BUCK2_ARCH=$(file -b "${BUCK2_BINARY}")
36+
37+
if [[ "${BUCK2_ARCH}" != "Mach-O 64-bit executable arm64" ]]; then
38+
echo "Reinstall buck2 because ${BUCK2_BINARY} is ${BUCK2_ARCH}, not 64-bit arm64"
39+
BUCK2_NOT_AVAILABLE=true
40+
fi
41+
fi
42+
43+
if [[ "${BUCK2_NOT_AVAILABLE}" == true ]]; then
3144
pushd .ci/docker
3245

3346
BUCK2=buck2-aarch64-apple-darwin.zst

0 commit comments

Comments
 (0)