From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by sourceware.org (Postfix) with ESMTPS id 671FF3858C53 for ; Thu, 7 Apr 2022 02:38:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 671FF3858C53 Received: by mail-lj1-x234.google.com with SMTP id b21so5667738ljf.11 for ; Wed, 06 Apr 2022 19:38:11 -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:from:date:message-id:subject:to; bh=L9LjUSckvC4p1epBh4Hm5r8hj9kAT0EMqHTQG/u3NCY=; b=0odV6QKzT7O0v99iunYQbefjAleTVj7FDCo66dcFsznWXvysg8u1vB64WWPrbDwR6Z NqDlQ1jopy2OeP2S0IvgjJQy2YLvK9DO6OfVk6XDLH72sXOGJ6GTG7EjfD5JvXOISX1Q k8StWFTCSy2qX9CZNOablQu9rONduBFAAEC7vp6ijwIw8UieE3oGCIK1mS4ziffCmkwD FvZBZfrWA6rI647DF26/O/QH90SeGQL+CS9w68zwYeCQqYoukyViFq+KWFAd9GsQOIDx qsu7yWxgJ2lcwf84G7YDTkUMiwLZhVFFGoFxvxKfFw0N/T7xxgoBmtuZ9N3wk+7oI03U cQAQ== X-Gm-Message-State: AOAM533id1NVziNT5Bhr+/Q2vZ9yMu60lwZNIH94xGSRf4IMaPKDCqyE 5a2cjunDU6hG/+Mw/6w5LaFvcsHX1seOLNjElllP+wXnow== X-Google-Smtp-Source: ABdhPJyfpx6Diwo7qQcaNrTYHxgMxTUUgIpY+rxqfM+zMSxg9xi2nIdLlrnB/UvhO9hfsJVJ9tdAtJG1NP7iJHA/zLo= X-Received: by 2002:a2e:9b4d:0:b0:244:da30:84c2 with SMTP id o13-20020a2e9b4d000000b00244da3084c2mr7422841ljj.359.1649299087687; Wed, 06 Apr 2022 19:38:07 -0700 (PDT) MIME-Version: 1.0 From: Yubin Ruan Date: Thu, 7 Apr 2022 10:37:57 +0800 Message-ID: Subject: 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.2 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:38:22 -0000 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