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

--- Comment #34 from Mark Millard <markmigm at gmail dot com> ---
(In reply to Mark Millard from comment #33)
> In build/gcc/config.log . . .
> 
> The 3 ./conftest that prev-gcc/xg++ produced where the ./conftest
> fails with:
> 
> ld-elf.so.1: Shared object "libstdc++.so.6" not found, required by "conftest"
> 
> are the only ones where the prev-gcc/xg++ command involved
> did not contain:
> 
> -static-libstdc++ -static-libgcc
> 
> All the ./conftest produced using -static-libstdc++ -static-libgcc
> did not have the problem when that ./conftest was executed.
> 
> So a 1-1 correspondance and it appears that the 3 should have
> -static-libstdc++ -static-libgcc (or something specifying
> an rpath for finding a libstdc++.so.6 ?).

That is, for work/gcc-16-20251130, the failure example that has
been in use . . .

By contrast for work/gcc-16-20251123 that builds just fine
without any lang/gcc* installed in the context:

All the executed ./conftest were built using -static-libstdc++
-static-libgcc on the prev-gcc/xg++ command line and they all
work, including the 3 where work/gcc-16-20251130 did not use:

-static-libstdc++ -static-libgcc

This matches up with Dimitry Andric's comment 14 that
noted the gcc/Makefile difference

-CXXFLAGS = -g -O2 -fchecking=1
-LDFLAGS = -static-libstdc++ -static-libgcc
+CXXFLAGS =
+LDFLAGS =

and his comment 12 about the saved_CXXFLAGS and saved_LDFLAGS.

In 20251130 has the gcc/config.log 'configure:10612: checking for times'
as the first to not match 20251123 . The prior ones match between the
two. The last two that have matching prev-gcc/xg++ commands are:

configure:10341: checking for library containing dlopen
configure:10404: checking for inttypes.h

After that they mismatch.

For reference:

configure:10341: checking for library containing dlopen
configure:10372: 
/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/./prev-gcc/xg++
-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/./prev-gcc/
-B/usr/local/x86_64-portbld-freebsd16.0/bin/ -nostdinc++

-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/src/.libs
-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3
/libsupc++/.libs  -isystem
/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/include/x86_64-portbld-freebsd16.0
 -isystem /wrkdirs/usr/ports/lang/gcc16-devel
/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/include  -isystem
/wrkdirs/usr/ports/lang/gcc16-devel/work/gcc-16-20251123/libstdc++-v3/libsupc++
-L/wrkdirs/usr/ports/lang/gcc16-devel/work/.
build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/src/.libs
-L/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/libsupc++/.libs
-o conftest -g -O2 -fcheckin
g=1 -DLIBICONV_PLUG -static-libstdc++ -static-libgcc  conftest.cpp  >&5
configure:10372: $? = 0
configure:10389: result: none required
configure:10404: checking for inttypes.h
configure:10425: 
/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/./prev-gcc/xg++
-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/./prev-gcc/
-B/usr/local/x86_64-portbld-freebsd16.0/bin/ -nostdinc++

-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/src/.libs
-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3
/libsupc++/.libs  -isystem
/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/include/x86_64-portbld-freebsd16.0
 -isystem /wrkdirs/usr/ports/lang/gcc16-devel
/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/include  -isystem
/wrkdirs/usr/ports/lang/gcc16-devel/work/gcc-16-20251123/libstdc++-v3/libsupc++
-L/wrkdirs/usr/ports/lang/gcc16-devel/work/.
build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/src/.libs
-L/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/libsupc++/.libs
-c -g -O2 -fchecking=1 -DLIB
ICONV_PLUG conftest.cpp >&5
configure:10425: $? = 0
configure:10433: result: yes
configure:10612: checking for times
configure:10612: 
/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/./prev-gcc/xg++
-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/./prev-gcc/
-B/usr/local/x86_64-portbld-freebsd16.0/bin/ -nostdinc++

-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/src/.libs
-B/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3
/libsupc++/.libs  -isystem
/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/include/x86_64-portbld-freebsd16.0
 -isystem /wrkdirs/usr/ports/lang/gcc16-devel
/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/include  -isystem
/wrkdirs/usr/ports/lang/gcc16-devel/work/gcc-16-20251123/libstdc++-v3/libsupc++
-L/wrkdirs/usr/ports/lang/gcc16-devel/work/.
build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/src/.libs
-L/wrkdirs/usr/ports/lang/gcc16-devel/work/.build/prev-x86_64-portbld-freebsd16.0/libstdc++-v3/libsupc++/.libs
-o conftest -g -O2 -fcheckin
g=1 -DLIBICONV_PLUG -static-libstdc++ -static-libgcc  conftest.cpp  >&5


The interesting point is that in the gcc/configure file there
is:

saved_CXXFLAGS="$CXXFLAGS"
saved_LDFLAGS="$LDFLAGS"

a ways inside an if..fi but its:

CXXFLAGS="$saved_CXXFLAGS"
LDFLAGS="$saved_LDFLAGS"

is after that if..fi instead of inside. It should be
inside.

Also zstd was not reported in the log: skipped by the
outer if. Thus saved_CXXFLAGS and saved_LDFLAGS were
not initialized.

All is all right before the code that does the times
activity.

For reference:

. . .
if test "x$with_zstd" != xno; then
if test "x$with_zstd_include" != x; then
  ZSTD_INCLUDE=$with_zstd_include
fi
if test "x$with_zstd_lib" != x; then
  ZSTD_LIB=$with_zstd_lib
fi
if test "x$ZSTD_INCLUDE" != x \
   && test "x$ZSTD_INCLUDE" != xno; then
  ZSTD_CPPFLAGS=-I$ZSTD_INCLUDE
fi
if test "x$ZSTD_LIB" != x \
   && test "x$ZSTD_LIB" != xno; then
  ZSTD_LDFLAGS=-L$ZSTD_LIB
fi

saved_CXXFLAGS="$CXXFLAGS"
saved_LDFLAGS="$LDFLAGS"
CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS"
LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"

 . . .

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_header_zstd_h" >&5
$as_echo "$gcc_cv_header_zstd_h" >&6; }
if test $gcc_cv_header_zstd_h = yes; then

$as_echo "#define HAVE_ZSTD_H 1" >>confdefs.h

elif test "x$with_zstd" != x; then
    as_fn_error $? "Unable to find zstd.h.  See config.log for details."
"$LINENO" 5
fi
fi

CXXFLAGS="$saved_CXXFLAGS"
LDFLAGS="$saved_LDFLAGS"


for ac_func in times clock kill getrlimit setrlimit atoq \
        popen sysconf strsignal getrusage nl_langinfo \
        gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
        clearerr_unlocked feof_unlocked   ferror_unlocked fflush_unlocked
fgetc_unlocked fgets_unlocked   fileno_unlocked fprintf_unlocked fputc_unlocked
fputs_unlocked   fread_unlocked fwrite_unlocke
d getchar_unlocked getc_unlocked   putchar_unlocked putc_unlocked madvise
mallinfo mallinfo2 fstatat getauxval \
        clock_gettime munmap msync get_current_dir_name memrchr
do :
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF

fi
done

Reply via email to