From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id 28CC0385840D for ; Tue, 8 Nov 2022 03:03:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 28CC0385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1035.google.com with SMTP id d13-20020a17090a3b0d00b00213519dfe4aso12193643pjc.2 for ; Mon, 07 Nov 2022 19:03:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9M1rJ2IBdxdgprX8Lf6ycWkQVhAYTToBp9d1IboVxlo=; b=qIyD6s0EOT9LXITdZI0hmsrF10rrG2lJ95I7X0nqPgIHmkhPWGuMuFgErla4E+rukN W6oSrixVSy0liTWvTF20tdxgYRGXffBo7PesRldnR7gE7UHGq+40Jx/CHYI+xQiHFPvo Ro4Dqo1FVhMecuJdxJLaHhG2zguMp/f2UxWTUs/N3suYJ5/TM0uTZhshqOFDAV5hWN2m DZMOI2btZkI6uh0CAWjWi1Df9yz04ALhO9TihXa5nsLzCIXAkoFfMU0NTia9fawwh+43 +7EmivPaKdO9BWbBUACc+DDg5pwc4n2FpXuLJcAOEeWEfsR5C9sxQ6iwnR02S1Q2Tw6/ AuAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9M1rJ2IBdxdgprX8Lf6ycWkQVhAYTToBp9d1IboVxlo=; b=zX5WQXWSRBsq8ix2I4HhO9QRhM9X6CEcVGmQoRFhmnM0EksxalmAH+BKPvCeFNvYGc jrCf3MNmkPPeiMfo9HxED0TXl0bsOGO9lFrroG2VVPG7mvzT3RxUstlW6l163zNvysXJ 486S5bnwtPz5T8fpE2ipiVsczDnPQgcO8y4eK9bldwfoF0+nzaUdSfDWAzfP4L6TeOi/ 4iCx/cyWfIL8ofTxiozZCUlvp1fdn80dY+R+YI+pSN9jyfnl6XhHCwE052kJuqUGiskd qDOUAmwpVw1EpQ3zKQK+VfiuO2ZTpv1UjCDsMtiCjkcVeUGMtG05yIPb9Caiw/fJkvVY rknw== X-Gm-Message-State: ACrzQf2hcOZLRDtXa7dbk/6nurzPKFFoV2wP/3a/YZy/zyn8ZFiPh33q Fqiw3IpVO7a7BvXEZj5owASjLHUyoUKIm6JR1Wc= X-Google-Smtp-Source: AMsMyM6a+5Gq9HzU2Kb0d4RhJsNxg3iTa8EUfUoinxnZyaHpZqcjhIygwu/BpzMvZwlfTLoXGcI+sQf/GLTr2T+FUhg= X-Received: by 2002:a17:902:6a86:b0:176:a6bc:54c0 with SMTP id n6-20020a1709026a8600b00176a6bc54c0mr55121072plk.87.1667876603061; Mon, 07 Nov 2022 19:03:23 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?5a2Z5LiW6b6Z?= Date: Tue, 8 Nov 2022 11:03:11 +0800 Message-ID: Subject: Re: Linking to dynamic libraries compiled by old version g++ To: Jonathan Wakely Cc: gcc-help Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Specifically, there were changes to std::chrono::system_clock, and >std::error_category, and std::condition_variable. >If those types are used in the old dynamic libraries, particularly >across the library API boundary, then you are likely to run into problems. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If the aforementioned types are only used in the implementation of the libr= ary which is compiled with 4.9.4 and the interface of the library is a C interface. If I understand you correctly, there is no potential problem if a binary pr= ogram is compiled with g++11.0.3 and is linked to the said library. Am I right? Best regards On Mon, Nov 7, 2022 at 9:02 PM Jonathan Wakely wrot= e: > > On Mon, 7 Nov 2022 at 02:11, =E5=AD=99=E4=B8=96=E9=BE=99 via Gcc-help wrote: > > > > There are dynamic libraries provided by others, which are out of my con= trol. > > > > What I know is that most of the aforementioned libraries are compiled > > by g++4.9.4 & g++4.8.4 with C++11 support, and some libraries are > > compiled by g++11.1.0 with C++14 support. > > > > And I have to use newer g++ which supports C++17 to compile my > > project. I intend to use g++11.3.0 on Ubuntu20.4. > > > > Is there any potential problem I should be aware of when linking to > > dynamic libraries compiled by the said old version g++ ? > > Yes, this is not supported. > > C++11 support in GCC 4.8 and 4.9 was experimental and unstable, and is > not ABI compatible with C++11 code compiled by GCC 5 or later. > > Specifically, there were changes to std::chrono::system_clock, and > std::error_category, and std::condition_variable. If those types are > used in the old dynamic libraries, particularly across the library API > boundary, then you are likely to run into problems. There are probably > other incompatibilities that I'm forgetting. I don't bother to > remember all the incompatibilities, because what you're trying to do > is not supported and so I don't spend any effort memorising all the > ways it can fail.