From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 07B2E3888C54; Thu, 21 Apr 2022 12:32:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 07B2E3888C54 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-9903] libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 498f9a85ebbb22a2d69860a8f26e76fa4f9c26ed X-Git-Newrev: 6758d51a8fcd6d7681e25967a207d44d41d3378e Message-Id: <20220421123243.07B2E3888C54@sourceware.org> Date: Thu, 21 Apr 2022 12:32:43 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2022 12:32:43 -0000 https://gcc.gnu.org/g:6758d51a8fcd6d7681e25967a207d44d41d3378e commit r11-9903-g6758d51a8fcd6d7681e25967a207d44d41d3378e Author: Jonathan Wakely Date: Wed Apr 13 14:09:33 2022 +0100 libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602] This fixes missing libiconv symbols when libstdc++ is built on a system that has libiconv installed. If the libiconv headers are found then libstdc++ depends on libiconv_open etc instead of libc's iconv_open. But without this fix libstdc++ is not linked to the libiconv library that provides the definitions of those symbols. As discussed in PR 93602 this changed means that libstdc++.so.6 might have an rpath pointing to the location of the libiconv.so library. If that is not desired, then GCC must be configured to link to a static libiconv.a instead, using either --with-libiconv-type=static or an in-tree build of libiconv. libstdc++-v3/ChangeLog: PR libstdc++/93602 * doc/xml/manual/prerequisites.xml: Document libiconv workarounds. * doc/html/manual/setup.html: Regenerate. * src/Makefile.am (CXXLINK): Add $(LTLIBICONV). * src/Makefile.in: Regenerate. (cherry picked from commit c644b7df11afc818d6308c3776813e50e4ebe551) Diff: --- libstdc++-v3/doc/html/manual/setup.html | 33 ++++++++++++++++++ libstdc++-v3/doc/xml/manual/prerequisites.xml | 50 +++++++++++++++++++++++++++ libstdc++-v3/src/Makefile.am | 4 ++- libstdc++-v3/src/Makefile.in | 4 ++- 4 files changed, 89 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/doc/html/manual/setup.html b/libstdc++-v3/doc/html/manual/setup.html index 636a4401602..069354b8ce0 100644 --- a/libstdc++-v3/doc/html/manual/setup.html +++ b/libstdc++-v3/doc/html/manual/setup.html @@ -42,6 +42,39 @@

Finally, a few system-specific requirements:

linux

+ The 'gnu' locale model makes use of iconv + for character set conversions. The relevant functions are provided + by Glibc and so are always available, however they can also be + provided by the separate GNU libiconv library. If GNU libiconv is + found when GCC is built (e.g., because its headers are installed + in /usr/local/include) + then the libstdc++.so.6 library will have a + run-time dependency on libiconv.so.2. + If you do not want that run-time dependency then you should do + one of the following: +

  • + Uninstall the libiconv headers before building GCC. + Glibc already provides iconv so you should + not need libiconv anyway. +

  • + + Download the libiconv sources and extract them into the + top level of the GCC source tree, e.g., +

    +wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
    +tar xf libiconv-1.16.tar.gz
    +ln -s libiconv-1.16 libiconv
    +

    + This will build libiconv as part of building GCC and link to + it statically, so there is no libiconv.so.2 + dependency. +

  • + Configure GCC with --with-libiconv-type=static. + This requires the static libiconv.a library, + which is not installed by default. You might need to reinstall + libiconv using the --enable-static configure + option to get the static library. +

If GCC 3.1.0 or later on is being used on GNU/Linux, an attempt will be made to use "C" library functionality necessary for C++ named locale support. For GCC 4.6.0 and later, this diff --git a/libstdc++-v3/doc/xml/manual/prerequisites.xml b/libstdc++-v3/doc/xml/manual/prerequisites.xml index 22e90a7e79d..8799487c821 100644 --- a/libstdc++-v3/doc/xml/manual/prerequisites.xml +++ b/libstdc++-v3/doc/xml/manual/prerequisites.xml @@ -48,6 +48,56 @@ linux + + + The 'gnu' locale model makes use of iconv + for character set conversions. The relevant functions are provided + by Glibc and so are always available, however they can also be + provided by the separate GNU libiconv library. If GNU libiconv is + found when GCC is built (e.g., because its headers are installed + in /usr/local/include) + then the libstdc++.so.6 library will have a + run-time dependency on libiconv.so.2. + If you do not want that run-time dependency then you should do + one of the following: + + + + + Uninstall the libiconv headers before building GCC. + Glibc already provides iconv so you should + not need libiconv anyway. + + + + + + Download the libiconv sources and extract them into the + top level of the GCC source tree, e.g., + + +wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz +tar xf libiconv-1.16.tar.gz +ln -s libiconv-1.16 libiconv + + + This will build libiconv as part of building GCC and link to + it statically, so there is no libiconv.so.2 + dependency. + + + + + Configure GCC with . + This requires the static libiconv.a library, + which is not installed by default. You might need to reinstall + libiconv using the configure + option to get the static library. + + + + + If GCC 3.1.0 or later on is being used on GNU/Linux, an attempt diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am index 16f4cc6eff4..f92a52748c5 100644 --- a/libstdc++-v3/src/Makefile.am +++ b/libstdc++-v3/src/Makefile.am @@ -267,7 +267,9 @@ CXXLINK = \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXX) \ $(VTV_CXXLINKFLAGS) \ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) \ + $(LTLDFLAGS) $(LTLIBICONV) \ + -o $@ # Symbol versioning for shared libraries. if ENABLE_SYMVERS diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in index 4df5c829a7f..2fff46209ad 100644 --- a/libstdc++-v3/src/Makefile.in +++ b/libstdc++-v3/src/Makefile.in @@ -631,7 +631,9 @@ CXXLINK = \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CXX) \ $(VTV_CXXLINKFLAGS) \ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@ + $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) \ + $(LTLDFLAGS) $(LTLIBICONV) \ + -o $@ @ENABLE_SYMVERS_TRUE@CLEANFILES = libstdc++-symbols.ver $(version_dep) @ENABLE_SYMVERS_DARWIN_TRUE@@ENABLE_SYMVERS_TRUE@version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist