https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123326
--- Comment #7 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #6)
> Couldn't reproduce even with
> ../configure --prefix=$HOME/work/15 --enable-languages=c,c++,fortran,lto
> --enable-bootstrap --disable-nls --disable-libssp --disable-multilib
> --without-libintl
> on the same host.
Thanks for looking into this. AFAICT, the freshly built stage1
compiler is not passing -L/usr/local/lib down to ld. I'm seeing
(with only the first error, some lines wrapped, and
PATH = /home/kargl/gcc/obj/prev-x86_64-unknown-freebsd16.0)
gmake[3]: Entering directory '/home/kargl/gcc/obj/gcc'
/home/kargl/gcc/obj/./prev-gcc/xg++ -B/home/kargl/gcc/obj/./prev-gcc/
-B/home/kargl/work/x/x86_64-unknown-freebsd16.0/bin/ -nostdinc++
-B${PATH}/libstdc++-v3/src/.libs -B${PATH}/libstdc++-v3/libsupc++/.libs
-I${PATH}/libstdc++-v3/include/x86_64-unknown-freebsd16.0
-I${PATH}/libstdc++-v3/include -I/home/kargl/gcc/gcc/libstdc++-v3/libsupc++
-L${PATH}/libstdc++-v3/src/.libs
-L${PATH}/libstdc++-v3/libsupc++/.libs
-g -O2 -fno-checking -gtoggle -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-error=narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Wconditionally-supported
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Werror -DHAVE_CONFIG_H -DGENERATOR_FILE
-static-libstdc++ -static-libgcc
-o build/genpreds \
build/genpreds.o build/rtl.o build/read-rtl.o build/ggc-none.o \
build/vec.o build/min-insn-modes.o build/gensupport.o \
build/print-rtl.o build/hash-table.o build/sort.o build/read-md.o \
build/errors.o .././libiberty/libiberty.a
/usr/local/bin/ld: ${PATH}/libstdc++-v3/src/.libs/libstdc++.a(format.o):
in function `std::__format::(anonymous namespace)::__encoding::~__encoding()
':
${PATH}/libstdc++-v3/src/c++20/../../../../../gcc/libstdc++-v3/src/c++20/\
format.cc:88:(.text._ZNSt8__format12_GLOBAL__N_110__encodingD2Ev+0x21):
undefined reference to `libiconv_close'
I would expect the +xg++ command line to have -L/usr/local/lib -liconv.
And, for the record, I have no idea why your patch is exposing the issue.