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

Linking CYaml #39

Closed
yonaskolb opened this issue Apr 27, 2017 · 3 comments
Closed

Linking CYaml #39

yonaskolb opened this issue Apr 27, 2017 · 3 comments

Comments

@yonaskolb
Copy link

Hi

This is not directly an issue with YAMS specifically, but I'm having trouble running a CI tool that depends on this due to CYaml. My Package.swift is here https://github.com/yonaskolb/SwagGen

When it's built with swift build I can do .build/debug/SwagGen and it runs fine. But if I move it out of there, and delete build directory, it will not run as libCYaml.dylib is not present and it's referenced by an absolute path:

dyld: Library not loaded: /Users/Yonas/Developer/SwagGen/.build/debug/libCYaml.dylib
  Referenced from: /Users/Yonas/Developer/SwagGen/.build/debug/test/SwagGen
  Reason: image not found

Do you know a way around this? Bundling up CYaml into the app? linking to a global framework instead relative path? Or another solution?

@norio-nomura
Copy link
Collaborator

AFAIK, this is limitation of SwiftPM in Swift 3.x.
SwiftPM in Swift 4.0 will support static linking.
FYI: jpsim/SourceKitten#360

@norio-nomura
Copy link
Collaborator

norio-nomura commented Apr 27, 2017

I confirmed that SwagGen can be portable by operating @rpath as following:

$ swift build -Xlinker -rpath -Xlinker @executable_path

$ install_name_tool -change /Users/norio/github/SwagGen/.build/debug/libCYaml.dylib @rpath/libCYaml.dylib .build/debug/SwagGen
$ mkdir test
$ mv .build/debug/SwagGen .build/debug/libCYaml.dylib test
$ test/SwagGen
Must provide a valid spec

This allows placing libCYaml.dylib at same directory with SwagGen.

@jpsim
Copy link
Owner

jpsim commented Jul 24, 2017

I can't identify anything actionable from this issue, so I'm closing it. Please clarify if it should be re-opened and why. Thanks.

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

3 participants