From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id 1C3533860004 for ; Thu, 7 Apr 2022 13:22:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1C3533860004 Received: by mail-lj1-x22c.google.com with SMTP id 17so7468948lji.1 for ; Thu, 07 Apr 2022 06:22:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=via5we0vsXNPpCjFWROyRe7W9ZBIJ5fSvhHAZDt9C0w=; b=qK4ed2Rdc7p/XVBb+PBk412uY/y2Z4p6O11nEkRamHEfBhIgDpD+677acFVMdNguMT X2JholnWEKMuGtyicgG0biONukhCzGxw2mcz92i2LHTr1vzqI+/rkqNkI+6q8BHjyixN tctSbvYrIrLudVnpDtU737QU48T2o/DEBk6VbklfquR2BLbzdJLcRtpVqT4aNK9+iz93 FBBYG+wzHiQbl0Hr0MiQfUAR9ZZJas09USncFjMdsngb+LivPT5/qUSr+o/QWasDcNeK OGkZDJcPQdEhbHgT+NQ72aONLiTmu+GEa/kcje8zezUFeMyBPmG8stxaq7iex+NkzoWv e75A== X-Gm-Message-State: AOAM532CPrTjXHyEPqFoIyDzneNbO1TIVgBI2GsZJ6IjwdUoMoqNl/iA jNazsN/NqdtFJe4ASzt75Vey7p4UwiM0V3YI73gjVPHhuA== X-Google-Smtp-Source: ABdhPJz4HEZb/z5e7+hYMUXmgiCwjYkDJq8M4dDx2zBqntpxp6q9raaYdDuX2jxR0Hxp1of4vWZZa+IPLN1oJ97LeYk= X-Received: by 2002:a2e:9b4d:0:b0:244:da30:84c2 with SMTP id o13-20020a2e9b4d000000b00244da3084c2mr8883928ljj.359.1649337724732; Thu, 07 Apr 2022 06:22:04 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yubin Ruan Date: Thu, 7 Apr 2022 21:21:53 +0800 Message-ID: Subject: Re: libstdc++.so.0.29 contains undefined reference to libiconv To: Jonathan Wakely Cc: "libstdc++" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2022 13:22:16 -0000 On Thu, Apr 7, 2022 at 5:03 PM Jonathan Wakely wrote: > > > > On Thu, 7 Apr 2022, 10:02 Jonathan Wakely, wrote: >> >> >> >> On Thu, 7 Apr 2022, 03:38 Yubin Ruan via Libstdc++, wrote: >>> >>> Hi, >>> >>> I compile GCC 11.2 and get a libstdc++.so.6.0.29 (installed in >>> "/usr/local/mygcc/lib64/") but this shared lib contains undefined >>> reference to libiconv_*. >>> >>> When I compile a hello world program using gcc11.2, I get the following error: >>> >>> > /usr/local/mygcc/bin/g++ -Wall -std=c++17 hw.cc -o hw >>> /usr/local/mygcc/bin/../lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libstdc++.so: >>> undefined reference to `libiconv' >>> /usr/local/mygcc/bin/../lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libstdc++.so: >>> undefined reference to `libiconv_close' >>> /usr/local/mygcc/bin/../lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib64/libstdc++.so: >>> undefined reference to `libiconv_open' >>> collect2: error: ld returned 1 exit status >>> >>> Adding a "-liconv" flag will help this program compile. >>> >>> From ldd's output, the libstdc++.so does not has any dynamic reference >>> to libiconv; >>> >>> > ldd /usr/local/mygcc/lib64/libstdc++.so.6.0.29 >>> linux-vdso.so.1 => (0x00007ffce1fea000) >>> libm.so.6 => /lib64/libm.so.6 (0x00007fefc74b8000) >>> libc.so.6 => /lib64/libc.so.6 (0x00007fefc70e9000) >>> /lib64/ld-linux-x86-64.so.2 (0x00007fefc7bd1000) >>> libgcc_s.so.1 => >>> /usr/local/$INSTALL_PREFX/lib64/libgcc_s.so.1 (0x00007fefc6ed1000) >>> >>> But from nm 's output, there are indeed undefined reference to libiconv* >>> >>> > nm -D /usr/local/mygcc/lib64/libstdc++.so.6.0.29 |grep -i iconv >>> U libiconv >>> U libiconv_close >>> U libiconv_open >>> >>> I already have libiconv installed under /usr/local when compiling >>> GCC11.2, but this does not seems to help; >> >> >> It doesn't help because that is the cause of the problem. >> >> Glibc defines the iconv routines that libstdc++ needs, and so you should not use libiconv on Linux systems using Glibc. > > > > There is an existing bug in bugzilla about this case. Can you provide the bugzilla URL ?