[PATCH v2] Support building when fts and obstack aren't part of libc.

Érico Nogueira ericonr@disroot.org
Tue Nov 3 23:39:16 GMT 2020


On Tue Nov 3, 2020 at 10:33 PM -03, Dmitry V. Levin wrote:
> On Sun, Nov 01, 2020 at 09:48:50PM -0300, Érico Nogueira via
> Elfutils-devel wrote:
> > From: Érico Rolim <erico.erc@gmail.com>
> > 
> > - Make configure.ac test for fts and obstack availability;
> > - Add fts and obstack ldflags to all files that need them;
> > - Add missing argp ldflags to programs in debuginfod/.
> > 
> > Signed-off-by: Érico Rolim <erico.erc@gmail.com>
> > ---
> >  ChangeLog              |  4 ++++
> >  configure.ac           | 20 ++++++++++++++++++++
> >  debuginfod/Makefile.am |  6 +++---
> >  libdw/Makefile.am      |  2 +-
> >  src/Makefile.am        |  6 +++---
> >  5 files changed, 31 insertions(+), 7 deletions(-)
> > 
> > diff --git a/ChangeLog b/ChangeLog
> > index 128da6c6..565d021c 100644
> > --- a/ChangeLog
> > +++ b/ChangeLog
> > @@ -1,3 +1,7 @@
> > +2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
> > +
> > +	* configure.ac: Check for fts and obstack from outside libc.
> > +
> >  2020-10-28  Mark Wielaard  <mark@klomp.org>
> >  
> >  	* configure.ac: Set version to 0.182.
> > diff --git a/configure.ac b/configure.ac
> > index 515ac704..c1a6954d 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -542,6 +542,26 @@ else
> >  fi
> >  AC_SUBST([argp_LDADD])
> >  
> > +saved_LIBS="$LIBS"
> > +AC_SEARCH_LIBS([fts_close], [fts])
> > +LIBS="$saved_LIBS"
> > +case "$ac_cv_search_fts_close" in
> > +        no) AC_MSG_FAILURE([failed to find fts_close]) ;;
> > +        -l*) fts_LIBS="$ac_cv_search_fts_close" ;;
> > +        *) fts_LIBS= ;;
> > +esac
> > +AC_SUBST([fts_LIBS])
> > +
> > +saved_LIBS="$LIBS"
> > +AC_SEARCH_LIBS([_obstack_free], [obstack])
> > +LIBS="$saved_LIBS"
> > +case "$ac_cv_search__obstack_free" in
> > +        no) AC_MSG_FAILURE([failed to find obstack_free]) ;;
> > +        -l*) obstack_LIBS="$ac_cv_search__obstack_free" ;;
> > +        *) obstack_LIBS= ;;
> > +esac
> > +AC_SUBST([obstack_LIBS])
> > +
>
> Hmm. In [1] I suggested to check for obstack_free, but
> here I see you're checking for _obstack_free instead.
> Since both symbols are provided by glibc, I wonder what was
> the reason for this change. Is it something to do with libobstack?

I'm using the version of libobstack [1] that as far as I know is used by
most musl-based distros (some of them pull directly from pullmoll's
personal repo rather than from the void-linux namespace).

As you can see in [2], obstack_free is a macro, and AC_SEARCH_LIBS
didn't seem able to find it during my testing. On the other hand,
_obstack_free was an actual function, so I switched to it.

>
> By the way, the text of AC_MSG_FAILURE is out of sync with the symbol
> name.

Indeed. I can send a fix for it together with the argp patch if that's
ok. Thanks for noticing.

>
> [1] https://sourceware.org/pipermail/elfutils-devel/2020q4/002970.html
>
>
> --
> ldv

- [1] https://github.com/void-linux/musl-obstack
- [2] https://github.com/void-linux/musl-obstack/blob/d0493f4726835a08c5a145bce42b61a65847c6a9/obstack.h#L421


More information about the Elfutils-devel mailing list