Comments (9)
Btw. part of the problem seems to be that Homebrew is inconsistent with the link flags: some .pc
files declare the /usr/local/lib
directory while some directly declare the "keg" directory (=actual, single-library-exclusive install directory). I filed a GitHub issue to Homebrew that it would be good if they had a general guideline to declare the "keg" dir, since passing an exclusive directory should prevent any conflicts, and that's why they have them, but it would be super nice if pkg-config
also had this stop-gap measure to improve the overall robustness of this stuff!
from pkg-config-rs.
This sounds like it'd almost want to be a pkg-config feature rather than a pkg-config-rs feature? How would we know what symlinks to follow?
from pkg-config-rs.
You're right in the sense that it would be ideal if pkg-config always returned the "right" directory. However, it quite simply returns what's stated in the .pc
files, and in that sense, this is actually a problem of Homebrew as they provide .pc
files with slightly misleading information.
What pkg-config-rs could do, is to check the library file like compilers do. It already knows the -L and -l flags pkg-config returned to it. Let's say that we're on macOS and pkg-config returned the flags -L/usr/local/lib -lpq
. That would mean checking whether /usr/local/lib/libpq.dylib
is a symlink, and if it is, follow it, and return updated flags, for example: -L/usr/local/Cellar/jpeg/8d/lib/ -lpq
instead.
from pkg-config-rs.
I'd prefer to avoid adding a pseudo-linker in pkg-config-rs, though. All we get is flags, we don't actually know where libs are ourselves. Passing something more specific would require pkg-config-rs to interpret the meaning of flags and start looking in paths and such.
from pkg-config-rs.
Yeah, that is totally understandable. I just wonder, what's the next best thing to do? pkg-config as it currently is, is broken on macOS (For Homebrew users, that is. But that's the most popular package manager for macOS. It may be broken for Fink and MacPorts too, but I haven't tested.), and just trying this simple heuristic should fix the problem and make it an it-just-works experience. It's something that isn't pkg-config-rs's responsibility, as it's doing what's expected of a simple wrapper. It just seems the most straightforward way to fix things.
from pkg-config-rs.
What package is printing out -L/usr/local/lib
? A few I've spot-checked I've got install with homebrew all print out -L/usr/local/Cellar/...
which seems to me like the best solution here
from pkg-config-rs.
Okay, that's great to hear. It's specifically libpq of the postgresql package that prints out -L/usr/local/lib
. I checked all of my packages, and found out that most of the packages did print out the Cellar
path which is great. postgres-related things didn't, and SDL-related things didn't.
I was under an impression that a larger portion of packages would print out the problematic -L/usr/local/lib
, but apparently this was false. So maybe it's possible to fix at the Homebrew side after all, case-by-case.
from pkg-config-rs.
Oh yeah that'd be ideal if the postgres package could be updated to print out the local version to avoid pollution of picking up other libs by accident.
from pkg-config-rs.
For reference, we are having that discussion here: Homebrew/homebrew-core#8472 (comment)
from pkg-config-rs.
Related Issues (20)
- Static linking is too restrictive HOT 10
- Install/build pkg-config if it's not available on the system HOT 2
- Dependencies on the environment variables are not properly reported to cargo HOT 4
- Using pkg-config in build.rs on FreeBSD brokes ncurses normal work HOT 2
- Improving cross-compilation experience HOT 3
- Add readme = "README.md" in cargo.toml to have the readme displayed on crates.io HOT 2
- Dependency being constantly rebuilt due to 'env_metadata' being set to 'true' HOT 8
- Should we parse -isystem Cflags? HOT 2
- customized pkg-config is incomplete? HOT 1
- Bug: Missing support for `pkgconf` for Fedora HOT 3
- v0.3.21 raised MSRV to 1.47.0 HOT 4
- Placing pkg-config.exe file to this git if possible HOT 3
- Libraries linked in incorrect order HOT 3
- Incorrect parse result for raw archive path HOT 3
- [Feature Request] Add configurable linking modifiers HOT 6
- `PKG_CONFIG_PATH_FOR_BUILD` env var HOT 4
- Allow disabling pkg-config altogether HOT 7
- static-nobundle option
- Unable to correctly identify a type of Windows static library name, such as `foo.lib` HOT 7
- Cargo build say "library name must not be empty" while using statik(true) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pkg-config-rs.