Hi Paul,
On Tue, Sep 10, 2024 at 08:47:17AM -0400, Paul Smith wrote:
> On Tue, 2024-09-10 at 10:52 +0200, Mark Wielaard wrote:
> > On Mon, Sep 09, 2024 at 06:21:16PM -0400, Paul Smith wrote:
> > > On Mon, 2024-09-09 at 15:29 -0400, Paul Smith wrote:
> > > > I'm trying to build the latest elfutils release 0.191. The
> > > > configure
> > > > help says:
> > > >
> > > > ZSTD_COMPRESS_CFLAGS
> > > > C compiler flags for ZSTD_COMPRESS, overriding pkg-
> > > > config
> > > > ZSTD_COMPRESS_LIBS
> > > > linker flags for ZSTD_COMPRESS, overriding pkg-
> > > > config
> > >
> > > Actually, these variables don't seem to work either.
> > >
> > > Looking at the generated configure script, I don't see how to get
> > > elfutils to use zstd from a non-standard location?
> >
> > Yeah, this is unfortunate. There are two checks in configure.ac. One
> > for zstd decompression support (as used in libdw) which uses the
> > eu_ZIPLIB macro (as defined in m4/zip.m4). This is the main check, it
> > also creates the --with-zstd=... configure argument to provide an
> > alternative location.
>
> Hm. Are you saying that if I use --with-zstd=/my/prefix that should
> work? That was the first thing I tried, but it didn't seem to work and
> I don't think (from reading the configure script) where this value is
> used as part of the path search. But, the shell output of autoconf is
> not easy to read so maybe I missed it. I can give it another try.
It should work, for building libdw. But then we (elfutils in
configure.ac) does something odd for building with libelf by using
pkgconfig.
I would try two things:
- Remove the PKG_CONFIG checking and just set with_zstd_compress to
with_zstd:
diff --git a/configure.ac b/configure.ac
index 8f5901a2af7c..3c10ae3482fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -458,12 +458,7 @@ zip_LIBS="$LIBS"
LIBS="$save_LIBS"
AC_SUBST([zip_LIBS])
-dnl zstd compression support requires libzstd 1.4.0+
-AS_IF([test "x$with_zstd" = xyes], [
- PKG_PROG_PKG_CONFIG
- PKG_CHECK_MODULES([ZSTD_COMPRESS],[libzstd >= 1.4.0],
-[with_zstd_compress="yes"],[with_zstd_compress="no"])],
- [with_zstd_compress="no"])
+with_zstd_compress=$with_zstd
AM_CONDITIONAL(USE_ZSTD_COMPRESS, test "x$with_zstd_compress" = "xyes")
AS_IF([test "x$with_zstd_compress" = "xyes"],
[AC_DEFINE([USE_ZSTD_COMPRESS], [1], [zstd compression support])])
Now --with-zstd=... should work.
- Replace the function being checked to something libzstd only defines
with 1.4.0+ maybe ZSTD_compressStream2 (which is actually used in
libelf.
diff --git a/configure.ac b/configure.ac
index 8f5901a2af7c..1307fb2df086 100644
--- a/configure.ac
+++ b/configure.ac
@@ -449,7 +449,7 @@ LIBS="$lzma_LIBS $save_LIBS"
AS_IF([test "x$with_lzma" = xyes], [LIBLZMA="liblzma"], [LIBLZMA=""])
AC_SUBST([lzma_LIBS])
AC_SUBST([LIBLZMA])
-eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)])
+eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_compressStream2,[ZSTD (zst)])
AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""])
AC_SUBST([LIBZSTD])
zstd_LIBS="$LIBS"
Hope that helps. It would mean requiring zstd 1.4.0+ always, but that
might be reasonable these days.
Cheers,
Mark