-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Android NDK 32 bit Arm should be marked "armv7" not "arm" #14982
Comments
Are you setting I'm asking because we're moving toward the former via https://bazel.build/concepts/platforms-intro but it's Work In Progress. So users have to actively opt into making |
I'm setting platforms via https://github.com/ttiurani/examples/blob/main/android/ndk-rust/platform_mappings This is because rules_rust uses platforms and the stable android doesn't. The README here: https://github.com/ttiurani/examples/blob/main/android/ndk-rust describes also the build command I use for the project, i.e. just I was aware of the platforms WIP branch, but didn't use it here. |
We hit this same case with armeabi-v7a, specifically rules_rust does the right thing and uses the triple to decide CPU constraints, and therefore created a constraint with |
Previously this was arm instead of armv7. It seems that armv7 is the correct constraint for this case. Fixes bazelbuild#14982
I think this fixes this issue, it does in my repro with rules_rust, as in I'd no longer need the above patch. Please test your case as well! I'm interested to hear from the bazel folks what issues this would cause |
Previously this was arm instead of armv7. It seems that armv7 is the correct constraint for this case. Fixes bazelbuild#14982
Previously this was arm instead of armv7. It seems that armv7 is the correct constraint for this case. Fixes bazelbuild#14982
Previously this was arm instead of armv7. It seems that armv7 is the correct constraint for this case. Fixes bazelbuild#14982
Previously this was arm instead of armv7. It seems that armv7 is the correct constraint for this case. Fixes bazelbuild#14982
Previously this was arm instead of armv7. It seems that armv7 is the correct constraint for this case. Fixes bazelbuild#14982
@katre suggested CC'ing @cpsauer regarding effective platform mappings. @katre also said he's looking at a related issue at https://github.com/bazelbuild/platforms, although I'm not sure offhand which. |
Looks great to me. Go Keith! Probably a breaking change for the few using it, but IMO the right one if we're looking to quickly move away from @platforms//cpu:arm in favor of specific ones (per the source). I for one would be happy to switch when this lands--and I love that Keith is leading the fix at the root so we aren't forcing rules_rust to do the wrong thing long term. From some quick testing, it looks like Apple's iOS toolchains work with More generally on platform_mappings:
Cheers! |
Is there more context on this somewhere? |
^ Figured you'd be the guy to ask :) All I did was quickly change my platform_mappings over to armv7 to see if anything broke on iOS--and didn't seem to have any problems building. Sorry to not have more info. |
Are you building for 32 bit iOS |
Yes. Definitely. I'll reapply the stash, and play around a little bit more. Anything in particular you'd like me to poke at? |
I guess toolchain resolution, I would expect those to match for sure. Also with the recent-ish iOS fixes around it |
Matches all look okay. So: w/ armv7 |
And then, conversely, if I revert out a switch to armv7, it selects the other: |
Ah this could be because there are now 2 toolchains that resolve to this in the Apple configuration. bazel/tools/osx/crosstool/BUILD.tpl Lines 96 to 112 in 6872fd2
|
I just pushed an update to #15248, can you try that? Previously there was no CPU conflict, but now there is, since bazel doesn't choose the optimal match, just the first |
Wait, just to be clear that we aren't talking past each other somehow: This was a quick test to see if there seemed to be a parallel problem on the iOS side, which there didn't. Isn't that PR about Android? |
Oh, I see. It's selecting some android dummy toolchain we think? |
I'll point Bazelisk at it and report back. |
I think I need to wait until CI finishes for it to not 404, right? Or is there another, better way of my getting it? |
Probably not, short of building yourself |
Don't think I'll be able to beat it by much, so I'll wait and report back. You want to know whether builds succeed either way and if different toolchains are selected, right? Also, Keith, thanks for chiming in on the Apple platforms selector with the useful Envoy example. Looked like you'd just cooked up platform mappings over there. Related to that and this: @katre and I were discussing more (over email) the idea of baking in a default platform_mappings so people can start selecting on platforms without having to do roll their own. What do you think about that? |
Yea it shouldn't impact your ability to build for 32 bit macOS for sure. Yes I think providing the default platform_mappings would be great. |
Green, but still 404ing. It's my first time doing this; any guidance? Also, anything in particular you'd like me to play around with? And to confirm, selecting |
Maybe PRs don't push releases here? you might have to build it. I might have misunderstood your original issue, but I just want to verify 32 bit iOS still works, along with the armv7 android behavior |
Oh, well the original thing was intended to be a non-issue; that iOS things had looked good on quick inspection. But it seems like you think otherwise--for reasons I don't understand yet. |
Have built your PR's branch from source and run it. Things build cleanly with armv7--and indeed now there's no android default toolchain to (erroneously) match iOS on arm (non-v7). Thanks, Keith! |
Awesome, thanks for testing! |
The fix is now merged, thanks for figuring this out! |
@bazel-io flag |
@bazel-io fork 5.2.0 |
See bazelbuild/bazel#14982 Signed-off-by: JP Simard <jp@jpsim.com>
See bazelbuild/bazel#14982 Signed-off-by: JP Simard <jp@jpsim.com>
Description of the problem / feature request:
When building Android NDK with
--fat_apk_cpu=armeabi-v7a
the platform it hits is cpuarm
and not cpuarmv7
, even though "armv7" is claimed to be the right value here:https://github.com/bazelbuild/rules_android/blob/master/android/platforms/BUILD#L6
Feature requests: what underlying problem are you trying to solve with this feature?
Android platforms should work right, this came up with trying to get rust to work with Android, and this kind of special platform was needed. This problem makes it hard to target the right rust target
thumbv7neon-linux-androideabi
in rules_rust, which could be mapped if the rightarmv7
was set.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
This repository shows the needed special platform workaround needed:
https://github.com/ttiurani/examples/tree/main/android/ndk-rust
What operating system are you running Bazel on?
Same issue on OSX and linux.
What's the output of
bazel info release
?release 5.0.0 (but also latest 6.0.0 preview has the problem)
Have you found anything relevant by searching the web?
This was talked about on slack in this thread:
https://bazelbuild.slack.com/archives/CSV56UT0F/p1645029913244809
The text was updated successfully, but these errors were encountered: