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

Revert #110 to fix iOS cross-compilation after #158. Fixes #173 #176

Merged
merged 4 commits into from
Mar 23, 2023
Merged
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
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,25 @@ jobs:
run: cross build -vv --target ${{ matrix.platform.target }}
working-directory: test-crate
if: ${{ !matrix.platform.test }}

ios_cross_compile_test:
name: Test Cross Compile - ${{ matrix.platform.target }}
needs: [ test ]
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
platform:
- target: aarch64-apple-ios
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platform.target }}
Comment on lines +98 to +101
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use actions-rs as it's currently unmaintained and has some deprecation warnings that mean the workflow won't work at some point. In this case just invoking rustup with run should be sufficient.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it seems this was brought by the current config, it's fine then. I'm going to fix it later along with others, so feel free to leave them as-is!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I just copy/pasted from the existing config for consistency. It's a separate job because I couldn't tell if the cross tool would work on macOS from a brief look at it.

- name: build
run: cargo build -vv --target ${{ matrix.platform.target }}
working-directory: test-crate
env:
# If this isn't specified the default is iOS 7, for which zlib-ng will not compile due to the lack of thread-local storage.
IPHONEOS_DEPLOYMENT_TARGET: 16
Comment on lines +106 to +107
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: does this mean iOS 16 would be the minimum supported version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this compilation, yes. I didn't feel like actually trying to figure out what the minimum version of iOS that zlib-ng could build for was, so I just used iOS 16 since that's the current SDK. This won't affect any users of the crate, it's just for compiling zlib-sys in CI here.

6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,12 +660,6 @@ impl Config {
panic!("unsupported msvc target: {}", target);
}
}
} else if target.contains("apple-ios") || target.contains("apple-tvos") {
// These two flags prevent CMake from adding an OSX sysroot, which messes up compilation.
if !self.defined("CMAKE_OSX_SYSROOT") && !self.defined("CMAKE_OSX_DEPLOYMENT_TARGET") {
cmd.arg("-DCMAKE_OSX_SYSROOT=/");
cmd.arg("-DCMAKE_OSX_DEPLOYMENT_TARGET=");
}
} else if target.contains("darwin") {
if !self.defined("CMAKE_OSX_ARCHITECTURES") {
if target.contains("x86_64") {
Expand Down