Comments (7)
That seems out of scope for pkg-config
, but the system-deps
crate is doing such things on top of pkg-config
and also provides a generic way of hooking into functions for building the dependencies internally.
cargo really needs a better mechanism for external dependency discovery and building.
from pkg-config-rs.
Hm, but it looks like people use pkg-config
directly: https://github.com/sanpii/libpq.rs/blob/main/libpq-sys/Cargo.toml
So having the feature to disable this for one dependency, but not for all, doesn't seem reasonable to me.
from pkg-config-rs.
The main problem here is that this is not really composable. You would set this environment variable and it would affect literally every crate in your dependency tree that uses pkg-config
. libpq-sys
might have a fallback to build its dependencies internally, but something else in your dependency tree might not and it would simply fail now.
Hence my comment that this would ideally be solved at a higher level, ideally in cargo itself by providing mechanisms for external dependency discovery / building. The way how it is right now, everybody implements their own artisanal build.rs
that behaves different from anybody else's and by that makes it a mess to build anything with external dependencies that regularly requires source changes for building in a specific environment.
from pkg-config-rs.
libpq-sys
might have a fallback to build its dependencies internally, but something else in your dependency tree might not and it would simply fail now.
Which is exactly what I would like to achieve. As right now, adding a new dependency to the tree (especially unintentionally) would simple enable using pkg-config. However, if I want to opt-out of using pkg-config, and use an "all vendored" approach, I wouldn't be aware of this.
Having a flag to completely opt-out of pkg-config would ensure that a failing build make me aware of that fact, allowing me to choose a way to deal with this.
from pkg-config-rs.
You could also set PKG_CONFIG=/usr/bin/false
for that or just not have it available in the environment at all :) I'm not 100% opposed to adding an environment to pkg-config
for this, it just doesn't seem to actually solve any problem.
But even then this doesn't prevent some build.rs
to e.g. call xml2-config
to find libxml2
instead of going via pkg-config
, or to use the cmake dependency mechanism. I don't see how it would really solve your use-case of having everything vendored, which (again) seems like something to be solved at the cargo level instead of relying on different build.rs
to do anything consistent.
from pkg-config-rs.
I any case, I agree that there should be a more generic way to deal with this in cargo!
And using PKG_CONFIG=/usr/bin/false
sounds like a neat way to solve my issue :)
It is true that it wouldn't prevent any library to do something in addition. But I saw a bunch of -sys
creates which check for pkg-config
first, and if that is available ignore all their other options that they document. Which leads to a case that you are never really aware of which flags are now actually in place.
I also understand that this isn't an issue created by pkg-config
, but the way it is used in various build.rs
scripts.
Then again, the changed sounds simple to me, and follows an existing pattern in pkg-config
, why I assumed it would be a reasonable extension.
If you disagree, then I guess PKG_CONFIG=/usr/bin/false
is good enough.
from pkg-config-rs.
I'm not sure, ideally I'd like to not add new such API unless absolutely needed.
Maybe @thomcc has a second opinion here?
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
- static-nobundle option
- Unable to correctly identify a type of Windows static library name, such as `foo.lib` HOT 7
- pkg-config finds mingw *.a library for msvc target HOT 5
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.