* [PATCH] build: Check that -lzstd can be linked
@ 2023-03-28 13:21 Rainer Orth
2023-04-02 21:15 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Rainer Orth @ 2023-03-28 13:21 UTC (permalink / raw)
To: gcc-patches; +Cc: Alexandre Oliva
[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]
Recent Solaris 11.4 SRUs bundle zstd, but only the 64-bit libraries (no
idea why). Because of this, in 32-bit builds cc1 etc. fail to link with
undefined references to various ZSTD_* functions from lto-compress.o.
This happens because currently only the presence of <zstd.h> is
necessary to enable zstd support in lto-compress.cc etc.
This patch checks for libzstd first and disables zstd support if
missing.
Tested on sparc-sun-solaris2.11 with the system installation of zstd
(64-bit only) and a locally-compiled one (specified with --with-zstd).
Ok for trunk?
* Setting the cache variable first might be considered a hack:
alternatively, one could use AC_LINK_IFELSE instead of
AC_COMPILE_IFELSE, adjusting the test program accordingly.
* All the code withing
if test "x$with_zstd" != xno; then
lacks indentation, which makes it harder to read. I've left that out
of this patch, though.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2023-03-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
gcc:
* configure.ac (ZSTD_LIB): Move before zstd.h check.
Unset gcc_cv_header_zstd_h without libzstd.
* configure: Regenerate.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: zstd-lib.patch --]
[-- Type: text/x-patch, Size: 953 bytes --]
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1494,6 +1494,14 @@ fi
CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS"
LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"
+# LTO can use zstd compression algorithm
+save_LIBS="$LIBS"
+LIBS=
+AC_SEARCH_LIBS(ZSTD_compress, zstd,, gcc_cv_header_zstd_h=no)
+ZSTD_LIB="$LIBS"
+LIBS="$save_LIBS"
+AC_SUBST(ZSTD_LIB)
+
AC_MSG_CHECKING(for zstd.h)
AC_CACHE_VAL(gcc_cv_header_zstd_h,
# We require version 1.3.0 or later. This is the first version that has
@@ -1512,14 +1520,6 @@ if test $gcc_cv_header_zstd_h = yes; the
elif test "x$with_zstd" != x; then
as_fn_error $? "Unable to find zstd.h. See config.log for details." "$LINENO" 5
fi
-
-# LTO can use zstd compression algorithm
-save_LIBS="$LIBS"
-LIBS=
-AC_SEARCH_LIBS(ZSTD_compress, zstd)
-ZSTD_LIB="$LIBS"
-LIBS="$save_LIBS"
-AC_SUBST(ZSTD_LIB)
fi
dnl Disabled until we have a complete test for buggy enum bitfields.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] build: Check that -lzstd can be linked
2023-03-28 13:21 [PATCH] build: Check that -lzstd can be linked Rainer Orth
@ 2023-04-02 21:15 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-04-02 21:15 UTC (permalink / raw)
To: Rainer Orth, gcc-patches; +Cc: Alexandre Oliva
On 3/28/23 07:21, Rainer Orth wrote:
> Recent Solaris 11.4 SRUs bundle zstd, but only the 64-bit libraries (no
> idea why). Because of this, in 32-bit builds cc1 etc. fail to link with
> undefined references to various ZSTD_* functions from lto-compress.o.
> This happens because currently only the presence of <zstd.h> is
> necessary to enable zstd support in lto-compress.cc etc.
>
> This patch checks for libzstd first and disables zstd support if
> missing.
>
> Tested on sparc-sun-solaris2.11 with the system installation of zstd
> (64-bit only) and a locally-compiled one (specified with --with-zstd).
>
> Ok for trunk?
OK
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-02 21:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 13:21 [PATCH] build: Check that -lzstd can be linked Rainer Orth
2023-04-02 21:15 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).