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

Can build --enable_platform_specific_config automatically detect the right APPLE_SDK_PLATFORM for build target? #2501

Open
tinder-kaijing opened this issue Jul 12, 2024 · 3 comments

Comments

@tinder-kaijing
Copy link

Hi,

When we upgrade Bazel from 6.x to 7.x, it seems that the flag build --apple_platform_type=ios no longer works.
We expect to use the below config in .bazelrc, to detect the targets automatically. If the build target is ios_arm64, it will include all ios standard libraries. If the build target is "macos_arm64", it will include all macOS libraries.

build --enable_platform_specific_config
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain

However, likely it doesn't work that way. when we try to build an iOS build target, it still misses some standard ios libraries. for instance,

fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
^~~~~~~~~~~~~~~
1 error generated.
Error in child process '/usr/bin/xcrun'. 1

@luispadron
Copy link
Contributor

As far as I understand --enable_platform_specific_config is for the host machine not the specific platform target.

You'd still need to use --apple_platform_type=ios if you want to build swift_library for iOS or use the packaging rules like ios_framework

This was recently documented to be more clear in rules_swift: https://github.com/bazelbuild/rules_swift/blob/master/doc/faq.md

@luispadron
Copy link
Contributor

Also FWIW in Bazel 7 you should not need the flags you listed in the .bazelrc (that was only required for Bazel 6):

build --enable_platform_specific_config
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain

See: https://github.com/bazelbuild/apple_support?tab=readme-ov-file#bazel-7-setup

@tinder-kaijing
Copy link
Author

As far as I understand --enable_platform_specific_config is for the host machine not the specific platform target.

You'd still need to use --apple_platform_type=ios if you want to build swift_library for iOS or use the packaging rules like ios_framework

This was recently documented to be more clear in rules_swift: https://github.com/bazelbuild/rules_swift/blob/master/doc/faq.md

Thanks.

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

2 participants