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

            Bug ID: 93602
           Summary: Missing reference to libiconv
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ilg at livius dot net
  Target Milestone: ---

I'm building GCC 9.2 on an older Ubuntu and the build is eventless, but the
resulting libstdc++ refers to some libiconv symbols, without listing a
reference to the library.

$ readelf -s /home/ilg/opt/xbb-amd64/lib64/libstdc++.so | grep iconv
    49: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND libiconv
    82: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND libiconv_close
    97: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND libiconv_open

$ ldd /home/ilg/opt/xbb-amd64/lib64/libstdc++.so
        linux-vdso.so.1 (0x00007ffe18f6c000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efc07942000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efc07551000)
        /lib64/ld-linux-x86-64.so.2 (0x00007efc07ce0000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007efc07339000)

The effect is that building C++ applications is possible only with an explicit
'-liconv' passed to the linker, which is not ok.

GCC 7.x and 8.x are fine, with the same build procedure the libstdc++ shared
library has no undefined references to libiconv.


To be noted that on a newer system (a Manjaro) where 9.2 is installed,
something similar happens:

$ readelf -s /usr/lib/libstdc++.so | grep iconv
    24: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND
iconv_open@GLIBC_2.17 (44)
   125: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND
iconv_close@GLIBC_2.17 (44)
   174: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND iconv@GLIBC_2.17
(44)
  9033: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND
iconv_open@@GLIBC_2.17
 12636: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND
iconv_close@@GLIBC_2.17
 14045: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND iconv@@GLIBC_2.17

$ ldd /usr/lib/libstdc++.so
        linux-vdso.so.1 (0x0000007fbf4da000)
        libm.so.6 => /usr/lib/libm.so.6 (0x0000007fbf1d6000)
        libc.so.6 => /usr/lib/libc.so.6 (0x0000007fbf069000)
        /usr/lib/ld-linux-aarch64.so.1 (0x0000007fbf4ac000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x0000007fbf045000)


It seems that in 9.x the build procedure expects the libiconv functionality to
be provided by one of the other system libraries.

Not to mention that in my build the referred name is 'libiconv_open', while in
the official system it is 'iconv_open'.

Reply via email to