1wilkens / pam

Safe Rust API to the Linux Pluggable Authentication Modules (PAM)
https://docs.rs/pam/
Apache License 2.0
88 stars 37 forks source link

Error Building pam on Debian Linux #26

Closed ogranada closed 1 year ago

ogranada commented 3 years ago

I´m having the next issue building pam from master branch:

cargo build  
   Compiling libc v0.2.103
   Compiling memchr v2.4.1
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.29
   Compiling version_check v0.9.3
   Compiling glob v0.3.0
   Compiling log v0.4.14
   Compiling unicode-xid v0.2.2
   Compiling quick-error v1.2.3
   Compiling unicode-width v0.1.9
   Compiling regex-syntax v0.6.25
   Compiling bitflags v1.3.2
   Compiling ansi_term v0.11.0
   Compiling strsim v0.8.0
   Compiling termcolor v1.1.2
   Compiling vec_map v0.8.2
   Compiling bindgen v0.55.1
   Compiling lazycell v1.3.0
   Compiling peeking_take_while v0.1.2
   Compiling lazy_static v1.4.0
   Compiling rustc-hash v1.1.0
   Compiling shlex v0.1.1
   Compiling cfg-if v0.1.10
   Compiling syn v1.0.78
   Compiling libloading v0.7.0
   Compiling textwrap v0.11.0
   Compiling humantime v1.3.0
   Compiling nom v5.1.2
   Compiling clang-sys v1.2.2
   Compiling aho-corasick v0.7.18
   Compiling quote v1.0.9
   Compiling atty v0.2.14
   Compiling which v3.1.1
   Compiling users v0.10.0
   Compiling clap v2.33.3
   Compiling regex v1.5.4
   Compiling cexpr v0.4.0
   Compiling env_logger v0.7.1
   Compiling pam-macros v0.0.2
   Compiling pam-sys v1.0.0-alpha3
   Compiling pam v0.7.0 (https://github.com/1wilkens/pam?branch=master#dc4fe9c9)
error[E0308]: mismatched types
 --> /home/ogranada/.cargo/git/checkouts/pam-b105b76664d251d7/dc4fe9c/src/enums.rs:8:1
  |
8 | #[pam_enum]
  | ^^^^^^^^^^^ expected `u32`, found `i32`
  |
  = note: this error originates in the attribute macro `pam_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
  |
8 | #[pam_enum].try_into().unwrap()
  |

error[E0308]: mismatched types
   --> /home/ogranada/.cargo/git/checkouts/pam-b105b76664d251d7/dc4fe9c/src/enums.rs:119:1
    |
119 | #[pam_enum]
    | ^^^^^^^^^^^ expected `u32`, found `i32`
    |
    = note: this error originates in the attribute macro `pam_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
    |
119 | #[pam_enum].try_into().unwrap()
    |

error[E0308]: mismatched types
   --> /home/ogranada/.cargo/git/checkouts/pam-b105b76664d251d7/dc4fe9c/src/enums.rs:177:1
    |
177 | #[pam_enum]
    | ^^^^^^^^^^^ expected `u32`, found `i32`
    |
    = note: this error originates in the attribute macro `pam_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
    |
177 | #[pam_enum].try_into().unwrap()
    |

error[E0308]: mismatched types
   --> /home/ogranada/.cargo/git/checkouts/pam-b105b76664d251d7/dc4fe9c/src/enums.rs:226:1
    |
226 | #[pam_enum]
    | ^^^^^^^^^^^ expected `u32`, found `i32`
    |
    = note: this error originates in the attribute macro `pam_enum` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
    |
226 | #[pam_enum].try_into().unwrap()
    |

For more information about this error, try `rustc --explain E0308`.
error: could not compile `pam` due to 4 previous errors

Environment information:

OS: Linux debian 5.14.0-1-amd64 #1 SMP Debian 5.14.6-2 (2021-09-19) x86_64 GNU/Linux CARGO: cargo 1.55.0 (32da73ab1 2021-08-23) RUSTC: rustc 1.55.0 (c8dfcfe04 2021-09-06)

Package dependencies

[package]
name = "sample"
version = "0.1.0"

[dependencies]
# pam = "0.7.0"
pam = { git = "https://github.com/1wilkens/pam", branch = "master" }
lechner commented 3 years ago

@ogranada Hi, maybe https://github.com/1wilkens/pam/pull/24 would help?

I believe there is presently a compatibility issue with non-Linux systems.

ogranada commented 3 years ago

@ogranada Hi, maybe #24 would help?

I believe there is presently a compatibility issue with non-Linux systems.

How can I help to test the packages?

ogranada commented 3 years ago

I just built the package pam-sys@v1.0.0-alpha3 changing the

     .default_macro_constant_type(bindgen::MacroTypeVariation::Signed)

By

     .default_macro_constant_type(bindgen::MacroTypeVariation::Unsigned)

and the build process happened properly.

1wilkens commented 2 years ago

Sorry for the late reply! I was figuring out some details in pam-sys and pam was left in a weird state. I pushed some changes to pam-sys that hopefully improve non-Linux compatibility and changed the macro here to properly handle the constants now being i32. I have not cut a release here yet, but feel free to test! Some other things are still in flux, but the build should pass with the latest pam-sys now :)

1wilkens commented 1 year ago

This should be fixed now.