1wilkens / pam-sys

Rust FFI bindings to the Linux Pluggable Authentication Modules (PAM)
https://docs.rs/pam-sys/
Apache License 2.0
18 stars 20 forks source link

Don't link on pam_misc for FreeBSD. #3

Closed gfriloux closed 6 years ago

gfriloux commented 6 years ago

Hello, i am trying to use pam-auth, that depends on pam-sys, under FreeBSD. Building will fail with the following error :

-freebsd/lib/libcompiler_builtins-ac67d1cbae2d63b8.rlib" "-Wl,-Bdynamic" "-l" "ssh2" "-l" "z" "-l" "pam" "-l" "pam_misc" "-l" "ssl" "-l" "crypto" "-l" "sqlite3" "-l" "util" "-l" "execinfo" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util"
  = note: /usr/bin/ld: cannot find -lpam_misc
          cc: error: linker command failed with exit code 1 (use -v to see invocation)

I saw that the last commit excludes linking over pam_misc under macos. The same must applies for at least FreeBSD.

I dont want to spread false informations, but as far as i know, linking over pam_misc is only done under linux (correct me if i am wrong).

PS: I see that latest version on github is 0.5.2 while crates.io reference 0.5.3, why ?

gfriloux commented 6 years ago

If i replace any occurence of :

#[cfg(not(target_os = "macos"))]

by :

#[cfg(target_os = "linux")]

everything will build correctly.

1wilkens commented 6 years ago

Hi, thanks for the issue and PR. I forgot to push the 0.5.3 tag to GH, that's why the release was missing. Version 1.4.0 was just chosen as the minimum version because the library does not depend on features of higher versions, but you are right, it could probably be changed. I will accept the PR and change the Travis file to pick a higher Rust version although I don't know why it fails to pull libc..