Build broken with old zstd
Mark Wielaard
mark@klomp.org
Thu Nov 3 19:22:29 GMT 2022
Hi Christophe,
On Thu, Nov 03, 2022 at 07:10:23PM +0100, Christophe Lyon wrote:
> I have noticed that the debian-armhf buildbot on Sourceware
> (https://builder.sourceware.org/buildbot/#/builders?tags=binutils)
> has been failing to build binutils for quite a long time, with:
> ../../binutils-gdb/gas/compress-debug.c: In function ‘compress_data’:
> ../../binutils-gdb/gas/compress-debug.c:62:20: error: implicit declaration
> of function ‘ZSTD_compressStream2’; did you mean ‘ZSTD_compressStream’?
> [-Werror=implicit-function-declaration]
> size_t ret = ZSTD_compressStream2 (ctx, &ob, &ib, ZSTD_e_continue);
> ^~~~~~~~~~~~~~~~~~~~
> ZSTD_compressStream
>
>
> I took me a bit of time to reproduce it, because the build succeeded with
> debian stable, I had to switch to oldstable to see the failure (IIUC that's
> the version used by the buildbot)
>
> My understanding is that the version of zstd shipped with debian oldstable
> is too old for binutils (it does not provide ZSTD_compressStream2).
> I did not see the problem in my ubuntu containers because I do not install
> libzstd-dev there, and configure disables the use of zstd.
>
> I am surprised no one has noticed this before, but I see several other
> Sourceware binutils builbots are failing on other targets, maybe for the
> same reason.
>
> It looks like the right fix is to improve the detection of zstd at configure
> time (IIUC we only check if it's present, not its version).
ZSTD_compressStream2 is only available with libzstd >= 1.4.0 (and
debian oldstable only has 1.3.8, so the check should be:
diff --git a/config/zstd.m4 b/config/zstd.m4
index 6da4db68c58..eb34c0f36d7 100644
--- a/config/zstd.m4
+++ b/config/zstd.m4
@@ -12,7 +12,7 @@ AC_ARG_WITH(zstd,
[], [with_zstd=auto])
AS_IF([test "$with_zstd" != no],
- [PKG_CHECK_MODULES(ZSTD, [libzstd], [
+ [PKG_CHECK_MODULES(ZSTD, [libzstd >= 1.4.0], [
AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.])
], [
if test "$with_zstd" = yes; then
But you also need to regenerate all configure files with the correct
autoconf version.
Cheers,
Mark
More information about the Binutils
mailing list