We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Undefined symbols for architecture xxx
I built a demo: https://github.com/imWildCat/MinimalBazelFrameworkDemo/blob/swift-extension-bug/MinimalBazelFrameworkDemo/ViewController.swift#L23-L29
Here are the snippets from the demo:
public extension DemoManager { func demoExtensionMethod() { print("demoExtensionMethod") } }
BUILD
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") load( "@build_bazel_rules_swift//swift:swift.bzl", "swift_library", ) load("//build-system/ios-utils:plist_fragment.bzl", "plist_fragment") swift_library( name = "MinimalBazelFrameworkDemoAppLib", srcs = glob(["**/*.swift"]), data = [ "Base.lproj/Main.storyboard", ], visibility = ["//visibility:public"], deps = [ "//DemoSwiftFramework:DemoSwiftFrameworkSource", ], ) plist_fragment( name = "MinimalBazelFrameworkDemoAppPlist", extension = "plist", template = """ <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>MinimalBazelFrameworkDemoApp</string> <key>CFBundleIdentifier</key> <string>com.demo.MinimalBazelFrameworkDemoApp</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>MinimalBazelFrameworkDemoApp</string> <key>CFBundleShortVersionString</key> <string>1.0.0</string> <key>CFBundleVersion</key> <string>1.0</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>LSRequiresIPhoneOS</key> <true/> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>MinimalBazelFrameworkDemo_MinimalBazelFrameworkDemoAppLib.SceneDelegate</string> </dict> </array> </dict> </dict> <key>UILaunchStoryboardName</key> <string>LaunchScreen</string> <key>UIRequiredDeviceCapabilities</key> <array> <string>arm64</string> </array> <key>UIStatusBarTintParameters</key> <dict> <key>UINavigationBar</key> <dict> <key>Style</key> <string>UIBarStyleDefault</string> <key>Translucent</key> <false/> </dict> </dict> <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UISupportedInterfaceOrientations~ipad</key> <array> <string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> """, ) ios_application( name = "MinimalBazelFrameworkDemoApp", bundle_id = "com.demo.MinimalBazelFrameworkDemoApp", families = [ "iphone", "ipad", ], frameworks = [ "//DemoSwiftFramework", ], infoplists = [":MinimalBazelFrameworkDemoAppPlist"], launch_storyboard = "Base.lproj/LaunchScreen.storyboard", minimum_os_version = "14.0", deps = [ ":MinimalBazelFrameworkDemoAppLib", ], )
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_framework") load( "@build_bazel_rules_swift//swift:swift.bzl", "swift_library", ) load("//build-system/ios-utils:plist_fragment.bzl", "plist_fragment") swift_library( name = "DemoSwiftFrameworkSource", srcs = glob([ "*.swift", ]), module_name = "DemoSwiftFramework", visibility = ["//visibility:public"], deps = [], ) plist_fragment( name = "DemoSwiftFrameworkPlist", extension = "plist", template = """ <key>CFBundleDevelopmentRegion</key> <string>en</string> <key>CFBundleExecutable</key> <string>DemoSwiftFramework</string> <key>CFBundleIdentifier</key> <string>com.example.DemoSwiftFramework</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> <string>DemoSwiftFramework</string> <key>CFBundleShortVersionString</key> <string>1.0.0</string> <key>CFBundleVersion</key> <string>1.0</string> <key>CFBundlePackageType</key> <string>FRWK</string> """, ) ios_framework( name = "DemoSwiftFramework", bundle_id = "com.example.DemoSwiftFramework", families = [ "iphone", "ipad", ], infoplists = [":DemoSwiftFrameworkPlist"], minimum_os_version = "14.0", visibility = ["//visibility:public"], deps = [":DemoSwiftFrameworkSource"], )
The text was updated successfully, but these errors were encountered:
While debugging, the extension source code was actually included:
Sorry, something went wrong.
After some research, by setting alwayslink = True, this issue can be fixed: imWildCat/MinimalBazelFrameworkDemo@59f4afc
alwayslink = True
I will close this issue tomorrow in case that this solution is a workaround.
Thanks for the repro! This bug is tracked here bazelbuild/rules_apple#332 since it's actually the fault of ios_framework
ios_framework
Cool, thanks a lot!
No branches or pull requests
Development Environment
I built a demo: https://github.com/imWildCat/MinimalBazelFrameworkDemo/blob/swift-extension-bug/MinimalBazelFrameworkDemo/ViewController.swift#L23-L29
Here are the snippets from the demo:
The method cannot be found is defined in a Swift extension for a class
BUILD
of main appBUILD
of the dynamic frameworkThe text was updated successfully, but these errors were encountered: