Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Investigate why app & system extension shared dependencies fail to embed #149

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

Open
ethanndickson opened this issue May 6, 2025 · 0 comments

Comments

@ethanndickson
Copy link
Member

ethanndickson commented May 6, 2025

In both #145 and #98, I've encountered an issue with release builds of the app. These issues arose when a dependency was required by both the App target (or any of it's dependencies), and the system extension target (and any of it's dependencies).

In #98, the issue occurred when protobuf definitions were added directly to the app target, or a new framework target that would be depended on by the app target. They were previously working fine being depended on by just VPNLib (which the system extension depends on).
In the first case, the network extension would crash. In the second case, the app would crash.
The crash reason was:

Library not loaded: @rpath/SwiftProtobuf.framework/Versions/A/SwiftProtobuf

Other users have reported this issue apple/swift-protobuf#1506 (comment)

In #143, the issue occured when InternalCollectionsUtilities was depended on by both the App target, and the VPN target (via another framework, VPNLib). When a library that depended on swift-collections was added to the app target, the network extension would crash on startup with the error:

Library not loaded: @rpath/InternalCollectionsUtilities.framework/Versions/A/InternalCollectionsUtilities

FWICT, xcode is making some form of optimisation where it constructs a framework for code shared between two different targets. This poses an issue with a system extension, which is copied and executed outside of the app bundle. A copy of the system extension always lives in the app bundle, so it's trivial for the app to depend on a framework present within the system extension bundle (we already do this), but not the other way around. If there was some way to tell xcode to embed this new framework within the system extension bundle, we wouldn't have this issue.

Instead, the workaround we've gone with is to simply put everything that would cause this issue in VPNLib, as to minimise the number of times we depend on any one package.

This issue doesn't require immediate action, and is more so for book-keeping. It would be good to post this alongside an MRE on the Apple developer forums and in Apple feedback assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant