Lack of proper linking during the build process - #546
Conversation
The PAM module didn't specify #[link(name = "pam")] on the extern "C" block, so the linker never emitted -lpam. PAM then failed to dlopen the module with undefined symbol errors for pam_get_item, pam_get_user, pam_set_data, pam_get_data
|
See gtk-rs/gtk-rs-core@8e0a85a, this shouldn't be necessary. Note that pam authentication IS working on GNOME OS. |
|
Are you saying this will work ONLY for GNOME OS? And what does that commit have to do with it? It’s completely irrelevant? |
No, I am saying that we know that it work at least on GNOME OS. It has also been tested on fedora.
It removed the link=name (which can also be defined via cargo.toml) from all the rust bindings since in that case it was deemed it was not doing anything. |
|
Yes, but it doesn't work on CachyOS. The problem is that if you add that line, it links correctly with libpam, and then everything starts working |
|
If necessary, I’m ready to add a commit to centralize it in |
Can you test if it helps in your case? |
|
I’ve already built and tested the PR and am using it right now. I don't quite understand the part about Cargo. Do you want me to add: [target.x86_64-unknown-linux-gnu]
rustflags = ["-l", "pam"] |
|
Is this already closed? |
|
See the commit I linked above for an example on how to set it on Cargo.toml. |
|
U mean this commit - gtk-rs/gtk-rs-core@8e0a85a? |
|
And silent... |
|
So? |
|
No, the suggestion is to use links in Cargo.toml and see if that helps. |
|
But the The commit you linked is about exactly that manifest key — it removes So it isn't evidence that the attribute is redundant here — if anything it argues against adding With no link directive of any kind, pam_oo7.so gets no DT_NEEDED entry for libpam.so.0: That happens to work whenever the process calling dlopen() already has libpam in its global symbol scope, which covers most login paths — hence it being fine on GNOME OS and Fedora. Here it fails with: If you'd prefer to keep the directive out of the source, I'm happy to switch the PR to a build script instead — functionally identical to the attribute: // pam/build.rs
fn main() {
println!("cargo::rustc-link-lib=pam");
}Happy to go with whichever you prefer. |
The PAM module didn't specify #[link(name = "pam")] in the extern "C" block, so the linker never emitted -lpam. PAM then failed to dlopen the module with undefined symbol errors for pam_get_item, pam_get_user, pam_set_data, and pam_get_data.
Please either add this yourself or accept a PR to prevent this from happening again and ensure PAM authentication works properly