-
Notifications
You must be signed in to change notification settings - Fork 28
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
pkg_config::find_library probes an unexpected -L to system folder #85
Comments
Yes I'd happy to accept a patch to fix this behavior. |
rofferom
added a commit
to rofferom/rust-sdl2
that referenced
this issue
Feb 10, 2022
Default pkg-config-rs behavior is to add default system library paths (ex: -L/usr/lib/x86_64-linux-gnu). This is because PKG_CONFIG_ALLOW_SYSTEM_LIBS is set by pkg-config-rs by default. print_system_libs(false) disable this behavior. More details in evdev-rs project: ndesh26/evdev-rs#85
rofferom
added a commit
to rofferom/rust-sdl2
that referenced
this issue
Feb 10, 2022
Default pkg-config-rs behavior is to add default system library paths (ex: -L/usr/lib/x86_64-linux-gnu). This is because PKG_CONFIG_ALLOW_SYSTEM_LIBS is set by pkg-config-rs by default. print_system_libs(false) disable this behavior. More details in evdev-rs project: ndesh26/evdev-rs#85
rofferom
added a commit
to rofferom/rust-sdl2
that referenced
this issue
Oct 13, 2022
Default pkg-config-rs behavior is to add default system library paths (ex: -L/usr/lib/x86_64-linux-gnu). This is because PKG_CONFIG_ALLOW_SYSTEM_LIBS is set by pkg-config-rs by default. print_system_libs(false) disable this behavior. More details in evdev-rs project: ndesh26/evdev-rs#85
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem description
This crate has some side effect to my project build. I'm actually working on a project that links to a
.so
that is installed in a custom path, using pkg-config to get the correct-I
/-L
/-l
flags.But when I'm linking to
evdev-rs
, I get an extra-L/usr/lib/x86_64-linux-gnu
before my own-L
flag. In my specific case, I want to link to a new version of a library that is already available in standard installation paths. Because of the wrong-L
order, the linker will try to use the wrong library version (and fails to link because I'm adding some new symbols).It would be better to get rid of this
-L/usr/lib/x86_64-linux-gnu
, and let the linker search into mycargo:rustc-link-search
at first, and then fallback to/usr/lib/x86_64-linux-gnu
that is a standard research path.Maybe there is a way to force the
-L
order, but I haven't found it.Analysis
In
build.rs
, the call to pkg-config has a weird behavior.I expected the flags to be configured like this:
Instead, it does something else instead:
Someone has already complained long ago about this, but the default behavior hasn't been changed: rust-lang/pkg-config-rs#35. Instead, a configuration flag has been added to disable this behavior: rust-lang/pkg-config-rs@d184e48.
I made a test on my side with a
print_system_libs(false)
, and it fixes my build issue.Do you think it is possible to change this behavior in
evdev-rs
?The text was updated successfully, but these errors were encountered: