From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id D0DA33858D37 for ; Thu, 7 Apr 2022 09:03:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D0DA33858D37 Received: by mail-wr1-x42d.google.com with SMTP id z1so6848819wrg.4 for ; Thu, 07 Apr 2022 02:03:53 -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=HbKcAXxSM7rixdx44fTBCGSQmThtE35HYWrkESngU6o=; b=SmzkLmb1U+dEv/s0cukumDVsuYNxF5ZZ4Q6zJ/uPE4VO62NIAFB1dcaLsdvTRVsgdz y5HsijighRmfeTU1ho25VIwSXd08P9pqL4FEzdk6IKVKCSMWcL00bmvFJf+bLsEs2TQx 0g23tntLQK67MNvLXx86EsMhljhDgQbmtuJbXzgxNieke8Fz5oYobuJztiQLw3UBrHxc F6Xl0wXHfvurDGmwV5cFJ0ILwhwP5q4/TpAwHF3TDx8Y3AHNvohDvgTkNUymGTWZNS/a StqpMfopjOPX+oyXGeN3jzY2ZLwQf/T+Viv8YK/2ztTI9xs9a/ok2rG04gkrEdNxI1fo Uoag== X-Gm-Message-State: AOAM530YgtoOv6RVLc1pW8v0ytkL/ey91ri9blX5G51cI4BFy+Ddgx0+ UQyDgxvxeVUjp5du4LOx+o9ZRXa8GYMUan8+ofc= X-Google-Smtp-Source: ABdhPJx7swQDRpYVTu1ShfQw9buKbSj+Wp1slmAnjBpZy+1EzZZ0591OgK6ZUHKC6NvXhYnuNQ5jE834AJcAel/Vw1M= X-Received: by 2002:a5d:5482:0:b0:206:b5c:ef4d with SMTP id h2-20020a5d5482000000b002060b5cef4dmr9742527wrv.152.1649322232506; Thu, 07 Apr 2022 02:03:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Thu, 7 Apr 2022 10:03:40 +0100 Message-ID: Subject: Re: libstdc++.so.0.29 contains undefined reference to libiconv To: Yubin Ruan Cc: "libstdc++" X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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 09:04:04 -0000 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. > > > And by the way, libiconv seems to only provide dynamic lib; there is >> no libiconv.a; >> >> >> Previously I have GCC10.2 compiled & installed. The libstdc++.so.0.28 >> also contains undefined ref to libiconv* >> >> > nm -D /usr/local/mygcc/lib64/libstdc++.so.6.0.28 |grep -i iconv >> U libiconv >> U libiconv_close >> U libiconv_open >> >> but compiling with libstdc++.so.6.0.28 does NOT require "-liconv". >> >> So, is there anything that I missed when compiling GCC11.2 which can >> remove unnecessary dependency of libiconv ? >> >> Thanks, >> Yubin >> >