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

sim_arm64 Slice missing for XCFrameworks #84

Closed
sanju-naik opened this issue Nov 27, 2022 · 4 comments
Closed

sim_arm64 Slice missing for XCFrameworks #84

sanju-naik opened this issue Nov 27, 2022 · 4 comments

Comments

@sanju-naik
Copy link

Hi,

I am trying to Integrate FBSDKCoreKit (https://github.com/facebook/facebook-ios-sdk) Cocoapod into Bazel Project, FBSDKCoreKit is distributed as XCFramework, and when the plugin generates BUILD file its missing sim_arm64 in supported_archs .

Here is the generated BUILD file containing only simulator Slice for FBSDKCoreKit, As it can be seen sim_arm64 is missing supported_archs.

apple_framework(
    name = "FBSDKCoreKit",
    platforms = {"ios": "10.0"},
    vendored_xcframeworks = [
        {
            "name": "FBSDKCoreKit",
            "slices": [
                {
                    "identifier": "ios-arm64_i386_x86_64-simulator",
                    "platform": "ios",
                    "platform_variant": "simulator",
                    "supported_archs": [
                        "arm64",
                        "i386",
                        "x86_64",
                    ],
                    "path": "XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_i386_x86_64-simulator/FBSDKCoreKit.framework",
                    "build_type": {
                        "linkage": "dynamic",
                        "packaging": "framework",
                    },
                },
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//Pods/FBAEMKit",
        "//Pods/FBSDKCoreKit_Basics",
    ],
)

With this BUILD file, when I run bazel build --ios_multi_cpus=sim_arm64 //target , Build fails with a missing Slice error

Pods/FBSDKCoreKit/BUILD.bazel:3:16: configurable attribute "actual" in //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframeworkdefault_vfs doesn't match this configuration. Would a default condition help?

Conditions checked:
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-tvos_simulator_arm64
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-tvos_simulator_x86_64
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-ios_simulator_i386
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-ios_simulator_x86_64
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-ios_arm64
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-ios_armv7
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-tvos_arm64
@jerrymarino
Copy link
Contributor

Hey @sanju-naik the build file looks valid and it's hard to tell why you hit the error. We've got a test case for a similar BUILD file inside of:

tests/ios/xcframeworks/Basic/BasicXCFramework/BUILD.bazel

This said, the test case in rules_ios is ran with --features apple.arm64_simulator_use_device_deps: a lot of the code was written when there wasn't many pods on Apple Silicon yet - is it possible there's a bug if you don't use the feature? The code should still give you the simulator slice - I'd suggest trying your invocation with:

bazel build --ios_multi_cpus=sim_arm64 --features apple.arm64_simulator_use_device_deps //target 

@sanju-naik
Copy link
Author

Thank you @jerrymarino This worked.

I believe this flag --features apple.arm64_simulator_use_device_deps works with all CPU archs such as arm64 or x86_64 or sim_arm64, so its safe to add this to .bazelrc and use it as default build option?

@jerrymarino
Copy link
Contributor

@sanju-naik you got it - glad that fixes it for you.

Yeah the feature is safe to use 100% of the time: you often just add it to the .bazelrc. It's definitely a rules_ios bug and something we should turn on by default / fix the bug by removing the disabled codepath.

@sanju-naik
Copy link
Author

Perfect. Thank you!

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