zstd not found if installed in non-system prefix

Message ID d51d2577a201521081735ab9f6235408036775f6.camel@ikkoku.de
State New
Headers show
Series
  • zstd not found if installed in non-system prefix
Related show

Commit Message

Michael Kuhn May 20, 2020, 7:32 p.m.
Hi,

when specifying a non-system prefix with --with-zstd, the build fails
because the header and library cannot be found (see 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005).

The attached patch fixes the problem and is what we use in Spack to
make GCC build with zstd support.


Best regards,
Michael

Comments

Matthias Klose May 25, 2020, 3:06 p.m. | #1
On 5/20/20 9:32 PM, Michael Kuhn wrote:
> Hi,

> 

> when specifying a non-system prefix with --with-zstd, the build fails

> because the header and library cannot be found (see 

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005).

> 

> The attached patch fixes the problem and is what we use in Spack to

> make GCC build with zstd support.


documentation for this is missing in gcc/doc/install.texi.  Also please don't
introduce configurations via environment variables, but add options like for
gmp. See

@item --with-gmp=@var{pathname}
@itemx --with-gmp-include=@var{pathname}
@itemx --with-gmp-lib=@var{pathname}

Matthias
Martin Liška May 27, 2020, 1:36 p.m. | #2
On 5/20/20 9:32 PM, Michael Kuhn wrote:
> Hi,

> 

> when specifying a non-system prefix with --with-zstd, the build fails

> because the header and library cannot be found (see

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005).

> 

> The attached patch fixes the problem and is what we use in Spack to

> make GCC build with zstd support.


Hello.

I support the patch, but we need to wait for an approval of a maintainer.

Martin

> 

> 

> Best regards,

> Michael

>
Matthias Klose June 3, 2020, 8:15 a.m. | #3
On 5/27/20 3:36 PM, Martin Liška wrote:
> On 5/20/20 9:32 PM, Michael Kuhn wrote:

>> Hi,

>>

>> when specifying a non-system prefix with --with-zstd, the build fails

>> because the header and library cannot be found (see

>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005).

>>

>> The attached patch fixes the problem and is what we use in Spack to

>> make GCC build with zstd support.

> 

> Hello.

> 

> I support the patch, but we need to wait for an approval of a maintainer.


but please don't allow configuration via environment variables.
Richard Biener via Gcc-patches June 9, 2020, 8:08 p.m. | #4
On Wed, 2020-05-20 at 21:32 +0200, Michael Kuhn wrote:
> Hi,

> 

> when specifying a non-system prefix with --with-zstd, the build fails

> because the header and library cannot be found (see 

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95005).

> 

> The attached patch fixes the problem and is what we use in Spack to

> make GCC build with zstd support.

THanks.  Installed.

jeff
>

Patch

--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1075,7 +1075,8 @@  GNATMAKE = @GNATMAKE@
 # Libs needed (at present) just for jcf-dump.
 LDEXP_LIB = @LDEXP_LIB@
 
-ZSTD_LIB = @ZSTD_LIB@
+ZSTD_INC = @ZSTD_CPPFLAGS@
+ZSTD_LIB = @ZSTD_LDFLAGS@ @ZSTD_LIB@
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
@@ -2275,7 +2276,7 @@  CFLAGS-version.o += -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
 version.o: $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
 
 # lto-compress.o needs $(ZLIBINC) added to the include flags.
-CFLAGS-lto-compress.o += $(ZLIBINC)
+CFLAGS-lto-compress.o += $(ZLIBINC) $(ZSTD_INC)
 
 CFLAGS-lto-streamer-in.o += -DTARGET_MACHINE=\"$(target_noncanonical)\"
 
--- a/gcc/configure
+++ b/gcc/configure
@@ -786,6 +786,8 @@  LTLIBICONV
 LIBICONV
 ZSTD_LIB
 ZSTD_INCLUDE
+ZSTD_LDFLAGS
+ZSTD_CPPFLAGS
 DL_LIB
 LDEXP_LIB
 EXTRA_GCC_LIBS
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1339,6 +1339,8 @@  AC_SUBST(ZSTD_INCLUDE)
 AC_SUBST(ZSTD_LIB)
 ZSTD_CPPFLAGS=
 ZSTD_LDFLAGS=
+AC_SUBST(ZSTD_CPPFLAGS)
+AC_SUBST(ZSTD_LDFLAGS)
 AC_ARG_WITH(zstd,
 	[AS_HELP_STRING([--with-zstd=PATH],
 		[specify prefix directory for installed zstd library.