GNU bug report logs - #74217
Bootstrapping Zig with no Binary Blobs

Previous Next

Package: guix;

Reported by: Ekaitz Zarraga <ekaitz <at> elenq.tech>

Date: Tue, 5 Nov 2024 21:49:02 UTC

Owned by: Ekaitz Zarraga <ekaitz <at> elenq.tech>

Severity: normal

Done: Hilton Chain <hako <at> ultrarare.space>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: Motiejus Jakštys <motiejus <at> jakstys.lt>, Noé Lopez <noe <at> xn--no-cja.eu>, dan <i <at> dan.games>, Ekaitz Zarraga <ekaitz <at> elenq.tech>, 74217 <at> debbugs.gnu.org
Subject: bug#74217: Bootstrapping Zig with no Binary Blobs
Date: Thu, 14 Nov 2024 11:41:04 +0200
[Message part 1 (text/plain, inline)]
On Thu, Nov 14, 2024 at 05:22:17PM +0800, Hilton Chain wrote:
> On Thu, 14 Nov 2024 14:05:52 +0800,
> Hilton Chain wrote:
> >
> > Currently I'm 1. modifying each-lib-rpath option of 'zig build'.  2. passing
> > libc to linker.  I'll write details on this when succeed.
> 
> 1. Modification about each-lib-rpath.
> --8<---------------cut here---------------start------------->8---
> -feach-lib-rpath               Ensure adding rpath for each used dynamic library
> --8<---------------cut here---------------end--------------->8---
> 
> This option is on implicitly for native builds.  This implicity is what our Zig
> currently solely relies on.
> 
> I'm modifying it so that it's also on when CROSS_LIBRARY_PATH or LIBRARY_PATH is
> set.  This approach is better than my previous one since it only adds needed
> libraries.
> 
> 
> 2. Pass libc to Zig's linker
> This was the behavior in 0.9, but changed due to issue on macOS[1].  (btw, our
> CPLUS_INCLUDE_PATH also has issue with macOS target[2]).  RUNPATH for glibc was
> missing because of this, since it's the linker handling each-lib-rpath.
> 
> Since we do not support macOS anyway, can we restore this behavior?

At worst I could see adding a comment that it would likely break future
macOS cross-compiles.  I don't see an issue with either putting it back
unconditionally or trying to make it conditional based on
(%current-system) or the contents of (%current-target-system).

> 
> I also have concern for Zig's relying on /usr/bin/env (Zig uses an ELF file to
> find dynamic linker, env is chosen for it's well-known).  We have patched this
> reference, not sure if it will cause issue for cross-building Zig.

We use search-input-file in the replacement, so it should choose the
cross-binutils for the replacement /bin/env, so it shouldn't be a
problem.

> 
> Thanks
> ---
> [1]: https://github.com/ziglang/zig/issues/10765
> [2]: https://github.com/ziglang/zig/issues/18063

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 193 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.