From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id ULx0GgnsOGfOFgAAe85BDQ:P1 (envelope-from ) for ; Sat, 16 Nov 2024 19:01:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id ULx0GgnsOGfOFgAAe85BDQ (envelope-from ) for ; Sat, 16 Nov 2024 20:01:29 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=q0IP7ygo; dkim=fail ("headers rsa verify failed") header.d=ultrarare.space header.s=dkim header.b="pGT/bwic"; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1731783689; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Of2CNbgUEDulf91MXe7MwW097UAkbg0qmQi0THeGxqg=; b=gixCYOwrfwlWRaSBJV8l/CbgYQEpWjTXXbqOkWYXv+c6WmhK0ci4NS79WWYbtghxgiNao8 qFOnnISrk0NJe8OcOEpCE+UM3HGEpx50nsH8E/klKtNnmMT6XNvU+LGtObaPK1iDGzjRq/ NIZ39P3WYJnFCuaDrybm/04Zr6vesaqtPky5Y0bNgEYcxYuipJlVGRIRn4LS2NnexvsMgt qbwxjeDWZAx+U07a5TmY4Rlxh83MNhTcDFrH32g0pqAKbZ4QI7PPsqv/qUzzzkbhGd5ahc iWuqHIMy9B9o2oaH+1WOzSVHPPo00bPiM/R22zf8qBf+SzlleBV8It53I4Emgw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1731783689; a=rsa-sha256; cv=none; b=I+hUXgxxnVtrj5Jhcdb9A7+4vfw1rdopWaItjxKHmS9c5FCB3rEDgIucszG6xWmjWAkbtt S+FKY3lKmD1ujBY133v/ILy2lP1Y5QrXtW09PfdLdp03GyVNRPl7bFXGvVRVnPvN6VsHDr oEtOoik12JpluYwjSBHOoZ1VAImxbwo7vvls9B9U1LjcJWkvLXLmGHmsY7t7cx0AO/wqhC +DdTgX4eloxWesNyMCvsQ6T2e5/c/1aoKCcKWnOIwO0A/pV57yh5St8AqIJKpMNVXN5Y5M 8ZmxXFXyWcUDU3ArFaS8410EpTIkulMRc5PWUH5DtfivH/3F849vDkTzw1WJjA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=q0IP7ygo; dkim=fail ("headers rsa verify failed") header.d=ultrarare.space header.s=dkim header.b="pGT/bwic"; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org 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 13B527C425 for ; Sat, 16 Nov 2024 20:01:29 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCO2a-0000NB-SM; Sat, 16 Nov 2024 14:01:04 -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 1tCO2Z-0000Mj-Fr for bug-guix@gnu.org; Sat, 16 Nov 2024 14:01:03 -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 1tCO2Z-00029K-7F for bug-guix@gnu.org; Sat, 16 Nov 2024 14:01:03 -0500 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:From:Date:To:Subject; bh=Of2CNbgUEDulf91MXe7MwW097UAkbg0qmQi0THeGxqg=; b=q0IP7ygomVPtVCnqeTxaVaOkPnFh6pCKquWjVOmYt3oqtb1oLZwuxBdup2cIGr3vRIjUhVyQR1O3xsFufuBAbotGXLHsFynCCyECEVEU92W5scnIKGG/PyJjc+rvcV9W+ciAb5u8jgdyMfAUXj1jmxoedq6Y4fxFhszPxUOQrhm6eA0n8Q9QeO0H9bpdMdKBVEMW/5A+Yw2taBk7dz2g8B9TJehYcoUF7MSGDw4W2Gab8KRq+PNByXz5bC1IdT2xRPJF4RgBlLwEGmP2fP79pFRFlYXKVsfUGocw8wDp8VUZwDzJ7BgThKvrsc+c9qqy0kWBAI7kHcZmX/2t4SrAKg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCO2Y-0001lM-81; Sat, 16 Nov 2024 14:01:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#74217: Bootstrapping Zig with no Binary Blobs Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org, Ekaitz Zarraga Resent-Date: Sat, 16 Nov 2024 19:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74217 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Efraim Flashner , Hilton Chain , 74217@debbugs.gnu.org, Motiejus =?UTF-8?Q?Jak=C5=A1tys?= , =?UTF-8?Q?No=C3=A9?= Lopez , dan , Ekaitz Zarraga Received: via spool by 74217-submit@debbugs.gnu.org id=B74217.17317836156471 (code B ref 74217); Sat, 16 Nov 2024 19:01:02 +0000 Received: (at 74217) by debbugs.gnu.org; 16 Nov 2024 19:00:15 +0000 Received: from localhost ([127.0.0.1]:54818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCO1n-0001gG-12 for submit@debbugs.gnu.org; Sat, 16 Nov 2024 14:00:15 -0500 Received: from mail.boiledscript.com ([144.168.59.46]:44350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCO1k-0001cw-P5 for 74217@debbugs.gnu.org; Sat, 16 Nov 2024 14:00:14 -0500 Date: Sun, 17 Nov 2024 02:59:54 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1731783605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Of2CNbgUEDulf91MXe7MwW097UAkbg0qmQi0THeGxqg=; b=pGT/bwicora9jPiedkJ1ZZd37XuX6QyRZQWpm1RCYNkrq0x04tOcFsA/uEIWjB6IYA4uom dN0RahE9bSyo9/9nX3BCIdtMy/Z1Nu/4235NV5horghax762yKgrkfRGHvmE0EmRl07c+N MGs6hXdxzjjrto0nrT8pOhWc+cZlmeINzMngQDFQDbmKV75TzGkDJth+ZKbd8pi1aWds6V cnKSqhnXBE1m2m7I50zTHBxh24HMP/nvt0nsd3lQmT+OfZyjuJeMHHqlwQMkXTRfAMwyOQ 257c4fT2QYqvdnzR+TWs1BGBg0GneUnyzdyjszJdFx77Fv1KFWf9bX1Z7g+9dQ== Message-ID: <87ed3b6m39.wl-hako@ultrarare.space> In-Reply-To: References: <87ldxngjy4.wl-hako@ultrarare.space> <878qtmvh2i.wl-hako@ultrarare.space> <877c96vd3u.wl-hako@ultrarare.space> <874j4auz7j.wl-hako@ultrarare.space> <87v7wqtbjq.wl-hako@ultrarare.space> <878qtl5g55.wl-hako@ultrarare.space> <87jzd47enj.wl-hako@ultrarare.space> <87iksn7jnk.wl-hako@ultrarare.space> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Hilton Chain From: Hilton Chain via Bug reports for GNU Guix Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -5.62 X-Spam-Score: -5.62 X-Migadu-Queue-Id: 13B527C425 X-Migadu-Scanner: mx13.migadu.com X-TUID: fAwJR5LhTCCS On Sun, 17 Nov 2024 01:03:59 +0800, Efraim Flashner wrote: > > [1 ] > On Sat, Nov 16, 2024 at 02:54:55PM +0800, Hilton Chain wrote: > > On Fri, 15 Nov 2024 22:30:40 +0800, > > Hilton Chain wrote: > > > > > > I have locally made the "use-system-paths" patch larger so that Zig c= an really > > > honor "CROSS_" environment variables. > > > > > > The next issue is cross building with pkg-config. Zig only invokes > > > "pkg-config", but we don't have a "pkg-config" with search path for t= arget > > > inputs. I can add a pkg-config-for-zig to workaround this, and then.= .. It's > > > dynamic linker path, I'll look into it soon. > > I tried adding pkg-config-for-build as a work-around but it wasn't > enough without touching the zig compiler's source too, which I didn't > attempt yesterday. > > > Adding a file with content like the following and passing --libc to > > zig works, RUNPATH is correct and no need to set CC then. > > > > --8<---------------cut here---------------start------------->8--- > > include_dir=3D/gnu/store/dfx90sc16nphh6bd07sjyri6x4s51zni-glibc-cross-a= arch64-linux-gnu-2.39/include > > sys_include_dir=3D/gnu/store/dfx90sc16nphh6bd07sjyri6x4s51zni-glibc-cro= ss-aarch64-linux-gnu-2.39/include > > crt_dir=3D/gnu/store/dfx90sc16nphh6bd07sjyri6x4s51zni-glibc-cross-aarch= 64-linux-gnu-2.39/lib > > msvc_lib_dir=3D > > kernel32_lib_dir=3D > > gcc_dir=3D > > --8<---------------cut here---------------end--------------->8--- > > Is this the layout of the file expected? That doesn't look too hard to > create in the build-system if necessary. > > > For cross builds interpreter path like /lib/ld-linux-aarch64.so.1 is us= ed in > > output binary, I'll find a way to fix it. > > I was going to say to take a look at gcc-2.95, where we point all the > linkers for all the architectures to whatever the target architecture > is, but that won't work here since we have 1 zig binary and it can > compile for any architecture. > > I'm going to suggest against adding a cross-libc for all the different > architectures as an input, that would be crazy. > > (ins)efraim@3900XT ~/workspace/zig$ git grep 'ld-linux-aarch64.so.1' > lib/libc/include/aarch64-linux-gnu/gnu/lib-names-lp64.h:#define LD_LINUX_= AARCH64_SO "ld-linux-aarch64.so.1" > lib/libc/include/aarch64-linux-gnu/gnu/lib-names-lp64.h:#define LD_SO = "ld-linux-aarch64.so.1" > lib/std/Build.zig:/// that contains the path `aarch64-linux-gnu/lib/ld-li= nux-aarch64.so.1`. > lib/std/Target.zig: .aarch64 =3D> init("/lib/ld-linux-aarc= h64.so.1"), > Binary file stage1/zig1.wasm matches > > Would it be possible to change the init("/path/to/ld.so") part to the > zig equivalent of (search-input-file inputs "/path/to/ld.so"), and then > when it is used from Guix the cross-libc will already be in the PATH and > therefore findable from zig's search through the vector=B9 of the paths > inside PATH? > > =B9 I know it's not true but in my mind a vector and an array are the same > thing. I have added a GUIX_ZIG_LIBC_DIR environment variable, to be set as output = path of cross-libc or libc by zig-build-system, patched Zig to search it and concatenate it with "/lib/ld...". Also added the file for --libc option in zig-build-system. Cross compilati= on is available now. (only available in 0.12 for now, I'll port the patches to o= ther versions when I get up.)