unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Hilton Chain via Bug reports for GNU Guix <bug-guix@gnu.org>
To: "Efraim Flashner" <efraim@flashner.co.il>,
	"Hilton Chain" <hako@ultrarare.space>,
	74217@debbugs.gnu.org, "Motiejus Jakštys" <motiejus@jakstys.lt>,
	"Noé Lopez" <noe@xn--no-cja.eu>, dan <i@dan.games>,
	"Ekaitz Zarraga" <ekaitz@elenq.tech>
Subject: bug#74217: Bootstrapping Zig with no Binary Blobs
Date: Sun, 17 Nov 2024 02:59:54 +0800	[thread overview]
Message-ID: <87ed3b6m39.wl-hako@ultrarare.space> (raw)
In-Reply-To: <ZzjQf-YCLUUT2Nnk@3900XT>

On Sun, 17 Nov 2024 01:03:59 +0800,
Efraim Flashner wrote:
>
> [1  <text/plain; utf-8 (quoted-printable)>]
> 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 can 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 target
> > > 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 <this file> to
> > zig works, RUNPATH is correct and no need to set CC then.
> >
> > --8<---------------cut here---------------start------------->8---
> > include_dir=/gnu/store/dfx90sc16nphh6bd07sjyri6x4s51zni-glibc-cross-aarch64-linux-gnu-2.39/include
> > sys_include_dir=/gnu/store/dfx90sc16nphh6bd07sjyri6x4s51zni-glibc-cross-aarch64-linux-gnu-2.39/include
> > crt_dir=/gnu/store/dfx90sc16nphh6bd07sjyri6x4s51zni-glibc-cross-aarch64-linux-gnu-2.39/lib
> > msvc_lib_dir=
> > kernel32_lib_dir=
> > gcc_dir=
> > --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 used 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-linux-aarch64.so.1`.
> lib/std/Target.zig:                .aarch64 => init("/lib/ld-linux-aarch64.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¹ of the paths
> inside PATH?
>
> ¹ 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 compilation is
available now.  (only available in 0.12 for now, I'll port the patches to other
versions when I get up.)




  reply	other threads:[~2024-11-16 19:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 21:47 bug#74217: Bootstrapping Zig with no Binary Blobs Ekaitz Zarraga
2024-11-07  1:19 ` Hilton Chain via Bug reports for GNU Guix
2024-11-07 22:06   ` Noé Lopez via Bug reports for GNU Guix
2024-11-07 22:09     ` Ekaitz Zarraga
2024-11-11 11:42   ` Efraim Flashner
2024-11-11 11:56     ` Hilton Chain via Bug reports for GNU Guix
2024-11-11 12:02       ` Efraim Flashner
2024-11-08 17:43 ` bug#74217: [PATCH 0/2] Initial step on bootstrapping Zig Hilton Chain via Bug reports for GNU Guix
2024-11-08 17:44   ` bug#74217: [PATCH 1/2] gnu: Add zig-0.10.0-610-bootstrap Hilton Chain via Bug reports for GNU Guix
2024-11-08 17:44   ` bug#74217: [PATCH 2/2] gnu: Add zig-0.10.0-610 Hilton Chain via Bug reports for GNU Guix
2024-11-09 17:26   ` bug#74217: [PATCH 0/2] Initial step on bootstrapping Zig Hilton Chain via Bug reports for GNU Guix
2024-11-13 16:46 ` bug#74217: Bootstrapping Zig with no Binary Blobs Hilton Chain via Bug reports for GNU Guix
2024-11-13 18:10   ` Efraim Flashner
2024-11-13 23:40     ` Hilton Chain via Bug reports for GNU Guix
2024-11-14  1:05       ` Hilton Chain via Bug reports for GNU Guix
2024-11-14  6:05         ` Hilton Chain via Bug reports for GNU Guix
2024-11-14  9:22           ` Hilton Chain via Bug reports for GNU Guix
2024-11-14  9:41             ` Efraim Flashner
2024-11-15  3:29               ` Hilton Chain via Bug reports for GNU Guix
2024-11-15 14:30                 ` Hilton Chain via Bug reports for GNU Guix
2024-11-16  6:54                   ` Hilton Chain via Bug reports for GNU Guix
2024-11-16  7:13                     ` Motiejus Jakštys
2024-11-16  7:18                       ` Hilton Chain via Bug reports for GNU Guix
2024-11-16 17:03                     ` Efraim Flashner
2024-11-16 18:59                       ` Hilton Chain via Bug reports for GNU Guix [this message]
2024-11-17  1:39                     ` Hilton Chain via Bug reports for GNU Guix
2024-11-17  7:16                   ` Efraim Flashner
2024-11-17 14:51                     ` Hilton Chain via Bug reports for GNU Guix
2024-11-18 12:00                       ` Hilton Chain via Bug reports for GNU Guix
2024-11-19 13:13                       ` Hilton Chain via Bug reports for GNU Guix
2024-11-21 13:06                         ` Hilton Chain via Bug reports for GNU Guix
2024-11-14  9:47             ` Motiejus Jakštys

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ed3b6m39.wl-hako@ultrarare.space \
    --to=bug-guix@gnu.org \
    --cc=74217@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --cc=ekaitz@elenq.tech \
    --cc=hako@ultrarare.space \
    --cc=i@dan.games \
    --cc=motiejus@jakstys.lt \
    --cc=noe@xn--no-cja.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).