From patchwork Thu Jan 4 12:40:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zheng Junjie X-Patchwork-Id: 58348 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 0F3BC27BBEA; Thu, 4 Jan 2024 12:55:18 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS 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 0DBB127BBE9 for ; Thu, 4 Jan 2024 12:55:16 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLNFV-0005uR-RL; Thu, 04 Jan 2024 07:55:01 -0500 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 1rLNFS-0005tv-RW for guix-patches@gnu.org; Thu, 04 Jan 2024 07:54:58 -0500 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 1rLNFS-0000mT-IN for guix-patches@gnu.org; Thu, 04 Jan 2024 07:54:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rLNFV-0007oU-Sf for guix-patches@gnu.org; Thu, 04 Jan 2024 07:55:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68133] [PATCH] gnu: glew: Fix cross-compiling. Resent-From: Zheng Junjie Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 Jan 2024 12:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68133 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: Efraim Flashner , 68133@debbugs.gnu.org Received: via spool by 68133-submit@debbugs.gnu.org id=B68133.170437288930011 (code B ref 68133); Thu, 04 Jan 2024 12:55:01 +0000 Received: (at 68133) by debbugs.gnu.org; 4 Jan 2024 12:54:49 +0000 Received: from localhost ([127.0.0.1]:53859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLNFI-0007ny-0N for submit@debbugs.gnu.org; Thu, 04 Jan 2024 07:54:48 -0500 Received: from smtp81.cstnet.cn ([159.226.251.81]:44890 helo=cstnet.cn) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rLNFD-0007nh-EK for 68133@debbugs.gnu.org; Thu, 04 Jan 2024 07:54:47 -0500 Received: from m (unknown [183.247.5.190]) by APP-03 (Coremail) with SMTP id rQCowACHyMCFqpZlnCtmAw--.292S2; Thu, 04 Jan 2024 20:54:30 +0800 (CST) References: <59dfe1d44bc0ea2cc713da3273c2e49b47e470cf.1703912009.git.zhengjunjie@iscas.ac.cn> <87jzoqze6q.fsf@gnu.org> User-agent: mu4e 1.10.8; emacs 30.0.50 From: Zheng Junjie Date: Thu, 04 Jan 2024 20:40:40 +0800 In-reply-to: <87jzoqze6q.fsf@gnu.org> Message-ID: <87o7e1mf7f.fsf@iscas.ac.cn> MIME-Version: 1.0 X-CM-TRANSID: rQCowACHyMCFqpZlnCtmAw--.292S2 X-Coremail-Antispam: 1UD129KBjvdXoW7GrW8WFWDArW3Gr45Kr18Grg_yoWDGrbEyF s7urnruw12vr4DGw18u3yrWrWjg3y5tr1UCayUGFsrAr9rZF45t3W8AFWxA3W3K39F93W8 trZ3J3yxAry2gjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb7kYjsxI4VWkKwAYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I 6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2 8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWUJVWUCwA2z4x0Y4vE2Ix0 cI8IcVCY1x0267AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I 8E87Iv6xkF7I0E14v26F4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487M2AExVA0xI80 1c8C04v7Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7V C2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxAIw28I cxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2 IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUXVWUAwCIc40Y0x0EwIxGrwCI 42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42 IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280 aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUgg_TUUUUU X-Originating-IP: [183.247.5.190] X-CM-SenderInfo: x2kh0wxmxqyx3h6l2u1dvotugofq/ 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 Mathieu Othacehe writes: > Hello, > >> gnu/packages/gl.scm(glew): >> [arguments]<#:make-flags>: when cross-compiling, use {cc,strip}-for-target. > > When running: > > ./pre-inst-env guix build --target=aarch64-linux-gnu glew > > I have the following error message: > > Run-time dependency libudev found: NO (tried pkgconfig and cmake) > > ../mesa-23.2.1/meson.build:1682:13: ERROR: Failed running '/gnu/store/fzmc9w4i1lyqi0v62w5jpdxi6h9cbnyh-llvm-for-mesa-15.0.7/bin/llvm-config', binary or interpreter not executable. > Possibly wrong architecture or the executable bit is not set. > > A full log can be found at /tmp/guix-build-mesa-23.2.1.drv-0/build/meson-logs/meson-log.txt > error: in phase 'configure': uncaught exception: > > Did I miss something? i think because binfmt leak into build environment, so host's llvm-config can executed. please try this patch, use meson's cmake module to find llvm. > > Thanks, > > Mathieu From 015ac9468acefe959dea570fc1661bcbce6ebaf8 Mon Sep 17 00:00:00 2001 Message-ID: <015ac9468acefe959dea570fc1661bcbce6ebaf8.1704372069.git.zhengjunjie@iscas.ac.cn> From: Zheng Junjie Date: Thu, 4 Jan 2024 20:33:13 +0800 Subject: [PATCH] gnu: mesa: fix cross-compiling. * gnu/packages/gl.scm(mesa)[native-inputs]: when cross-compile, add cmake-minimal-cross. [arguments]: adjust fix-cross-compiling to find llvm. * gnu/packages/llvm.scm(llvm-for-mesa) [arguments]<#:configure-flags>: When cross-compile, set -DBUILD_SHARED_LIBS:BOOL=TRUE and -DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE, remove -DLLVM_LINK_LLVM_DYLIB.* . <#:phases>: when cross-compile, remove delete-static-libraries phase. Change-Id: If10dec7695e62604e080230e10f2b8d7167f660b --- gnu/packages/gl.scm | 17 +++++++++++------ gnu/packages/llvm.scm | 28 +++++++++++++++++++--------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm index b0ee413acd..91fa8f642f 100644 --- a/gnu/packages/gl.scm +++ b/gnu/packages/gl.scm @@ -18,7 +18,7 @@ ;;; Copyright © 2021, 2022, 2023 John Kehayias ;;; Copyright © 2022 Petr Hodina ;;; Copyright © 2023 Kaelyn Takata -;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> +;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -62,6 +62,7 @@ (define-module (gnu packages gl) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix hg-download) + #:use-module (gnu packages cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (guix build-system meson) @@ -338,7 +339,8 @@ (define-public mesa python-wrapper (@ (gnu packages base) which) (if (%current-target-system) - (list pkg-config-for-build + (list cmake-minimal-cross + pkg-config-for-build wayland wayland-protocols) '()))) @@ -415,10 +417,13 @@ (define-public mesa #~(modify-phases %standard-phases #$@(if (%current-target-system) #~((add-after 'unpack 'fix-cross-compiling - (lambda* (#:key inputs #:allow-other-keys) - ;; It isn't a problem to use the host's llvm-config. - (setenv "LLVM_CONFIG" - (search-input-file inputs "/bin/llvm-config"))))) + (lambda* (#:key native-inputs #:allow-other-keys) + ;; when cross compile, we use cmake to find llvm, not llvm-config, + ;; because llvm-conifg cannot be executed + ;; see https://github.com/llvm/llvm-project/issues/58984 + (setenv "CMAKE" + (search-input-file + native-inputs "/bin/cmake"))))) #~()) (add-after 'unpack 'disable-failing-test (lambda _ diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 6abd1a67d7..a3176c6dae 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -27,6 +27,7 @@ ;;; Copyright © 2022 Clément Lassieur ;;; Copyright © 2022 Zhu Zihao ;;; Copyright © 2023 Hilton Chain +;;; Copyright © 2023, 2024 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -2169,20 +2170,29 @@ (define-public llvm-for-mesa ;; AMDGPU is needed by the vulkan drivers. #$(string-append "-DLLVM_TARGETS_TO_BUILD=" (system->llvm-target) ";AMDGPU") + #$@(if (%current-target-system) + '("-DBUILD_SHARED_LIBS:BOOL=TRUE" + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE") + '()) ;; Skipping tools and utils decreases the output by ~100 MiB. "-DLLVM_BUILD_TOOLS=NO" - (remove (cut string-match - "-DLLVM_(TARGETS_TO_BUILD|INSTALL_UTILS).*" <>) + (remove + (cut string-match + #$(if (%current-target-system) + "-DLLVM_(LINK_LLVM_DYLIB|TARGETS_TO_BUILD|INSTALL_UTILS).*" + "-DLLVM_(TARGETS_TO_BUILD|INSTALL_UTILS).*") <>) #$cf))) ((#:phases phases '%standard-phases) #~(modify-phases #$phases - (add-after 'install 'delete-static-libraries - ;; If these are just relocated then llvm-config can't find them. - (lambda* (#:key outputs #:allow-other-keys) - (for-each delete-file - (find-files (string-append - (assoc-ref outputs "out") "/lib") - "\\.a$")))) + #$@(if (%current-target-system) + '() + #~((add-after 'install 'delete-static-libraries + ;; If these are just relocated then llvm-config can't find them. + (lambda* (#:key outputs #:allow-other-keys) + (for-each delete-file + (find-files (string-append + (assoc-ref outputs "out") "/lib") + "\\.a$")))))) ;; llvm-config is how mesa and others find the various ;; libraries and headers they use. (add-after 'install 'build-and-install-llvm-config base-commit: 7b0863f07a113caef26fea13909bd97d250b629e prerequisite-patch-id: b3a67130858eb3c97f43099cb3b2f7978d5f1a79 prerequisite-patch-id: 007807771d1614f2e42f5df56b7d1875b1966031 -- 2.41.0