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

Build for iOS (aarch64-apple-ios) fails #437

Closed
olliiiver opened this issue Dec 16, 2024 · 5 comments
Closed

Build for iOS (aarch64-apple-ios) fails #437

olliiiver opened this issue Dec 16, 2024 · 5 comments

Comments

@olliiiver
Copy link

Hi BLAKE3-team,

I cannot build the library for target aarch64-apple-ios.

I've added a CI/CD workflow to test this:

https://github.com/olliiiver/Blake_test/actions/runs/12350122968/job/34462322857

The error message is:

  = note: ld: warning: object file (/Users/runner/work/Blake_test/Blake_test/target/aarch64-apple-ios/debug/deps/libblake3-2e845a816eca43ce.rlib[6](a1edd97dd51cd48d-blake3_neon.o)) was built for newer 'iOS' version (17.5) than being linked (10.0)
          Undefined symbols for architecture arm64:
            "___chkstk_darwin", referenced from:
                _blake3_hash4_neon in libblake3-2e845a816eca43ce.rlib[6](a1edd97dd51cd48d-blake3_neon.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think the error lies somewhere here

https://github.com/BLAKE3-team/BLAKE3/blob/master/build.rs#L236

However, don't know how to fix it ...

@oconnor663
Copy link
Member

The warning seems relevant:

note: ld: warning: object file [.../blake3_neon.o] was built for newer 'iOS' version (17.5) than being linked (10.0)

The symbol blake3_hash4_neon is indeed provided by that object file. So we are building it, correctly (because is_aarch64 is true here), but something about how we compiled it is making the linker unhappy. I don't have any experience with iOS, and I don't know how different versions of it differ from a compatibility perspective. Are there flags you need to pass to the C compiler when you compile things for iOS 10? We're just using the default compiler as determined by the cc crate (maybe the $CC env var?), and we don't currently have any iOS-specific logic.

@oconnor663
Copy link
Member

As you can see on those same lines of build.rs, there are currently a couple different ways you can disable the NEON implementation in the blake3 crate. I'm curious whether enabling the no_neon crate feature unbreaks your build (at the cost of some runtime performance). Our Cargo.toml says that those features are considered unstable, but at this point they've been around long enough that it would be hard for us to remove them...

@olliiiver
Copy link
Author

Hi @oconnor663 . Thanks for coming back to me. The build works by using the following workaround:

export CARGO_FEATURE_NO_NEON=1
cargo build --target aarch64-apple-ios

However, strange that the enabled functionality is later eliminated as dead code ... 🤔

@elichai
Copy link
Contributor

elichai commented Dec 18, 2024

The problem is that it's probably using the wrong linker, and you also need to set the deployment target for the C compiler, See here:
olliiiver/Blake_test#2
https://github.com/elichai/Blake_test/actions/runs/12389872402/job/34583767864

@olliiiver
Copy link
Author

Thank you. We've solved it by disabling neon support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants