On Mon, 13 Jul 2026 at 01:29, Bruno Haible <[email protected]> wrote:
> >  static int
> >  read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int 
> > options)
> >  {
> > +  if (load_libsystemd () < 0)
> > +    return -1;
> > +
> >    /* Fill entries, simulating what a utmp file would contain.  */
> >    struct utmp_alloc a = { NULL, 0, 0, 0 };
>
> Here I wonder whether it would be good to write a message to stderr,
> something like
>   _("error: functionality provided by libsystemd is not available, as 
> libsystemd.so is not found")
> So that the user does not have to wonder how to fix the failure.

Done.

> Also, what about static linking (CC="gcc -static")?
> Pàdraig, does coreutils support building statically?
> Does glibc support dlopen from statically linked binaries meanwhile?

As far as I can tell with a quick POC it works with glibc, yes

> > +        gl_saved_LIBS="$LIBS"
> > +        AC_SEARCH_LIBS([dlsym], [dl],
> > +          [case "$ac_cv_search_dlsym" in
> > +             'none required') READUTMP_LIB= ;;
> > +             *) READUTMP_LIB=$ac_cv_search_dlsym ;;
> > +           esac],
> > +          [gl_cv_lib_readutmp_systemd=no])
> > +        LIBS="$gl_saved_LIBS"
>
> glibc >= 2.34 does not need -ldl any more. This piece of configuration
> should therefore use m4/libdl.m4, so as to avoid linking with -ldl when
> not needed.

Done

Reply via email to