Meet mergeable libraries

RSS for tag

Discuss the WWDC23 SessionMeet mergeable libraries

Posts under wwdc2023-10268 tag

7 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

"unknown option: -make_mergeable" when building a dynamic library as mergeable in Xcode 15
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?
3
0
874
Sep ’23
What is 'hook' mentioned at Meet mergeable libraries Session
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.
4
0
743
Aug ’23
Interface is not propagated when using mergeable libraries
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!
1
0
519
Aug ’23
Xcode 15 beta 3 linker issue: ld: warning: duplicate -rpath
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
21
14
9.1k
Oct ’23
Storyboard is not found when merging libraries
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
1
0
656
Jun ’23
Swift Package can be MAKE_MERGEABLE?
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?
4
0
1.3k
Jun ’23