From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by sourceware.org (Postfix) with ESMTPS id 6B98F38515C4 for ; Thu, 20 Oct 2022 10:34:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6B98F38515C4 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-ej1-x636.google.com with SMTP id w18so46292651ejq.11 for ; Thu, 20 Oct 2022 03:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=XLhUlGu2G+DeUHceEaKRHzEQeguH2xAyXrSLF+89w4g=; b=MGGcSDTgf+7G5bSziW1NsnbWAX2VFvDi9NIZLBUrkYj5zVqQ5LvD3QLDBbBJwBkOWT HxiFmuqhItb7/e2nQznIArPAmEcOjvWLCFHSywmlvc29FwOxauL3v6NK8StMnJFsrm7P I+EWYovlNiArhYsRWgCW2YStKvBgs+jn/cgae+459rY5h4NPGYqRHLtt0P4eSFM0ylkN nTCXSthO6u49EQR/c8ytoc6BKQoHgDjp/jJsZySCXhvXeIF+9nS7pR7ilbXCivW7Vm+C X3di34+MJNwKUTGQUt0ZaRM+bQ2xFpUAxl/XZNfRaJVyc7nqWlXcst7fz2+vf3vZceI/ LtOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XLhUlGu2G+DeUHceEaKRHzEQeguH2xAyXrSLF+89w4g=; b=OeEYXJzGIeOXrq9XrUnRlORIs4GOZrHjML/wy5KISzxz7kZwidVbdm/YKWnnvck3EF elKlEYhhCa4Ql55+Uc8L1B4/8Frjz9ngkPR/CowQhXDWFSRSLE4+nGZUBOMFw7yE7VVB JbMlqWUDUI4OLvgY2i7a44cwad11JumFDtiGs01km8ckM1y2DfROFFekYFJnxhRhz6FZ hIPJlhoq4osvG2JeBTArKsHwlaz0/o/uB0s94ACRs3/kqu+g/pxILi4afKGGyW1/rNGR 7Ej6MC+KZ5jWHobG8k/qbfgjL5Q78qs5lpByjd5it0a7nudUAvjU4IXV5VHQCeitZmhE RpHA== X-Gm-Message-State: ACrzQf3wuUtWjQqMiSRwxNuRmcYtHAVtG2BbOYDBPgX42VDS7iVysW0J P/iutMxzfWcZmEQrFjdnOeWZzNGc1qinUg4mAd43J+4U3og= X-Google-Smtp-Source: AMsMyM4SWNxTcvt5qLPEgfaL78oW7+IGx1u+ra8svT76kILzPOK1I6SB5UFEhtYO8bkhV4ik6jkKF425hnh3HhJLOIM= X-Received: by 2002:a17:907:a4c:b0:77b:ba98:d3e with SMTP id be12-20020a1709070a4c00b0077bba980d3emr10432283ejc.13.1666262044509; Thu, 20 Oct 2022 03:34:04 -0700 (PDT) MIME-Version: 1.0 From: olologin Date: Thu, 20 Oct 2022 13:33:53 +0300 Message-ID: Subject: How to make sure GCC links only with old runtime that is supplied with the system To: gcc-help@gcc.gnu.org Content-Type: multipart/alternative; boundary="00000000000044313a05eb74ddea" X-Spam-Status: No, score=-0.4 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --00000000000044313a05eb74ddea Content-Type: text/plain; charset="UTF-8" Hi everyone, I am kind of new to cross-compiling (if we can call my task like this), so maybe my question is kind of stupid. I need to build my project for old runtimes (libstdc++, libgcc_s, etc) that came with GCC 6, but I can build my sourcecode only with newest C++ features, so I chose GCC 12 for this. Of course my API is old enough to support GCC 6. And of course I am aware of potential risks (like some implementations that can be missing in the old runtime). Currently I am doing this in a very hacky way, and build my project in a container that looks like this: https://gist.github.com/olologin/b4ba2db91fc5c526d625715b39ac4579 As you can see, starting from line 73 it gets hacky because I could not find a better way to make sure GCC 12 links my code with GCC 6 runtime instead of GCC 12. So I decided that I should just get rid of all *.so, *.a and *.o files in GCC12 install directory, and later when I build my project I point GCC12 on GCC6 runtime with -Wl,-L. Is there a better way to do this? Maybe I am missing something. Thanks in advance. --00000000000044313a05eb74ddea--