Skip to content
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

[SR-15268] Unable to set runpath to load dylib in testTarget in Swift package manager. #4384

Open
swift-ci opened this issue Oct 1, 2021 · 0 comments
Labels

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Oct 1, 2021

Previous ID SR-15268
Radar None
Original Reporter Lobanov (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 6382a0f1b00bde8d3f1846d38ffc4c10

Issue Description:

I have a local dynamic library. Let's call it MyLib.dylib.

I want to wrap some functionality in SPM, but testTarget in this package requires MyLib.dylib to be loaded.

I can copy this library into Resources of test target bundle, but I can't set runpath to it. Is it possible to set runpath?..

A part of package:

```swift
.target: (name: "MyTarget"),
.testTarget: (
name: "MyTargetTests",
resources: [
"Resources/MyLib.dylib" // A copy of this library in Resources. It will be copied
],
linkerSettings: [
.unsafeFlags([
"-L",
"../../LibraryPath" // A link to an actual library location
"-l",
"MyLib.dylib",
"-rpath",
"@loader_path/../Resources"
])
]
)

```

Notes

Yes, I have a cheat here, I put a link to a folder ("../../LibraryPath") with this library into a package's root, so, compiler can find it.
But I don't understand how to set runpath for this target that linker can load it correctly.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants