public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available
@ 2020-03-22 11:16 slyfox at inbox dot ru
  2020-03-22 11:25 ` [Bug lto/94259] " slyfox at inbox dot ru
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: slyfox at inbox dot ru @ 2020-03-22 11:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

            Bug ID: 94259
           Summary: --without-zstd seems to have no effect and links
                    libzstd if available
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at inbox dot ru
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Built gcc with --without-zstd as:

  $ ../gcc/configure --enable-languages=c,c++ --disable-bootstrap
--with-multilib-list=m64
--prefix=/home/slyfox/dev/git/gcc-native-quick/../gcc-native-quick-installed
--disable-nls --without-isl --disable-libsanitizer --disable-libvtv
--disable-libgomp --disable-libstdcxx-pch --disable-libunwind-exceptions
CFLAGS=-O1  CXXFLAGS=-O1  --with-sysroot=/usr/x86_64-HEAD-linux-gnu
--without-zstd

But cc1plus still links to libzstd:

ldd ./gcc/cc1plus
        linux-vdso.so.1 (0x00007ffed53f0000)
        libmpc.so.3 => /usr/lib64/libmpc.so.3 (0x00007ff32f12a000)
        libmpfr.so.6 => /usr/lib64/libmpfr.so.6 (0x00007ff32f0a9000)
        libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007ff32f02f000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007ff32f029000)
        libzstd.so.1 => /usr/lib64/libzstd.so.1 (0x00007ff32ef95000)
        libm.so.6 => /lib64/libm.so.6 (0x00007ff32ee52000)
        libc.so.6 => /lib64/libc.so.6 (0x00007ff32ec7e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff32f1d4000)

Loks like it happens because library/header detection happens regardless of
user's setting in gcc/configure.ac:

https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/configure.ac;h=0d6230e0ca1bdd1f7de34ad452efac867351121a;hb=HEAD#l1316

1323 AC_ARG_WITH(zstd,
1324         [AS_HELP_STRING([--with-zstd=PATH],
1325                 [specify prefix directory for installed zstd library.
1326                  Equivalent to --with-zstd-include=PATH/include
1327                  plus --with-zstd-lib=PATH/lib])])
...
1374 # LTO can use zstd compression algorithm
1375 save_LIBS="$LIBS"
1376 LIBS=
1377 AC_SEARCH_LIBS(ZSTD_compress, zstd)
1378 ZSTD_LIB="$LIBS"
1379 LIBS="$save_LIBS"
1380 AC_SUBST(ZSTD_LIB)

It looks like headers/library detection happens regardless of
--with-zstd/--without-zstd flag being passed. I have zstd installed in /usr and
it always get picked up.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
@ 2020-03-22 11:25 ` slyfox at inbox dot ru
  2020-03-22 17:52 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: slyfox at inbox dot ru @ 2020-03-22 11:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

--- Comment #1 from Sergei Trofimovich <slyfox at inbox dot ru> ---
I also noticed a minor infelicity: if you pass just --with-zstd build system
will  do a few unexpected things:
- it will not fail of zstd is not present in system but will silently skip zstd
support
- it will use 'yes/include' and 'yes/lib' as paths to zstd. I think it's never
an expected location.


1334 case "x$with_zstd" in
1335   x) ;;
1336   xno)
1337     ZSTD_INCLUDE=no
1338     ZSTD_LIB=no
1339     ;;
1340   *) ZSTD_INCLUDE=$with_zstd/include
1341      ZSTD_LIB=$with_zstd/lib
1342      ;;
1343 esac

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
  2020-03-22 11:25 ` [Bug lto/94259] " slyfox at inbox dot ru
@ 2020-03-22 17:52 ` marxin at gcc dot gnu.org
  2020-03-23 15:53 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-22 17:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-03-22
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Mine.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
  2020-03-22 11:25 ` [Bug lto/94259] " slyfox at inbox dot ru
  2020-03-22 17:52 ` marxin at gcc dot gnu.org
@ 2020-03-23 15:53 ` marxin at gcc dot gnu.org
  2020-03-23 19:22 ` slyfox at inbox dot ru
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-23 15:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 48093
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48093&action=edit
Patch candidate

There's a patch candidate. Can you please test it?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
                   ` (2 preceding siblings ...)
  2020-03-23 15:53 ` marxin at gcc dot gnu.org
@ 2020-03-23 19:22 ` slyfox at inbox dot ru
  2020-03-24  6:35 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: slyfox at inbox dot ru @ 2020-03-23 19:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

--- Comment #4 from Sergei Trofimovich <slyfox at inbox dot ru> ---
(In reply to Martin Liška from comment #3)
> Created attachment 48093 [details]
> Patch candidate
> 
> There's a patch candidate. Can you please test it?

The following seems to inject 'no' library:

  $ ../gcc/configure --enable-languages=c,c++ --disable-bootstrap
--with-multilib-list=m64
--prefix=/home/slyfox/dev/git/gcc-native-quick/../gcc-native-quick-installed
--disable-nls --without-isl --disable-libsanitizer --disable-libvtv
--disable-libgomp --disable-libstdcxx-pch --disable-libunwind-exceptions
CFLAGS=-O1  CXXFLAGS=-O1  --with-sysroot=/usr/x86_64-HEAD-linux-gnu
--without-zstd

Build fails as:

g++ -no-pie   -O1  -DIN_GCC     -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -static-libstdc++
-static-libgcc  -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o
c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o
c/c-parser.o c/c-fold.o c/gimple-parser.o c-family/c-common.o
c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o
c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o
c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o
c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o
c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o
c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o i386-c.o
glibc-c.o \
  cc1-checksum.o libbackend.a main.o libcommon-target.a libcommon.a
../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a
../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a   -lmpc -lmpfr -lgmp
-rdynamic -ldl  -L./../zlib -lz no
g++: error: no: No such file or directory

Probably due to:

$ fgrep -i zstd gcc/config.log
ZSTD_INCLUDE='no'
ZSTD_LIB='no'

I guess these should be empty instead of 'yes' / 'no'.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
                   ` (3 preceding siblings ...)
  2020-03-23 19:22 ` slyfox at inbox dot ru
@ 2020-03-24  6:35 ` marxin at gcc dot gnu.org
  2020-03-24 13:25 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-24  6:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2020-March/5
                   |                            |42561.html
           Keywords|                            |patch

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
> 
> Probably due to:
> 
> $ fgrep -i zstd gcc/config.log
> ZSTD_INCLUDE='no'
> ZSTD_LIB='no'
> 
> I guess these should be empty instead of 'yes' / 'no'.

Ah yes, sorry.
I fixed that in sent patch:
https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542561.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
                   ` (4 preceding siblings ...)
  2020-03-24  6:35 ` marxin at gcc dot gnu.org
@ 2020-03-24 13:25 ` marxin at gcc dot gnu.org
  2020-03-25 10:02 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-24 13:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
                   ` (5 preceding siblings ...)
  2020-03-24 13:25 ` marxin at gcc dot gnu.org
@ 2020-03-25 10:02 ` cvs-commit at gcc dot gnu.org
  2020-03-25 10:04 ` marxin at gcc dot gnu.org
  2020-03-25 12:35 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-25 10:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:0fb0240a051df91d3c24385d1d3c17548b266544

commit r10-7371-g0fb0240a051df91d3c24385d1d3c17548b266544
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Mar 25 11:01:43 2020 +0100

    Fix handling of --with{,out}-zstd option.

            PR lto/94259
            * configure.ac: Respect --without-zstd and report
            error when we can't find header file with --with-zstd.
            * configure: Regenerate.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
                   ` (6 preceding siblings ...)
  2020-03-25 10:02 ` cvs-commit at gcc dot gnu.org
@ 2020-03-25 10:04 ` marxin at gcc dot gnu.org
  2020-03-25 12:35 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-25 10:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug lto/94259] --without-zstd seems to have no effect and links libzstd if available
  2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
                   ` (7 preceding siblings ...)
  2020-03-25 10:04 ` marxin at gcc dot gnu.org
@ 2020-03-25 12:35 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-25 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94259

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:68c4570a4dea8ed6fefaea50943fb74ea8f78319

commit r10-7375-g68c4570a4dea8ed6fefaea50943fb74ea8f78319
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Mar 25 13:34:53 2020 +0100

    Do not error about missing zstd unless --with-zstd.

            PR lto/94259
            * configure.ac: Report error only when --with-zstd
            is used.
            * configure: Regenerate.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-25 12:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-22 11:16 [Bug lto/94259] New: --without-zstd seems to have no effect and links libzstd if available slyfox at inbox dot ru
2020-03-22 11:25 ` [Bug lto/94259] " slyfox at inbox dot ru
2020-03-22 17:52 ` marxin at gcc dot gnu.org
2020-03-23 15:53 ` marxin at gcc dot gnu.org
2020-03-23 19:22 ` slyfox at inbox dot ru
2020-03-24  6:35 ` marxin at gcc dot gnu.org
2020-03-24 13:25 ` marxin at gcc dot gnu.org
2020-03-25 10:02 ` cvs-commit at gcc dot gnu.org
2020-03-25 10:04 ` marxin at gcc dot gnu.org
2020-03-25 12:35 ` cvs-commit at gcc dot gnu.org

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).