You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We distribute our framework via a precompiled, vendored XCFramework.
Starting with out latest release, we ship as a dynamic XCFramework with support for Mergable Libraries
However, on installation, CocoaPods fails to detect that the XCFramework is dynamic, which means that it's not included in Pods-<target>-frameworks-Release-input-files.xcfilelist and not copied during build. The app crashes on start as dyld can't find the framework.
When ruby-macho fails to open a dylib, CocoaPods assumes that it is a static library.
Problem is, mergable libraries come with a new Load command: LC_ATOM_INFO. ruby-macho does not support this (even in its latest version, 4.0.1).
/Users/arnaud/dev/playground/machotest/vendor/bundle/ruby/2.6.0/gems/ruby-macho-4.0.1/lib/macho/macho_file.rb:598:in `block in populate_load_commands': Unrecognized Mach-O load command: 0x36 (MachO::LoadCommandError)
0x36 being the code for LC_ATOM_INFO
As Podspecs do not allow us to bypass the auto detection, we have no choice but to make a specific build for CocoaPods without mergable library support.
What did you do?
Make an empty project
Add a pod that is a vendored xcframework that is a mergable library (pod 'Batch', '2.0.0')
Build and run: The app crashes as the framework is missing at runtime
dyld[64690]: Library not loaded: @rpath/Batch.framework/Batch
What did you expect to happen?
CocoaPods properly detects our dynamic mergable library and copies it in the app bundle.
On an unrelated issue, I also expect cocoapods to copy the XCFramework properly rather than manually handling slices, as this breaks code signing, but I will open another issue for that.
What happened instead?
CocoaPods believes that our framework is a static library and does not copy it on build.
To work around this, we have to manually tell Xcode about the framework and not rely on CocoaPods' automatic linking.
I setup a local version of cocoapods pointing to master branch of ruby-macho and all works fine.
I am waiting for Ruby-Macho to release a version. After that we should be able to update Cocoapods to point to that version.
Report
We distribute our framework via a precompiled, vendored XCFramework.
Starting with out latest release, we ship as a dynamic XCFramework with support for Mergable Libraries
However, on installation, CocoaPods fails to detect that the XCFramework is dynamic, which means that it's not included in
Pods-<target>-frameworks-Release-input-files.xcfilelist
and not copied during build. The app crashes on start as dyld can't find the framework.I pinpointed this to this code: https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/xcode/linkage_analyzer.rb
When
ruby-macho
fails to open a dylib, CocoaPods assumes that it is a static library.Problem is, mergable libraries come with a new Load command:
LC_ATOM_INFO
.ruby-macho
does not support this (even in its latest version, 4.0.1).The following ruby program:
prints
0x36
being the code forLC_ATOM_INFO
As Podspecs do not allow us to bypass the auto detection, we have no choice but to make a specific build for CocoaPods without mergable library support.
What did you do?
pod 'Batch', '2.0.0'
)What did you expect to happen?
CocoaPods properly detects our dynamic mergable library and copies it in the app bundle.
On an unrelated issue, I also expect cocoapods to copy the XCFramework properly rather than manually handling slices, as this breaks code signing, but I will open another issue for that.
What happened instead?
CocoaPods believes that our framework is a static library and does not copy it on build.
To work around this, we have to manually tell Xcode about the framework and not rely on CocoaPods' automatic linking.
CocoaPods Environment
Stack
Installation Source
Plugins
Project that demonstrates the issue
Requires Xcode 15.3
batch_cocoapods_repro.zip
The text was updated successfully, but these errors were encountered: