public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/93602] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
@ 2020-09-27 21:27 ` zvr+gcc at zvr dot gr
  2020-12-07 12:44 ` [Bug libstdc++/93602] [9/10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: zvr+gcc at zvr dot gr @ 2020-09-27 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

Alexios Zavras (zvr) <zvr+gcc at zvr dot gr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zvr+gcc at zvr dot gr

--- Comment #14 from Alexios Zavras (zvr) <zvr+gcc at zvr dot gr> ---
I can confirm this bug also in gcc-9.3.0, gcc-10.1.0 and gcc-10.2.0.

To recap: if the system has a libiconv installed, the generated and installed
libstdc++.so depends on it.

However the compiler, when using it when compiling a C++ program, does not link
libiconv, resulting in an error:

$ g++ foo.cc
/usr/local/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
/usr/local/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libstdc++.so:
undefined reference to `libiconv'
/usr/local/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
/usr/local/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libstdc++.so:
undefined reference to `libiconv_close'
/usr/local/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
/usr/local/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib64/libstdc++.so:
undefined reference to `libiconv_open'
collect2: error: ld returned 1 exit status

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10/11 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
  2020-09-27 21:27 ` [Bug libstdc++/93602] Missing reference to libiconv in 9.x libstdc++ zvr+gcc at zvr dot gr
@ 2020-12-07 12:44 ` rguenth at gcc dot gnu.org
  2021-06-01  8:16 ` [Bug libstdc++/93602] [9/10/11/12 " rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-12-07 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10/11/12 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
  2020-09-27 21:27 ` [Bug libstdc++/93602] Missing reference to libiconv in 9.x libstdc++ zvr+gcc at zvr dot gr
  2020-12-07 12:44 ` [Bug libstdc++/93602] [9/10/11 Regression] " rguenth at gcc dot gnu.org
@ 2021-06-01  8:16 ` rguenth at gcc dot gnu.org
  2022-04-12 20:36 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10/11/12 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-06-01  8:16 ` [Bug libstdc++/93602] [9/10/11/12 " rguenth at gcc dot gnu.org
@ 2022-04-12 20:36 ` redi at gcc dot gnu.org
  2022-04-13 10:55 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-04-12 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|2020-02-05 00:00:00         |2022-04-12
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think we need to use LTLIBICONV when linking libstdc++.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10/11/12 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-04-12 20:36 ` redi at gcc dot gnu.org
@ 2022-04-13 10:55 ` redi at gcc dot gnu.org
  2022-04-13 14:37 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-04-13 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I confirmed that --without-libiconv-prefix doesn't work. With GNU libiconv
installed as /usr/local/lib/libiconv.so.2 it breaks the compiler:

/gccobj/./gcc/xgcc -B/gccobj/./gcc/ -dumpspecs > tmp-specs
/gccobj/./gcc/xgcc: error while loading shared libraries: libiconv.so.2: cannot
open shared object file: No such file or directory


(In reply to Jonathan Wakely from comment #16)
> I think we need to use LTLIBICONV when linking libstdc++.

But that adds the libiconv libdir to libstdc++.so.6's RPATH, which can result
in user applications picking up unwanted version of other libraries.

Simply adding -liconv isn't a solution either, because that might create a
runtime dependency on a libiconv.so that isn't in the ldconfig search paths,
and so won't be found at run-time. That just moves the problem from link-time
to run-time.

I tried configuring libiconv with --enable-static (which is disabled by
default) and configuring GCC with --with-libiconv-type=static which cause
LTLIBICONV=/usr/local/lib/libiconv.a to be defined by libstdc++'s configure.
But that still fails, because libstdc++-v3/src/Makefile doesn't use LTLIBICONV,
so we still don't link libstdc++.so to it. 

A better solution is to add the libiconv sources to the GCC source tree, so
that it is built in-tree. If the libiconv sources are in a dir called
"libiconv" at the top level of the GCC source tree then a static libiconv.a
will be built as part of the GCC build. But we still don't link libstdc++.so to
it without using LTLIBICONV.

So although I'm reluctant to add LTLIBICONV to the libstdc++ build, because of
the rpath effects, I think we need to do it. Users who don't want those rpath
effects can link to an out-of-tree libiconv.a or build and use an in-tree
libiconv.a

Of course the best approach is just to not install libiconv on glibc systems at
all, because it's unnecessary.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10/11/12 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-04-13 10:55 ` redi at gcc dot gnu.org
@ 2022-04-13 14:37 ` redi at gcc dot gnu.org
  2022-04-20 12:55 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-04-13 14:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #18 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Patch posted: https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593191.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10/11/12 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-04-13 14:37 ` redi at gcc dot gnu.org
@ 2022-04-20 12:55 ` cvs-commit at gcc dot gnu.org
  2022-04-20 12:57 ` [Bug libstdc++/93602] [9/10/11 " redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-20 12:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:c644b7df11afc818d6308c3776813e50e4ebe551

commit r12-8206-gc644b7df11afc818d6308c3776813e50e4ebe551
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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10/11 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-04-20 12:55 ` cvs-commit at gcc dot gnu.org
@ 2022-04-20 12:57 ` redi at gcc dot gnu.org
  2022-04-21 12:32 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-04-20 12:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11/12 Regression]     |[9/10/11 Regression]
                   |Missing reference to        |Missing reference to
                   |libiconv in 9.x libstdc++   |libiconv in 9.x libstdc++

--- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk so far.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10/11 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-04-20 12:57 ` [Bug libstdc++/93602] [9/10/11 " redi at gcc dot gnu.org
@ 2022-04-21 12:32 ` cvs-commit at gcc dot gnu.org
  2022-04-21 12:37 ` [Bug libstdc++/93602] [9/10 " redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-21 12:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:6758d51a8fcd6d7681e25967a207d44d41d3378e

commit r11-9903-g6758d51a8fcd6d7681e25967a207d44d41d3378e
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)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2022-04-21 12:32 ` cvs-commit at gcc dot gnu.org
@ 2022-04-21 12:37 ` redi at gcc dot gnu.org
  2022-05-09 16:35 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-04-21 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11 Regression]        |[9/10 Regression] Missing
                   |Missing reference to        |reference to libiconv in
                   |libiconv in 9.x libstdc++   |9.x libstdc++
      Known to work|                            |11.3.1, 12.0
      Known to fail|                            |10.3.0, 11.3.0

--- Comment #22 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 11.4 too.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2022-04-21 12:37 ` [Bug libstdc++/93602] [9/10 " redi at gcc dot gnu.org
@ 2022-05-09 16:35 ` cvs-commit at gcc dot gnu.org
  2022-05-09 16:45 ` redi at gcc dot gnu.org
  2022-05-27  8:42 ` [Bug libstdc++/93602] [9 " rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-09 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

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)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9/10 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2022-05-09 16:35 ` cvs-commit at gcc dot gnu.org
@ 2022-05-09 16:45 ` redi at gcc dot gnu.org
  2022-05-27  8:42 ` [Bug libstdc++/93602] [9 " rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2022-05-09 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 10.4 too.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug libstdc++/93602] [9 Regression] Missing reference to libiconv in 9.x libstdc++
       [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2022-05-09 16:45 ` redi at gcc dot gnu.org
@ 2022-05-27  8:42 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|9.5                         |10.4
      Known to fail|                            |9.5.0
             Status|ASSIGNED                    |RESOLVED

--- Comment #25 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for GCC 10.4.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-05-27  8:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93602-4@http.gcc.gnu.org/bugzilla/>
2020-09-27 21:27 ` [Bug libstdc++/93602] Missing reference to libiconv in 9.x libstdc++ zvr+gcc at zvr dot gr
2020-12-07 12:44 ` [Bug libstdc++/93602] [9/10/11 Regression] " rguenth at gcc dot gnu.org
2021-06-01  8:16 ` [Bug libstdc++/93602] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-04-12 20:36 ` redi at gcc dot gnu.org
2022-04-13 10:55 ` redi at gcc dot gnu.org
2022-04-13 14:37 ` redi at gcc dot gnu.org
2022-04-20 12:55 ` cvs-commit at gcc dot gnu.org
2022-04-20 12:57 ` [Bug libstdc++/93602] [9/10/11 " redi at gcc dot gnu.org
2022-04-21 12:32 ` cvs-commit at gcc dot gnu.org
2022-04-21 12:37 ` [Bug libstdc++/93602] [9/10 " redi at gcc dot gnu.org
2022-05-09 16:35 ` cvs-commit at gcc dot gnu.org
2022-05-09 16:45 ` redi at gcc dot gnu.org
2022-05-27  8:42 ` [Bug libstdc++/93602] [9 " rguenth at gcc dot gnu.org

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).