himmelblau-idm / himmelblau

Azure Entra ID Authentication, with PAM and NSS modules.
GNU General Public License v3.0
45 stars 8 forks source link

Compiling Himmelblau on Ubuntu 24.04 #166

Closed run-stop closed 1 month ago

run-stop commented 2 months ago

I'm following the instructions from the homepage to install Ubuntu packages. The only difference is that I had to use libclang-dev instead of libclang-13-dev. On the fresh Ubuntu 24.04 LTS Desktop VM, I've installed the Ubuntu packages:

sudo apt-get install libpam0g-dev libudev-dev libssl-dev pkg-config tpm-udev libtss2-dev libcap-dev libtalloc-dev libtevent-dev libldb-dev libdhash-dev libkrb5-dev libpcre2-dev libclang-dev autoconf gettext

I've used rustup to install Rust toolchain.

The make process fails as follows:

error: failed to run custom build command for `idmap v0.5.0 (/home/aleksandar-miljkovic/AD/himmelblau/src/idmap)`

Caused by:
  process didn't exit successfully: `/home/user/AD/himmelblau/target/debug/build/idmap-afd29ee2208ec77e/build-script-build` (exit status: 101)
  --- stderr
  sssd/src/external/libpcre.m4:20: warning: AC_LIB_PREPARE_PREFIX is m4_require'd but not m4_defun'd
  sssd/src/build_macros.m4:42: SSS_AC_EXPAND_LIB_DIR is expanded from...
  sssd/src/external/libpcre.m4:20: the top level
  configure:4374: error: possibly undefined macro: AC_LIB_PREPARE_PREFIX
        If this token and others are legitimate, please use m4_pattern_allow.
        See the Autoconf documentation.
  configure:4377: error: possibly undefined macro: AC_LIB_WITH_FINAL_PREFIX
  autoreconf: error: /usr/bin/autoconf failed with exit status: 1
  thread 'main' panicked at src/idmap/build.rs:14:9:
  Failed to configure sss_idmap
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
make: *** [Makefile:3: all] Error 101

Any suggestions on fixing this? I would like to build Ubuntu packages and test them on 24.04, 22.04 and possibly 20.04.

Thank you in advance!

dmulder commented 2 months ago

Sounds like that m4 macro is defined in gettext.

run-stop commented 2 months ago

After adding several dependencies, and appending the SAMBA4 include header folder to the CFLAGS variable, rust compiler fails complaining about missing msal crate. Then I've added the missing crate to several modules (himmelblu_unix_common and kandim_utils_users), but then finally Rust compailer failed complaining that msal library has a missing dependency of msal crate...

mw-a commented 2 months ago

Same here on current Debian testing. It seems, libhimmelblau 0.2.7+ has gone incompatible with himmelblau by renaming itself from msal to himmelblau and changing at least some of its API. Pinning it to =0.2.6 in Cargo.toml is a workaround. Upping it to 0.2.7 and changing msal:: to himmelblau:: in src/common/src/idprovider/himmelblau.rs gets me as far as:

   Compiling himmelblau_unix_common v0.5.0 (/home/m/himmelblau/src/common)                                                                                                                                                                                                        
error[E0308]: mismatched types                                                                                                                                                                                                                                                    
    --> src/common/src/idprovider/himmelblau.rs:1426:28                                                                                                                                                                                                                           
     |                                                                                                                                                                                                                                                                            
1426 |             .enroll_device(token, attrs, tpm, machine_key)                                                                                                                                                                                                                 
     |              ------------- ^^^^^ expected `&str`, found `&UserToken`                                                                                                                                                                                                       
     |              |                                                                                                                                                                                                                                                             
     |              arguments to this method are incorrect                                                                                                                                                                                                                        
     |                                                                                                                                                                                                                                                                            
     = note: expected reference `&str`                                                                                                                                                                                                                                            
                found reference `&himmelblau::UserToken`                                                                                                                                                                                                                          
note: method defined here                                                                                                                                                                                                                                                         
    --> /home/m/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libhimmelblau-0.2.9/src/auth.rs:1977:18                                                                                                                                                                      
     |                                                                                                                                                                                                                                                                            
1977 |     pub async fn enroll_device(                                                                                                                                                                                                                                            
     |                  ^^^^^^^^^^^^^                                                                                                                                                                                                                                             

For more information about this error, try `rustc --explain E0308`.             
dmulder commented 2 months ago

Hrm, sorry for the confusion. I thought I had worked out all those kinks. Yes, you need libhimmelblau pinned at 0.2.6 to build.

dmulder commented 2 months ago

And yes, I made some small changes to the API. I probably should have included a major version change with that.

dmulder commented 2 months ago

Well, looks like I did work out those kinks, but in branch stable-0.4.x. Are you trying to build main?

mw-a commented 2 months ago

Are you trying to build main?

I am indeed.

dmulder commented 2 months ago

Do you know which additional dependencies you needed in order to build on Ubuntu 24.04? It would be good to add that to the documentation.

mw-a commented 2 months ago

@run-stop posted his list in https://github.com/himmelblau-idm/himmelblau/issues/166#issue-2496884415. As I'm on Debian testing, my list is not very helpful - although I should be able to cobble it together still.

dmulder commented 2 months ago

@run-stop posted his list in #166 (comment). As I'm on Debian testing, my list is not very helpful - although I should be able to cobble it together still.

I think that's just the list I already have documented, @run-stop later says: "After adding several dependencies...". I'm wondering which others were added.

mw-a commented 2 months ago

What both @run-stop and I seem to need to do as well is to add samba includes to the compiler search path in order for ldb.h to be found. I'm currently doing this crudely like so:

CFLAGS="-I/usr/include/samba-4.0" make

Is this something that could be addressed easily?

dmulder commented 2 months ago

What both @run-stop and I seem to need to do as well is to add samba includes to the compiler search path in order for ldb.h to be found. I'm currently doing this crudely like so:

CFLAGS="-I/usr/include/samba-4.0" make

Is this something that could be addressed easily?

I'll see what I can do.

dmulder commented 2 months ago

@mw-a could you check if #169 fixes your build problem?

mw-a commented 1 month ago

@dmulder Yes, it does. And I understand that with #167 merged, main does now also build without modification with libhimmelblau 0.2.9+. Awesome! :)

FWIW: Here's my package list for current Debian testing: libpam0g-dev libudev-dev libssl-dev pkg-config tpm-udev libtss2-dev libcap-dev libtalloc-dev libtevent-dev libldb-dev libdhash-dev libkrb5-dev libpcre2-dev libclang-dev autoconf gettext cargo libsqlite3-dev

This is basically your documented list with libclang-dev instead of libclang-13-dev (as Debian is at 16 currently) plus cargo (pulls in the rust toolchain I guess) and libsqlite3-dev (otherwise libnss_himmelblau and aad-tool do not link with note: /usr/bin/ld: cannot find -lsqlite3).

dmulder commented 1 month ago

@dmulder Yes, it does. And I understand that with #167 merged, main does now also build without modification with libhimmelblau 0.2.9+. Awesome! :)

Perfect!

FWIW: Here's my package list for current Debian testing: libpam0g-dev libudev-dev libssl-dev pkg-config tpm-udev libtss2-dev libcap-dev libtalloc-dev libtevent-dev libldb-dev libdhash-dev libkrb5-dev libpcre2-dev libclang-dev autoconf gettext cargo libsqlite3-dev

This is basically your documented list with libclang-dev instead of libclang-13-dev (as Debian is at 16 currently) plus cargo (pulls in the rust toolchain I guess) and libsqlite3-dev (otherwise libnss_himmelblau and aad-tool do not link with note: /usr/bin/ld: cannot find -lsqlite3).

Those are the same dependencies I found in my testing yesterday. I'll add those to the documentation.

dmulder commented 1 month ago

I've corrected the README to list those additional dependencies for Debian based distros.