From patchwork Sat Sep 21 16:32:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 31322 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B288727BBE9; Sat, 21 Sep 2024 17:37:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id ADE9827BBE2 for ; Sat, 21 Sep 2024 17:37:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ss36C-0007i1-Mn; Sat, 21 Sep 2024 12:36:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ss36A-0007hC-Ic for guix-patches@gnu.org; Sat, 21 Sep 2024 12:36:42 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ss36A-0003g8-9u for guix-patches@gnu.org; Sat, 21 Sep 2024 12:36:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=icUeS+POsGuRgzdRy4jjayyO0WwltzkucsCmAFrZxX8=; b=MV+TsLc0Y2msGuNiLs/OzJYSEjRqLiubqVkKYtP8rT4+PnPboiwVF+0ZKZsae6mtZjI0Ln+ZTLqch7rOdg2Yi9nPl7qNcuOca5QDvBoxuvresiAmSSd6ChYYJz3ueeNMMWX5vus8s0+6bufZnicwHVPjxAnU8zKRr5EBST9kS1dln8iJJrWL/xaZMi8CUzpy/oN7RyTRMi3Q9gRFKEmILAbPnb5J3lyiuwPXgKTiJwHqdKLR9Vxot44JblxByv9BhHNk/jayihXYq9vUn5gRI3Eh0CSNQ603t7/MpnTDcCTIWZ3TZ/3NWruNzyQAmGa5NGaFe+3OorHkUqZxuOIgwA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ss36U-0001zM-EB for guix-patches@gnu.org; Sat, 21 Sep 2024 12:37:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73413] [PATCH 1/3] gnu: cling: Wrap with GCC include paths. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 21 Sep 2024 16:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73413 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73413@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 73413-submit@debbugs.gnu.org id=B73413.17269365977583 (code B ref 73413); Sat, 21 Sep 2024 16:37:02 +0000 Received: (at 73413) by debbugs.gnu.org; 21 Sep 2024 16:36:37 +0000 Received: from localhost ([127.0.0.1]:40259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ss364-0001yC-QS for submit@debbugs.gnu.org; Sat, 21 Sep 2024 12:36:37 -0400 Received: from mail-pj1-f54.google.com ([209.85.216.54]:50515) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ss362-0001xs-As for 73413@debbugs.gnu.org; Sat, 21 Sep 2024 12:36:35 -0400 Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2d88edf1340so2180824a91.1 for <73413@debbugs.gnu.org>; Sat, 21 Sep 2024 09:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726936507; x=1727541307; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=icUeS+POsGuRgzdRy4jjayyO0WwltzkucsCmAFrZxX8=; b=UOWdn3TeCHfPq+HUzSqbm9qbX3tsbtMM9RPUl9Z36/FvP8K6OAKaoVroYhjVENUjG0 ViYCVigqDw6MlLXtGcN3UV5gUEImLSx1mVTkon2++10tPOYf0eSmvzsVcRlP/Ut4JBtG anKcTLVKe4INHtxial6diGRmjCyJ4Id7JuwcXGpkzbnXTfN87cRcbq9aIn8tqqnDalyb cH3h0eAKDRJ3Wqqm5kL6xdLlbXU62VPGyQ1psxydgGFD1T4sHzbwyXRFAd5jwfwtdbUl LdF4gAT8MhowcKQl6zmzUOPRluHBmvT9EWSRS6yboSdpvGQ2R63x1uUXsbCGedl2c7bK Fq7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726936507; x=1727541307; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=icUeS+POsGuRgzdRy4jjayyO0WwltzkucsCmAFrZxX8=; b=C51jOGNj6A5E/SdGOvmrD0l3ASXWhkZDIH/l8cVBbRpmdpwZRSkbyHm6ONfc4Mrr0W 0WzP8jKIOsZ6DJZzGD/8G3jgc4k/yX1xD72sTbn0hsemGwNtqP7C70n1kymYwWLpf4Gb +PD6A7iFTWsu5Ba6X3jfWySBfGqfNdv4aZ3Hl+zP5YyB7IbRDd5Vk7AJzR5Tjj5yu5VK ViJFuQY6NNk3YY1tvQpJ5dS6e0bEL/W/7sEbnfGZfhNgkb7RQtZvsXatUa4dfdVTOPwB CQBFu+3jxFMXNoQEKCJiLXinVHid6eTEPoPgvKGNpc5Kp6z6V0eW3HOJzoUvDNMpawjm o/cw== X-Gm-Message-State: AOJu0YzL8c3I3EJV1pPofnmBEreVO89GFnT/wgvf04+fv4sO8Pvf19iD AVbDgMm7Se9F4cXO7nBGkM/GiPor+4X2sw9BtPCLPKFC7lQcOr1lnmauQg== X-Google-Smtp-Source: AGHT+IEUfeXFW15KBL2T2z9K87AkFfmbp/doP8V1pjLbJPa7S+mw2uMqtFG7UvPH5s2vnj4uWggE/Q== X-Received: by 2002:a17:90b:1344:b0:2d8:ad96:6ef4 with SMTP id 98e67ed59e1d1-2dd7f708a20mr9173228a91.28.1726936506864; Sat, 21 Sep 2024 09:35:06 -0700 (PDT) Received: from hurd.lan ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2dd6ef3c64fsm6235289a91.38.2024.09.21.09.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Sep 2024 09:35:06 -0700 (PDT) From: Maxim Cournoyer Date: Sun, 22 Sep 2024 01:32:25 +0900 Message-ID: <49c179bdd2979a38122e7f06464557d69857eab8.1726935737.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches (cling) [phases] : Do not patch CLING_CXX_RLTV anymore; this is now handled more correctly by wrapping the 'cling' executable. Adjust file name of clang lib directory. : New phases. [inputs]: Add gcc-toolchain*, a delayed version of gcc-toolchain, used in the wrap phase. Fixes: https://issues.guix.gnu.org/57116 Change-Id: I29f9eee8f4a0e91eadc2eeff2a70d58db3ed0a26 --- gnu/packages/llvm.scm | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 2ee1cf21c3..91fe9e7882 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -2390,12 +2390,6 @@ (define-public cling (substitute* "lib/Interpreter/CIFactory.cpp" (("\\bsed\\b") (which "sed")) - ;; This ensures that the default C++ library used by Cling is - ;; that of the compiler that was used to build it, rather - ;; than that of whatever g++ happens to be on PATH. - (("ReadCompilerIncludePaths\\(CLING_CXX_RLTV") - (format #f "ReadCompilerIncludePaths(~s" - (search-input-file inputs "bin/g++"))) ;; Cling uses libclang's CompilerInvocation::GetResourcesPath ;; to resolve Clang's library prefix, but this fails on Guix ;; because it is relative to the output of cling rather than @@ -2427,9 +2421,28 @@ (define-public cling (add-after 'install 'delete-static-libraries ;; This reduces the size from 17 MiB to 5.4 MiB. (lambda _ - (for-each delete-file (find-files #$output "\\.a$"))))))) + (for-each delete-file (find-files #$output "\\.a$")))) + (add-after 'install 'wrap-with-include-paths + ;; Cling is sensitive to miss-matched include directives; ensure + ;; the GCC includes used match that of the GCC used to build + ;; Cling. + (lambda* (#:key inputs #:allow-other-keys) + (let ((gcc-toolchain #$(this-package-input "gcc-toolchain"))) + (wrap-program (string-append #$output "/bin/cling") + `("C_INCLUDE_PATH" prefix + (,(string-append gcc-toolchain "/include"))) + `("CPLUS_INCLUDE_PATH" prefix + (,(string-append gcc-toolchain "/include/c++") + ,(string-append gcc-toolchain "/include"))))))) + (add-after 'wrap-with-include-paths 'fix-wrapper + (lambda _ + ;; When -a $0 is used, the cling executable segfauts (see: + ;; https://issues.guix.gnu.org/73405). + (substitute* (string-append #$output "/bin/cling") + (("\"\\$0\"") + "\"${0##*/}\""))))))) (native-inputs (list python python-lit)) - (inputs (list clang-cling llvm-cling libxcrypt)) + (inputs (list clang-cling (force gcc-toolchain*) llvm-cling libxcrypt)) (home-page "https://root.cern/cling/") (synopsis "Interactive C++ interpreter") (description "Cling is an interactive C++17 standard compliant