-
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
config_settings() needs a way to discriminate based on platform/OS in addition to CPU #350
Comments
Agreed. We need a stronger concept of "platform" than exists today - cpu is obviously inadequate. The challenge is to make sure we can properly encapsulate everyone's concept of "platform", in all its manifestations. To be clear, which platforms specifically are important to you? |
OSX (x86-32, x86-64) |
Work is ensuing over this summer to define a stronger notion of "platform" that I think should cover practical nuances. |
Is there any update on this? |
No activity on this for a few months. Is it still on the radar? |
Yes! Sorry about the lack of updates, there is actually a bunch of activity on this front. Let me find someone who knows more about this area to chime in. |
Work is in progress on this. We've done some planning and I will start implementing soon. The public design doc is at https://docs.google.com/document/d/1-G-VPRLEj9VyfC6VrQBiR8To-dZjnBSQS66Y4nargGM/edit#heading=h.al54v2ddwqzv |
Platforms now exist in bazel, using the platform() rule. The next step to solve this problem is to use platform and the constraint_setting/constraint_value rules in select() calls, which is a feature we plan to add in the near future. |
… the configsetting rule class. This is a step in the process of integrating platforms with selects and works towards fixing #350. Also allow the host platform to be empty/nullable to support clients without access to its default settings. PiperOrigin-RevId: 169436155
…orm. This is on the way to making select() work with constraint_values re: #305. PiperOrigin-RevId: 169454982
…s multiple constraint_values from the same constraint_setting (re: #350) PiperOrigin-RevId: 169577576
This functionality is now present, marking as closed. |
Is there any way to use the constraint system to match on Android or iOS target ? It seems matching on It seems at the moment the only way is to use |
Currently, the ios (and android) rules don't work with the platforms system. We'll address this in the future when those rules move to using platforms and toolchains directly. |
Do you have any more information on how the Apple rules should interface with the platform rule? |
So right now there is no real way to define a toolchain (or constraint) that could be, say compatible with iOS? |
@steeve You can writ a platform definition to describe an iOS target, by defining new |
@sergiocampama Take a look at the toolchains documentation, but the short way to add toolchain (and platform) support is to:
The major work will be defining your constraint settings so users can define meaningful platforms for different types of iOS device they would like to target builds for. |
@katre looks good, but the issue i have is that iOS and Android targets are builting for multiple architectures (fat binaries or apk) via a single target (by propagating the arch change to deps, it seems). |
Yes, part of the work will be handling fat binaries by using the correct config split transition. |
how is the toolchain support different from the CROSSTOOL? |
Is there a way do that already? EDIT: Also, this is already the case for all the Something like this:
|
Please take a look at the docs, including the original design doc. The short version is that toolchains works for all rule types, not just CC rules, and has a better idea of what makes different platforms distinct from each other. |
@steeve There's code to automatically convert from the I'd like to encourage you to file this as a separate issue and I'll put it on my backlog, but it's unlikely to be something I can get to in the near future. |
@katre sure thing, thank you for the quick answers Can you point me to the code? I might take a look. |
The auto-configuration for platforms happens here: https://source.bazel.build/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/platform/Platform.java;l=55 And is based on the set of cpus and oses available for autoconfig, set here: https://source.bazel.build/bazel/+/master:tools/platforms/platforms.BUILD;l=81?q=tools%2Fplatforms |
At present, the apparently suggested solution is to examine 'cpu', but this is insufficient; it appears that the only possibilities currently are for linux (either x86-32 or x86-64), darwin (cpu type and size unspecified), or armeabi (which apparently can refer to either android or ios); there doesn't appear to be a way to specify android-x86 or arm64-anything.
To use Bazel effectively, we need to be able to discriminate based on the target platform as well as the CPU type and bit-width; this is absolutely essential for working with prebuilt non-Bazel libraries (e.g. pulled via new_http_archive).
The text was updated successfully, but these errors were encountered: