Meet mergeable libraries

RSS for tag

Discuss the WWDC23 SessionMeet mergeable libraries

View Session

Posts under wwdc2023-10268 tag

9 Posts
Sort by:
Post not yet marked as solved
13 Replies
8.5k Views
Hello, In Xcode 15 beta 3, if a project embedded a Swift package (no matter static or dynamic), and the package has its own dependencies, the linker will always emit following warning: ld: warning: duplicate -rpath '/Users/.../Library/Developer/Xcode/DerivedData/MyApp.../Build/Products/Debug-iphonesimulator/PackageFrameworks' ignored The warning is not appeared on beta 2 and beta 1. Reproduce Steps [1] Create a new iOS project in Xcode 15 beta 3 [2] Create a new Swift package MyLibrary, and add any dependency in the Package.swift. Example: // swift-tools-version: 5.9 import PackageDescription let package = Package( name: "MyLibrary", platforms: [.iOS(.v16)], products: [ .library(name: "MyLibrary", targets: ["MyLibrary"]), ], dependencies: [ // 👀 Add any dependency to this package. // Here I use "Version" which is a simple pure swift package: .package(url: "https://github.com/mxcl/Version.git", .upToNextMajor(from: "2.0.0")), ], targets: [ .target(name: "MyLibrary", dependencies: ["Version",]), ] ) [3] In the project page, embed MyLibrary into the iOS app target. [4] Build the project. It will succeed but with link warnings. In addition, if you create a dynamic framework and embed MyLibrary, the warnings also reproduce. And this is only a simple case. In my real project, the linker will also emit a lot of warnings like this: ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$__TtP10SPConfetti18SPConfettiDelegate_ ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$__TtP10SPConfetti18SPConfettiDelegate_ ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSURLSessionDelegate ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSURLSessionTaskDelegate ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSURLSessionDataDelegate ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSURLSessionDownloadDelegate ld: warning: could not associate debug note to atom l_OBJC_LABEL_PROTOCOL_$_NSObject ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSURLSessionDelegate ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSURLSessionTaskDelegate ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSURLSessionDataDelegate ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSURLSessionDownloadDelegate ld: warning: could not associate debug note to atom l_OBJC_PROTOCOL_REFERENCE_$_NSObject
Posted
by Gong.
Last updated
.
Post not yet marked as solved
3 Replies
764 Views
I have extracted a part of my app into a framework, which I have been building as a static library (mach-o type=static library). This has been inflating the app size, as the framework has been statically linked into both app & widget targets. I have switched the framework to dynamic library, set to build it as a mergeable library, set the app targets to 'create merged library: automatic'. Unfortunately, my release builds now fail with "unknown option: -make_mergeable" in Xcode 15 beta 8. This happens in "Link " step during a framework build. Debug builds work OK. How can I fix this?
Posted Last updated
.
Post marked as solved
3 Replies
654 Views
Hi everyone, I'm studying Mergeable libraries. (in an iOS platform) In general, with the knowledge I knew (may not be accurate), Static Library cannot use resources except to add a separate resource bundle to the Main App Target, so I understand that the main app uses dynamic library. But In "Meet mergeable libraries Session", it was said that below "Up until iOS 12, the runtime needed the framework's binary to discover bundles, but mergeable frameworks won't have binaries in them by the time the process is running. Good news! In iOS 12, a hook was added to enable lookup for this scenario. That does mean if you rely on bundle lookup support, you should update your minimum deployment version to iOS 12 or later to use mergeable libraries." I don't know what 'hook' is mentioned below. I have a dynamic library that only handles the resources(images, colors - xcassets) and those assets compiled and become Assets.car file I set Build Mergeable Library to Yes in the build setting of this dynamic library, and I set Create Mergeable Binary to Automatic in the Main App (which relies on this library). When the app bundle includes the framework, of course the resource is loaded, but if I set the library to do not embedded in the project setting, I cannot read the resource. I wonder if the Merged Binary (Main App) has a library merged, and if I need to add a separate framework to the App Bundle simply because of resources. Thank you.
Posted Last updated
.
Post not yet marked as solved
1 Replies
478 Views
Hi! I've been dealing with mergeable libraries quite some time. However I can't achieve the following scenario: I have 2 xcframeworks A and B that are merged as part of a third xcframework called C. And my app needs to import something from A and B. As per the documentation we have to remove the references from A and B from the final app and replace it with C. If I work on the same xcodepoj it works like a charm (maybe because of caches), but if I try to compile C as a separate XCFramework and distribute it as a packed library, the app is not able to resolve the symbols to A and B classes. This C xcframework is compiled with BUILD_LIBRARY_FOR_DISTRIBUTION se to true and if I check its swiftinterface files it is not declaring the symbols from A and B. However the size of the binary seems to have A and B. Is there any way to export A and B symbols as part of C's swiftinterface? If I add @_exported, it is forcing me to declare the import of A and B wherever I use them and therefore I'm going to have duplicated symbols Thanks!
Posted Last updated
.
Post not yet marked as solved
0 Replies
567 Views
I try to create a Mergeable Framework using Command like this. xcodebuild archive \ -scheme Mergeable \ -configuration Release \ -destination 'generic/platform=iOS' \ -archivePath './build/Mergeable.framework-iphoneos.xcarchive' \ SKIP_INSTALL=NO \ MERGED_BINARY_TYPE=MANUAL \ MERGEABLE_LIBRARY=YES \ BUILD_LIBRARIES_FOR_DISTRIBUTION=YES But it seems that I can't find any way to create a Mergeable framework using xcodebuild. Do we have another option to indicate the xcodebuild create a Mergeab,e Framework Thanks, Ben.Dang
Posted Last updated
.
Post not yet marked as solved
1 Replies
620 Views
Hi everyone, I use new feature mergeable libraries in XCode 15 beta 2 to create xcframework. Follow the instruction of https://developer.apple.com/documentation/xcode/configuring-your-project-to-use-mergeable-libraries. I can create the megrable framework for devices (ios-arm64) and it can use in another project. But for the megrable framework for simulators (ios-arm64_x86_64-simulator). It can't use this framework for another project and XCode throw the error: Showing Recent Messages arm64-apple-ios-simulator.private.swiftinterface:6:8: No such module 'Framework3' 'Framework3' is linker framework, inspite of it already have this framework in the "ReexportedBinaries" of the mergeble framework. Structure for mergeable framework: - Mergalble.framework --- ReexportedBinaries ------- Framework3.framework It is have the same issue with the xcframework. So, is it the issue with XCode 15 beta for mergeable framework of simulator and xcframework? Do we have to add any specifice agrument for create xcframework with the mergeable libraries? Best Regards, Hula Nguyen
Posted Last updated
.
Post not yet marked as solved
1 Replies
702 Views
I have built a mergeable framework for distribution using Xcode 15. But when I try to merge it into an App target using -merge_framework in "Other linker flags", I get the error "Unknown argument: '-merge_framework'"? I'm not sure if the new linker is being used, but I assumed it would be used by default and I'm not sure of a way to enable it if not.
Posted
by nrbrook.
Last updated
.
Post not yet marked as solved
1 Replies
625 Views
I'm currently creating the 3 xcframeworks A, B, C and a Group xcframework (configured to manual) which groups them, let's call it D. A, B and C are properly configured with the following settings: MAKE_MERGEABLE = YES; MERGEABLE_LIBRARY = YES; OTHER_LDFLAGS = ( "-ObjC", ); The problem comes when I try to initialise a UIStoryboard via code, it fails because it can't be found. let storyboard = UIStoryboard(name: "MyStoryboard", bundle: Bundle(for: NSClassFromString("A.Class")!)) The error it is raising is: Could not find a storyboard named 'MyStoryboard' in bundle NSBundle </some_path/Sample.app> Also, if I try to search for a specific file (such as a json) with the same structure Bundle(for: NSClassFromString("A.Class")!) it is not able to get any file. Points to note Xcode version 15 beta 1. Bundle(for: NSClassFromString("A.Class")!) returns a valid bundle path
Posted Last updated
.
Post not yet marked as solved
4 Replies
1.2k Views
Hello, I'm Software Engineer and my work is developing SDK. I'm on developing 1 Swift Package for general logic and 1 SDK (Xcode Framework Project) for business logic. (SDK depends on Swift Package) Until now, I merge them with @_implementationOnly. And I want to migrate to MAKE_MERGEABLE. Can I mark Swift Package Dependency as MAKE_MERGEABLE on SDK Xcode Framework Project? Or can I mark Swift Package MAKE_MERGEABLE on Package.swift? Or I can't make Swift Package MAKE_MERGEABLE?
Posted Last updated
.