🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.devel
Article #411

Re: RFS: Bringing [zig] to Debian: A from-source bootstrap that reproduces upstream's seed

#411
From: Edmund Lodewijks
Date: Wed, 11 Nov 2026 08:10
145 lines
8215 bytes
Hi all,

Thank you all for the swift replies -- I am really very encouraged by 
this, and I was **not** aware of zig-team on Salsa! Is there a ML where 
you discuss all these things? I looked through debian-devel, and thought 
that there wasn't much Zig work going on at the moment. I am very glad 
that I was wrong, and happy to join the effort (and zig-team) if you'll 
have me!

With regards to the things that were mentioned:

I thought that the bootstrap was the real blocker, but it turns out that 
the vendored code was. That's were my effort should go next then.

@nick black
-----------

 > in fact, it got uploaed to NEW, where it was (correctly) shot down by 
ftpmasters due to missed vendored code (of which there was a tremendous 
amount; i don't know if this has changed).

If you still have it, could you please share the (gist of the) 
ftpmasters rejection? Might be useful!

I don't think the amount of vendored code has changed very much. There's 
some work to do, and some choices to be made.

 > you mention debian/copyright is "barely started"; we've got over 1100 
lines of it. i'd definitely try to leverage what you can from there

d/copyright: Yes, very happy to continue on your work. Unvendoring first 
would help a ton, so that's where I'd start. I'm sure ftpmasters or DFSG 
use tools for quickly checking for licensen vs d/copyright. Would be 
great to be able to use that.

 > this is basically what russ albery proposed in msg00105, no?

That's correct (I could/should have mentioned that). The difference is 
in the seed: Not the upstream seed, but a seed from source, which was 
verified to be equal to the one from upstream.

The zig repo on Salsa does exclude some vendored code, but not the 
upstream blob (it mentions that in the d/copyright file, saying it will 
therefore be non-free). So, we worked on different issues.

@Maytham Alsudany
-----------------

 > I have not been able to build zig0.14 [...] on my own machine, on 
debusine.debian.net, and on barriere.debian.org (the amd64 porterbox)

Thank you for trying to build this, and I am sorry about the many hours 
without success. Happy to have a look at build logs if you feel like 
running it again.

Some things from my notes on the build failures I encountered when going 
from 0.16 to 0.17.1 (different versions from the one you were trying to 
build):

  - Do not use upstream's cmake path. cmake is good for generating 
config.h and building zigcpp (libzigcpp.a) and nothing else; the 
compiler itself has to be built by an existing zig via `zig build`.
  - Pass -Dversion-string= and -DZIG_VERSION= explicitly. Both paths 
otherwise run `git describe`, which fails in a release tarball.
  - Have ZIG_GLOBAL_CACHE_DIR inside the build tree. A stale 
~/.cache/zig silently produces a miscompiled compiler that segfaults, 
with nothing in the    output pointing anywhere near the cache. That 
cost me most of a day... :(
  - -Dcpu=baseline, or the result varies per builder.
  - I looked quite a bit at Fedora's spec file for ideas as well.

@Andrey Rakhmatullin
--------------------

 > Even having leaf package on just one architecture for significant 
amount of time is permissible, even more so if you are going to 
bootstrap other architectures later.

Thank you, that settles my question 2!

And if we can build a zig-bootstrap source package on buildd, that's 
great to know as a possible option! Thanks :)

 > Consider repacking to remove stuff you won't use (assuming not 
everything there is needed on Debian).

Yes, I will look into this.

Other packaging efforts have removed all the cross-compilation files 
(musl, Darwin, mingw, the BSDs). From what I gather, those files never 
end up in the compiler; they are the sources Zig compiles on demand so 
that it can cross-compile on a system with no cross packages installed.

I think removing all of these for now would be the best way to get Zig 
into Debian (much like Jonathan Carter did). It would be a native-only 
Zig to begin with, and cross-compilation comes in at a later stage. That 
is also when the path forward would have to be chosen: gcc-style (a 
separate compiler package per target, target libc in its own package) or 
clang-style (one multi-target compiler, target libc left to the user to 
install).

I will do the stripping incrementally against a build that currently 
works, and see if any removals break anything. I expect that removing 
lib/include (clang's resource headers) and lib/libtsan might cause 
issues, since `zig cc` uses those. Perhaps the build issues that Maytham 
reported are related to that?

And, if this is the way to go, then the abilists I mentioned in my first 
email will also go (for now).

@Ivan, Jesse
-------------
Thank you both! I had not found jmrx/zig.

On guix and buildds:
You are right, and I think that option (c) isn't very viable currently, 
also because guix is currently still blocked.
None of it affects what I am proposing, where the chain runs once 
outside the archive, and only its output (seed / blob) is shipped.

On whether a main upload would get through:
Fair enough. I guess we will only find out when an attempt to upload is 
made, unless ftpmasters also comment on threads like these?

I do not think we are competing, though. Your Files-Excluded removes a 
lot of work from d/copyright, which is great! What I have is something 
else: The seed that lets stage1/zig1.wasm be excluded too, so the result 
can go to main instead of non-free, and ghostty to main instead of 
contrib. If ftpmaster reject the seed, your non-free package is still 
there and nothing is lost but my time. Could we just ask them?

Alright! Again, thank you all so much for your input and for your work 
on getting Zig into Debian!

Kind regards,

Edmund


P.S.: I hope I covered everything. If not, please ping me!


-- 
Edmund Lodewijks <edmund@proteamail.com>
TZ: UTC+2 / GMT+2
Technical Details
Message-ID: <NYbz3-bbCI-5@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
References: <NY0aB-b4Wx-9@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Edmund Lodewijks <edmund@proteamail.com>
Newsgroups: linux.debian.devel
Subject: Re: RFS: Bringing [zig] to Debian: A from-source bootstrap that  reproduces upstream's seed
Date: Wed, 11 Nov 2026 09:10:01 +0100
Message-ID: <NYbz3-bbCI-5@gated-at.bofh.it>
References: <NY0aB-b4Wx-9@gated-at.bofh.it>
X-Mailbox-Line: From debian-devel-request@lists.debian.org  Wed Nov 11 08:09:40 2026
Old-Return-Path: <edmund@proteamail.com>
X-Amavis-Spam-Status: No, score=-2.1 tagged_above=-10000 required=5.3
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
 DKIM_VALID_EF=-0.1] autolearn=ham autolearn_force=no
X-Policyd-Weight: using cached result; rate: -4.6
X-Dkim-Filter: PhoenixDKIM Filter v1.0.0 mail.proteamail.com via nbg-mx-proteamail-1 4jPblS0Q58z2xgt
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
X-Dkim-Key-Compromise: NOTE REGARDING DKIM KEY COMPROMISE https://proteamail.com/dkim-rotate/README.txt https://proteamail.com/dkim-rotate/39/39398e78808aa9f38d1d4157adbd9ea8.pem
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Mailing-List: <debian-devel@lists.debian.org> archive/latest/373128
List-ID: <debian-devel.lists.debian.org>
List-URL: <https://lists.debian.org/debian-devel/>
List-Archive: https://lists.debian.org/msgid-search/12f6da1d-3e60-4e94-a0bc-19aa11a70eb7@proteamail.com
Approved: robomod@news.nic.it
Lines: 145
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: nick black <dankamongmen@gmail.com>, Maytham Alsudany
 <maytham@debian.org>, Andrey Rakhmatullin <wrar@debian.org>,
 Jonathan Carter <jcc@debian.org>, Ivan Carvalho <ivancarvalho@google.com>,
 Jesse Rosenstock <jmr@google.com>
X-Original-Date: Wed, 11 Nov 2026 10:09:19 +0200
X-Original-Message-ID: <12f6da1d-3e60-4e94-a0bc-19aa11a70eb7@proteamail.com>
X-Original-References: <898cd302-bf9e-4466-a604-62871bf3a8c5@proteamail.com>