From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id 32EDA3858C53 for ; Thu, 7 Apr 2022 02:42:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 32EDA3858C53 Received: by mail-lf1-x134.google.com with SMTP id z12so7256464lfu.10 for ; Wed, 06 Apr 2022 19:42:57 -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; bh=M5IsY39+OTYndfChNiMRX00Fe3P0nLl8zPK+SrlOwxw=; b=bV+EcEtjqDmjgvpsGhRlYNRdRP16X540ClzxoIQsdpolU4bBvfXvYeE40onVqF7csw 9SwPc6kzvn0DUQa23fT938ZrUTnRKgXJu4zIfSyzxpJfxT9hgsyX1Y5QzFn5cRfzo6Rd RZfQxWkET2SK/VBoYbjoOtP9kzN5/qK199AzblL9ieUCZ8OSSUgFrB4RJxAWUqsCO7wH r6jL7NCx507wERhAJrwbAx1GXI6pT0ZJr3Rwaco74w1RUMfyF4uTW95Z4zZghb9/4uVv wKUlDkxsRP1mRJU5qNTtY4r21s+Cyy07U13DjP+yq3I0z4EY5VXfZ0wKccwQfL4CR/Or OCdA== X-Gm-Message-State: AOAM5334GvElYPcQuHE3xMQO1nkehc8AGZhAqi0k+mopilP35GpzuBP9 w76JlZy3UCy+c5wzxien2dgT+NIqI069mO5F8ZRK/bu6Lw== X-Google-Smtp-Source: ABdhPJyYMUAYFZovcXo1Mj8ZiXKs/L4djIZvh38wi52JOFOigaGKglsdZWaqwkiLvy/NgwElWXibM3/u4492Q4kNRXg= X-Received: by 2002:a05:6512:a8c:b0:44a:1dd:4cd8 with SMTP id m12-20020a0565120a8c00b0044a01dd4cd8mr7769112lfu.297.1649299375587; Wed, 06 Apr 2022 19:42:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yubin Ruan Date: Thu, 7 Apr 2022 10:42:45 +0800 Message-ID: Subject: Re: libstdc++.so.0.29 contains undefined reference to libiconv To: libstdc++@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=0.3 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 02:43:07 -0000 FYI, I compile GCC11.2 with > ../src/gcc-%{VERSION}/configure --enable-languages=c,c++ --disable-multilib --prefix=/usr/local/mygcc on a CentOS7.2 with intel x64 On Thu, Apr 7, 2022 at 10:37 AM Yubin Ruan 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; > 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