From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id wG7yLoXFY2Y+LwAAe85BDQ:P1 (envelope-from ) for ; Sat, 08 Jun 2024 04:44:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id wG7yLoXFY2Y+LwAAe85BDQ (envelope-from ) for ; Sat, 08 Jun 2024 04:44:21 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=JVhqHFal; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1717814661; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=VzVmi9veYkqV4w8kTwa78c/8IwrgVXNTg3gtfAlMn5o=; b=ZpMHmTyw8PqtMdNNPgybizeXg6AA0VPHdLOcvRNerdtZz3v1/T328BxJxdZh0ytwkM+M4V 5IGp4cUOLqFtBmUzYufZO09eugCl7fiRKPds1A6Mk/E38qqoma4vRIkckb8w56BEq1az4n 8e/K7ZMiL9qF69BQv/BuZ5k/pbVspVQId0G58N+MMAOU/NL5F81Ot9c7bot7KOyiorPMxJ LT3/+6tqKUutRNZOFTMsjmjLGmvwea1Nkr0bdMpgd5TQY0/QbLtnsbViI8Oxch/AWvYAaK wgD7fSgdNKWAPrXlL6AQyV/BlZEcpvr+JiUd7auCwYNu2LWyyC7RAYpTEcljtw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=JVhqHFal; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717814661; a=rsa-sha256; cv=none; b=GQC4bK48YIaoTWSOXJcFJL6TWLCn3s8OzU5DrcIAG+RPMcueUQtsMWv/J883u5bSbmr7M5 OLUdXr379XIJ2hQgF7GGADEoRsFbGzUUdrONkFPd40LDz2IFCqtc8qM26hB60IOUTMyPGN pXvDxz0FzUwoL4wsEL1FqhDpnuL7Txl6ZP1vyoVo1150RkFey+hj/xWdNEYQEl+OzKYSGn +CtHZ72nHTzwTv3GrIKtPbPKaRJhRs58cKvNVQmcXc7zwfPYTaZ+YTocTOlMGiqU0xpUL/ O/XYfhocQBS/bnTUYaiWFOJydrIYq+yXh1Mh7/xuYFrdjKyeEw+TCRI6SO5WvA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8129097C1 for ; Sat, 8 Jun 2024 04:44:21 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFm3X-0000RZ-WC; Fri, 07 Jun 2024 22:43:48 -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 1sFm3W-0000RL-HQ for help-guix@gnu.org; Fri, 07 Jun 2024 22:43:46 -0400 Received: from mail-108-mta84.mxroute.com ([136.175.108.84]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sFm3U-00031G-KQ for help-guix@gnu.org; Fri, 07 Jun 2024 22:43:46 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta84.mxroute.com (ZoneMTA) with ESMTPSA id 18ff5baef8e00017a3.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 08 Jun 2024 02:43:40 +0000 X-Zone-Loop: f9aa54336d04ac5d309b3df861fb1778e1175964d274 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VzVmi9veYkqV4w8kTwa78c/8IwrgVXNTg3gtfAlMn5o=; b=JVhqHFalSTJnVwQMBNRqXF6BEO 0CDX3yTVHWcGrJB/l/eii4FNt+nwxYgf2jZJP22zKiw5IVkGlAbvgMlfxvhWE3C2DumnGgnU7JWHU cgXWSPytAoJ6n9plwFmNo0K6gh3oQTJX2VIoOREXD6z0JxFkr1PO50Qo/5SDyj0KRt7Fe9OZYunr8 WwSrXbBfWo+z35IbEe/krFGcYrnqh/evyOA4TSbtyUvSKQJ50NvmPXZjNGZdBlz/ohCu6sJ1ShS3S zgP3rAIFC0K5CgzyDZiggie78B1Twt0lyARENBLR2IuSPtCkKniVdvh4ZVeQOMqE6HszJbemO9aKn F2xDX2mg==; From: Richard Sent To: Christoph Buck Cc: help-guix@gnu.org Subject: Re: Installing cross-compiled packages alongside a cross-compile toolchain In-Reply-To: <82jzjny2qo.fsf@googlemail.com> (Christoph Buck's message of "Tue, 21 May 2024 10:43:11 +0200") References: <82jzjny2qo.fsf@googlemail.com> Date: Fri, 07 Jun 2024 22:43:35 -0400 Message-ID: <87ed98rw6g.fsf@freakingpenguin.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.84; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta84.mxroute.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -6.34 X-Migadu-Queue-Id: 8129097C1 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.34 X-TUID: tPUlIpsD05tI Hi Christoph! Christoph Buck writes: >> (define gcc-cross-aarch64-linux-toolchain >> (let ((chain (cross-gcc-toolchain "aarch64-linux-gnu"))) >> (package >> (inherit chain) >> (native-search-paths >> (package-search-paths >> (lookup-package-input chain "gcc-cross-aarch64-linux-gnu")))))) >> >> (packages->manifest `(,gcc-cross-aarch64-linux-toolchain ,libpng)) >> >> (define* (enable-cross-compilation entry system target) >> (manifest-entry >> (inherit entry) >> (name (string-append (manifest-entry-name entry) "." system >> (if target >> (string-append "." target) >> ""))) >> (item (with-parameters ((%current-system system) >> (%current-target-system target)) >> (manifest-entry-item entry))) >> (dependencies (if (not (null? (manifest-entry-dependencies entry))) >> (map (lambda (dep) (enable-cross-compilation dep system target)) >> (manifest-entry-dependencies entry)) >> '())))) >> >> (define (cross-build-package package) >> (manifest (list (enable-cross-compilation (package->manifest-entry package) "x86_64-linux" "aarch64-linux-gnu")))) > >> (concatenate-manifests (list (specifications->manifest '("cmake")) >> (cross-build-package libpng) >> (packages->manifest `(,gcc-cross-aarch64-linux-toolchain)))) > > From my rudimentary understanding of guile, this goes recursively > through all manifest entries of the wrapped dependency and resets the > `target` to "aarch64-linux-gnu". And indeed, this seems to work: > > Is this the correct way to set this up? Is there a simpler way? It is > such a common problem and my solution looks rather complicated. Are > there any insights and tips of people with similiar uses cases? I also unfortunately don't know of a better solution. I'm not fluent with how cross-compilation works in Guix, but I think it would be valuable proposing this (or something like it) as a patch and/or cookbook entry! It seems too useful to leave hidden away in the mailing list. (I assume your inspiration was [1], but in my opinion this is different enough in both context and content to deserve its own section.) The closest I can think of is wrapping your Guix software as a package and using --target, but this is often too much of a barrier to entry when all you want is a simple development environment. Anything making cross-compilation easier is a good thing in my eyes. [1]: https://guix.gnu.org/en/cookbook/en/guix-cookbook.html#Build-Manifest -- Take it easy, Richard Sent Making my computer weirder one commit at a time.