Even with PR c++/98315 hacked around, Solaris 11.3 (only) bootstrap is still broken: Undefined first referenced symbol in file __xnet_connect ../libcody/libcody.a(netclient.o) __xnet_socket ../libcody/libcody.a(netclient.o) __xnet_getaddrinfo ../libcody/libcody.a(netclient.o) freeaddrinfo ../libcody/libcody.a(netclient.o) gai_strerror ../libcody/libcody.a(netclient.o) ld: fatal: symbol referencing errors collect2: error: ld returned 1 exit status make[3]: *** [/vol/gcc/src/hg/master/local/gcc/cp/Make-lang.in:136: cc1plus] Error 1 Before Solaris 11.4 folded libsocket and libnsl into libc, one needed to link with both for the socket functions. The same issue exists with the other use of $(LIBCODY) in c++tools/Makefile.in. We already have 4 instances of the libsocket/libnsl check in the tree: gotools/configure.ac libcc1/configure.ac libgo/configure.ac libphobos/m4/druntime/libraries.m4 Instead of adding yet two others, we could make use of the autoconf-archive's m4/ax_lib_socket_nsl.m4 (AX_LIB_SOCKET_NSL).
Besides, currently libcody.a (and, once this PR is fixed, libsocket and libnsl) are linked into every backend instead of just into cc1plus. I believe this should change, just like f951 is the only user of $(ZLIB) (and $(ZLIBINC)).
Created attachment 49778 [details] Initial patch The attach has only been lightly tested so far: it allowed cc1plus to link on Solaris 11.3, bootstrap still running.
Looks good, and separating out cc1plus' libraries from other executables is goodness. do you want to take this bug?
That's easiest, I guess. With one minor addition (gcc/objcp/Make-lang.in needs the same treatment), the Solaris 11.3 build completed successfully; make check still running. I'll try the patch on Solaris 11.4 and Linux/x86_64 tonight, then post it.
Final patch posted.
The master branch has been updated by Rainer Orth <ro@gcc.gnu.org>: https://gcc.gnu.org/g:a20893cf6b95f60f5319b2196621acc65180125c commit r11-6457-ga20893cf6b95f60f5319b2196621acc65180125c Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> Date: Tue Jan 5 11:32:31 2021 +0100 build: libcody: Link with -lsocket -lnsl if necessary [PR98316] With the introduction of C++20 modules and libcody, cc1plus and cc1objplus gained a dependency on the socket functions. Before those were merged into libc in Solaris 11.4, one needed to link with -lsocket -lnsl on Solaris, so that merge broke the Solaris 11.3 build. While we already have 4 different checks for those libraries in the tree, I decided to import autoconf-archive's AX_LIB_SOCKET_NSL macro instead. At the same time, the patch only links libcody and the networking libs where needed (cc1plus, cc1objplus). Bootstrapped without regressions on i386-pc-solaris2.11 (Solaris 11.3 and 11.4), sparc-sun-solaris2.11, and x86_64-pc-linux-gnu. 2020-12-16 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> c++tools: PR c++/98316 * configure.ac: Include ../config/ax_lib_socket_nsl.m4. (NETLIBS): Determine using AX_LIB_SOCKET_NSL. * configure: Regenerate. * Makefile.in (NETLIBS): Define. (g++-mapper-server$(exeext)): Add $(NETLIBS). gcc/objcp: PR c++/98316 * Make-lang.in (cc1objplus$(exeext)): Add $(CODYLIB), $(NETLIBS). gcc/cp: PR c++/98316 * Make-lang.in (cc1plus$(exeext)): Add $(CODYLIB), $(NETLIBS). gcc: PR c++/98316 * configure.ac (NETLIBS): Determine using AX_LIB_SOCKET_NSL. * aclocal.m4, configure: Regenerate. * Makefile.in (NETLIBS): Define. (BACKEND): Remove $(CODYLIB). config: PR c++/98316 * ax_lib_socket_nsl.m4: Import from autoconf-archive.
Fixed for GCC 11.
thanks Rainer!