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.

Reply via email to