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

PackageConfig lib linking issue #2

Open
dalu93 opened this issue Jan 17, 2019 · 4 comments
Open

PackageConfig lib linking issue #2

dalu93 opened this issue Jan 17, 2019 · 4 comments

Comments

@dalu93
Copy link

dalu93 commented Jan 17, 2019

Hi,

Thank you for this great library! I've start using it recently and I came across a small problem.
The library looks by default in the .build folder for the libPackageConfig.

So, when I run the following on my package, for example:

swift build && cd .build/debug/ && ./my-executable

The result is that it cannot find the .build folder. The same happens when moving the binary in the /usr/local/bin path, which sort of make it un-usable together with Mint

Is there any plan to overcome this issue? Is it even considered as an issue?
Thank you very much

@orta
Copy link
Member

orta commented Jan 17, 2019

I think it could look in a few different folders for a build directory (we did that with danger-swift for example)

I'd consider it an issue, they probably hardcode those build folders so can just make a list and look there?

@dalu93
Copy link
Author

dalu93 commented Jan 17, 2019

This wouldn’t work in case PackageConfig is included as a dependency in the Package file. So would you recommend to install PackageConfig globally using mint, for example?

@dalu93
Copy link
Author

dalu93 commented Jan 18, 2019

On the same note, what I would expect from most of the people are the below steps:

  1. Import PackageConfig as a dependency of their executable
  2. Build the executable on top of that (and somewhere try to call getPackageConfig())
  3. Take the executable binary and move it to a different folder (ex: /usr/local/)
  4. When launching the executable, that would crash because the lib couldn't be found.

@IgorMuzyka
Copy link
Collaborator

@dalu93 think i have an idea on how to make it work almost as you specified.

Writer.write(configuration: self)

static func write<T: PackageConfig>(configuration: T) {


I think modifying these methods to accept a list of path to search for dynamic libraries at run would suffice.
So that a library user would define search path for a dynamic library in the config as follows.

#if canImport(ExampleConfig)
import ExampleConfig

ExampleConfig(value: "example value").write(searchPaths: ["/usr/local/", ".build/debug", ])
#endif

Would try to implement when i have time. This would allow PackageConfig to also be installed system wide.

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