fix(ci): attempt to fix m1 compilation problem on GH Actions

This commit is contained in:
Federico Terzi 2021-10-02 18:14:41 +02:00
parent 52632ec51c
commit 1caa5d2a57
2 changed files with 20 additions and 5 deletions

View File

@ -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) \

View File

@ -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() {