Hi folks,
I’m attempting to build a nixpkgs toolchain starting from minimal bootstrap,
with several unorthodoxies:
- nix (2.24.9) built from source.
- custom store location (
/home/roland/nixroot/nix/store
instead of/nix/store
) - Local clone of nixpkgs (
/home/roland/nixroot/nixpkgs
, with 24.05 branch checked out)
Following instructions in nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/
bootstrap-sources.nix
and make-bootstrap-sources.nix
:
- prepared stage0-posix-1.6.0-source from clone of GitHub - oriansj/stage0-posix: A place for public review of the posix port of stage0
(1.6.0 since this is the version that the 24.05 nixpkgs uses), removed some paths + applied patch to
parallelmake-bootstrap-sources.nix
. - adopted patched source tree into local nix store:
nix-store --add-fixed --recursive sha256 ./stage0-posix-1.6.0-source
. - corrected nixpkgs expected sha256s in
bootstrap-sources.nix
andhex0.nix
Coming here because trouble appears to have accepted my invitation
Things that work:
$ export NIX_PATH=/home/roland/nixroot
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.hex0
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.hex1
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.hex2-0
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.catm
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.M0_hex2
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.M0
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.cc_arch-0_hex2
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.cc_arch-1_hex2
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.cc_arch
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.M2
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.blood-elf-0
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.M1-0
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.hex2-1
(look ma, awesome progress)
But now this next target fails
$ nix build -f '<nixpkgs>' minimal-bootstrap.stage0-posix.mescc-tools-boot.hex2_linker-0_M1
Error looks like misdirection – I don’t believe we’re actually missing a {
error: builder for '/home/roland/nixroot/nix/store/gng04lkk280m2jz90p8gvqb94f5nyaw9-hex2_linker-0.M1-1.6.0.drv' failed with exit code 1;
last 2 log lines:
> /home/roland/nixroot/nix/store/0j9jp0xkxcr7f7mp4r43bap9zkd0rz2r-stage0-posix-1.6.0-source/M2libc/amd64/linux/unistd.c:186:ERROR in create_struct
> Missing {
Inspecting the offending file in nix store, we have at line 186:
int uname(struct utsname* unameData)
{
asm("lea_rdi,[rsp+DWORD] %8"
"mov_rdi,[rdi]"
"mov_rax, %63"
"syscall");
}
This looks reasonable to me, but I do notice this is the first use of ‘struct foo…’ syntax in unistd.c
Everything that precedes it uses native data types.
In sys/unistd.h
we find a reasonable declaration:
struct utsname
{
char sysname[65]; /* Operating system name (e.g., "Linux") */
char nodename[65]; /* Name within "some implementation-defined network" */
char release[65]; /* Operating system release (e.g., "2.6.28") */
char version[65]; /* Operating system version */
char machine[65]; /* Hardware identifier */
};
Any advice as to how to diagnose this? Experiencing some FOTLNSP
I’m planning to try:
- verify that released nixpkgs-24.05 with nix store in /nix builds
minimal-bootstrap.stage0-posix.mescc-tools-boot.hex2_linker-0_M1
- verify that my manually-prepared
stage0-posix-1.6.0-source
actually matches whatmake-bootstrap-sources
constructs. - try more recent
stage0-posix-1.7.0-source
Hoping one of these sheds some light