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

Bug: macos_dynamic_framework fails to build #2722

Closed
luispadron opened this issue Nov 10, 2023 · 3 comments · Fixed by #2724
Closed

Bug: macos_dynamic_framework fails to build #2722

luispadron opened this issue Nov 10, 2023 · 3 comments · Fixed by #2724
Assignees
Labels
bug Something isn't working

Comments

@luispadron
Copy link
Contributor

luispadron commented Nov 10, 2023

Description

When using a macos_dynamic_framework within a macos_application target's framework attribute the generated Xcode project fails when building the app target with:


Showing Recent Errors Only

Build target macOSLib.framework of project Integration with configuration Debug
note: Run script build phase 'Copy Bazel Outputs / Generate Bazel Dependencies (Index Build)' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'macOSLib.framework' from project 'Integration')


GenerateTAPI /Users/lpadron/Library/Developer/Xcode/DerivedData/Integration-bvjzmwsnpstwqddmgquklydydoxl/Build/Intermediates.noindex/EagerLinkingTBDs/Debug/Lib.framework/Versions/A/Lib.tbd (in target 'macOSLib.framework' from project 'Integration')
    cd /Users/lpadron/Development/rules_xcodeproj/examples/integration/bazel-output-base/rules_xcodeproj.noindex/build_output_base/execroot/_main
    /Applications/Xcode-15.0.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/tapi stubify -isysroot /Applications/Xcode-15.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk /Users/lpadron/Library/Developer/Xcode/DerivedData/Integration-bvjzmwsnpstwqddmgquklydydoxl/Build/Intermediates.noindex/Integration.build/bazel-out/macos-arm64-min12.0-applebin_macos-darwin_arm64-dbg-ST-77d8e30e5cdb/bin/macOSApp/Source/macOSLib.framework/bin/Lib.framework/Versions/A/Lib -o /Users/lpadron/Library/Developer/Xcode/DerivedData/Integration-bvjzmwsnpstwqddmgquklydydoxl/Build/Intermediates.noindex/EagerLinkingTBDs/Debug/Lib.framework/Versions/A/Lib.tbd

error: no such file or directory: '/Users/lpadron/Library/Developer/Xcode/DerivedData/Integration-bvjzmwsnpstwqddmgquklydydoxl/Build/Intermediates.noindex/Integration.build/bazel-out/macos-arm64-min12.0-applebin_macos-darwin_arm64-dbg-ST-77d8e30e5cdb/bin/macOSApp/Source/macOSLib.framework/bin/Lib.framework/Versions/A/Lib'

no such file or directory: '/Users/lpadron/Library/Developer/Xcode/DerivedData/Integration-bvjzmwsnpstwqddmgquklydydoxl/Build/Intermediates.noindex/Integration.build/bazel-out/macos-arm64-min12.0-applebin_macos-darwin_arm64-dbg-ST-77d8e30e5cdb/bin/macOSApp/Source/macOSLib.framework/bin/Lib.framework/Versions/A/Lib'



Build failed    11/9/23, 9:50 PM    4.6 seconds

This same build target works with a normal bazel build command.

Reproduction steps

See the PR adding a macos_dynamic_framework target is failing when building macOSApp target: #2721

Expected behavior

The macos_dynamic_framework target builds successfully.

rules_xcodeproj version

main

Xcode version

15.0.0

Bazel version

main

rules_apple version

No response

rules_swift version

No response

Additional information

No response

@luispadron luispadron added the bug Something isn't working label Nov 10, 2023
@luispadron
Copy link
Contributor Author

Seems like macos_dynamic_framework doesn't create the .framework file as expected according to: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html

It's missing the Versions/A directory:

Lib.framework
├── Headers
│   └── Lib.h
├── Info.plist
├── Lib
└── Modules
    ├── Lib.swiftmodule
    └── module.modulemap

@brentleyjones
Copy link
Contributor

Seems like macos_dynamic_framework doesn't create the .framework file as expected according to: https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html

So that's a rules_apple bug. We could fix it there.

I opened #2724 as a workaround for now. We want to disable that action anyway, since it's just extra overhead.

@luispadron
Copy link
Contributor Author

It's actually not super clear if that's the required format or if it's an option one can use for versioned frameworks.

It looks like rules_apple has examples of versioned frameworks but only via the import rules.

If you have a better idea of the bug this might be, mind reporting it @brentleyjones?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants