public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10601] libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602]
@ 2022-05-09 16:35 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-05-09 16:35 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:8da8ed881e7cdb2d4b070d685d6d3fe8d31529c2
commit r10-10601-g8da8ed881e7cdb2d4b070d685d6d3fe8d31529c2
Author: Jonathan Wakely <jwakely@redhat.com>
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 @@
</p><p>
Finally, a few system-specific requirements:
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">linux</span></dt><dd><p>
+ The 'gnu' locale model makes use of <code class="function">iconv</code>
+ 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 <code class="filename">/usr/local/include</code>)
+ then the <code class="filename">libstdc++.so.6</code> library will have a
+ run-time dependency on <code class="filename">libiconv.so.2</code>.
+ If you do not want that run-time dependency then you should do
+ one of the following:
+ </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
+ Uninstall the libiconv headers before building GCC.
+ Glibc already provides <code class="function">iconv</code> so you should
+ not need libiconv anyway.
+ </p></li><li class="listitem"><p>
+ <a class="link" href="../">
+ Download</a> the libiconv sources and extract them into the
+ top level of the GCC source tree, e.g.,
+ </p><pre class="programlisting">
+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
+</pre><p>
+ This will build libiconv as part of building GCC and link to
+ it statically, so there is no <code class="filename">libiconv.so.2</code>
+ dependency.
+ </p></li><li class="listitem"><p>
+ Configure GCC with <code class="option">--with-libiconv-type=static</code>.
+ This requires the static <code class="filename">libiconv.a</code> library,
+ which is not installed by default. You might need to reinstall
+ libiconv using the <code class="option">--enable-static</code> configure
+ option to get the static library.
+ </p></li></ul></div><p>
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 aa677647555..020027eb86d 100644
--- a/libstdc++-v3/doc/xml/manual/prerequisites.xml
+++ b/libstdc++-v3/doc/xml/manual/prerequisites.xml
@@ -48,6 +48,56 @@
<varlistentry>
<term>linux</term>
+ <listitem>
+ <para>
+ The 'gnu' locale model makes use of <function>iconv</function>
+ 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 <filename class="directory">/usr/local/include</filename>)
+ then the <filename>libstdc++.so.6</filename> library will have a
+ run-time dependency on <filename>libiconv.so.2</filename>.
+ If you do not want that run-time dependency then you should do
+ one of the following:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ Uninstall the libiconv headers before building GCC.
+ Glibc already provides <function>iconv</function> so you should
+ not need libiconv anyway.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <link linkend="https://www.gnu.org/software/libiconv/#downloading">
+ Download</link> the libiconv sources and extract them into the
+ top level of the GCC source tree, e.g.,
+ </para>
+<programlisting>
+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
+</programlisting>
+ <para>
+ This will build libiconv as part of building GCC and link to
+ it statically, so there is no <filename>libiconv.so.2</filename>
+ dependency.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Configure GCC with <option>--with-libiconv-type=static</option>.
+ This requires the static <filename>libiconv.a</filename> library,
+ which is not installed by default. You might need to reinstall
+ libiconv using the <option>--enable-static</option> configure
+ option to get the static library.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
<listitem>
<para>
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 a139adc81b3..9a97b88ce1f 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -222,7 +222,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 ea37a962a9a..8b9b8577a53 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -597,7 +597,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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-09 16:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 16:35 [gcc r10-10601] libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602] Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).