From 0afa3f420887eaa10ece2995f8efbb55fd0cdf70 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sat, 2 Oct 2021 19:36:21 +0200 Subject: [PATCH] fix(ci): attempt to fix m1 compilation problem on GH Actions This reverts commit e33fc6993c588d3337f87ef2e843b94a9ffd6498. --- .github/workflows/ci.yml | 8 ++++---- espanso-modulo/build.rs | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2b91ed..8232dc9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,10 +53,10 @@ jobs: - name: Install cargo-make run: | cargo install --force cargo-make - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true + # - name: Setup tmate session + # uses: mxschmitt/action-tmate@v3 + # with: + # limit-access-to-actor: true - name: Build run: | SDKROOT=$(xcrun -sdk macosx11.3 --show-sdk-path) \ diff --git a/espanso-modulo/build.rs b/espanso-modulo/build.rs index 85adb6e..ee87e3d 100644 --- a/espanso-modulo/build.rs +++ b/espanso-modulo/build.rs @@ -170,6 +170,21 @@ fn build_native() { arch => panic!("unsupported arch {}", arch), }; + // Because of a configuration problem on the GitHub CI pipeline, we need + // to set the target architecture manually. + // See: https://github.com/actions/virtual-environments/issues/3288#issuecomment-830207746 + let xcode_sdk_path = Command::new("xcrun").args(&["--sdk", "macosx", "--show-sdk-path"]).output().expect("unable to obtain XCode sdk path"); + let xcode_sdk_path = String::from_utf8_lossy(&xcode_sdk_path.stdout); + let xcode_sdk_path = xcode_sdk_path.trim(); + + if xcode_sdk_path.is_empty() { + panic!("could not query XCode sdk path"); + } + + println!("Using SDK path: {}", xcode_sdk_path); + + let configure_cxx_flags = format!("-isysroot {} -isystem {} -DSTDC_HEADERS=1 -DHAVE_FCNTL_H -arch {}", xcode_sdk_path, xcode_sdk_path, target_arch); + let mut handle = Command::new(out_wx_dir.join("configure")) .current_dir( build_dir.to_string_lossy().to_string() @@ -177,8 +192,8 @@ fn build_native() { .args(&[ "--disable-shared", "--without-libtiff", - &format!("--enable-macosx_arch={}", target_arch), ]) + .env("CXXFLAGS", &configure_cxx_flags) .spawn() .expect("failed to execute configure"); if !handle.wait().expect("unable to wait for configure command").success() {