Subject: [core-updates] Native Hurd (i586-gnu) builds broken

From: Ludovic Courtès <[email-masked]>
Date: Fri, 26 Jul 2024 23:27:07 +0200

Hello!

As of 21fe1e077aa77488bd413ef3255973c60d7468fe, native i586-gnu builds
are broken on ‘core-updates’:

--8<---------------cut here---------------start------------->8---
gcc -std=gnu99 -fgnu89-inline -Wall -Werror=old-style-definition -Werror=implicit-function-declaration -Werror=strict-prototypes -g -O3 -fno-strict-aliasing  -g -O2 -I.  -I..  -I../include -I../include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64  -DPACKAGE_NAME=\"GNU\ Hurd\" -DPACKAGE_TARNAME=\"hurd\" -DPACKAGE_VERSION=\"0.9\" -DPACKAGE_STRING=\"GNU\ Hurd\ 0.9\" -DPACKAGE_BUGREPORT=\"[email-masked]\" -DPACKAGE_URL=\"http://www.gnu.org/software/hurd/\" -DUTIME_NOW=-1 -DUTIME_OMIT=-2 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DX11_PREFIX=\"\" -DHAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR=1  -c -o exec-reauth.o exec-reauth.c
In file included from /gnu/store/manl7sfylldlpcsdgngbs2b07pf29y8l-glibc-bootstrap-0/include/mach.h:37:0,
                 from exec-reauth.c:22:
/gnu/store/manl7sfylldlpcsdgngbs2b07pf29y8l-glibc-bootstrap-0/include/mach/mach_host.h:489:2: error: unknown type name 'kernel_boot_info_t'
  kernel_boot_info_t boot_info
  ^
/gnu/store/manl7sfylldlpcsdgngbs2b07pf29y8l-glibc-bootstrap-0/include/mach/mach_host.h:978:2: error: unknown type name 'kernel_boot_info_t'
  kernel_boot_info_t boot_info
  ^
exec-reauth.c: In function 'reauth':
exec-reauth.c:71:21: error: implicit declaration of function 'proc_reauthenticate_complete' [-Werror=implicit-function-declaration]
               err = proc_reauthenticate_complete (newport);
                     ^
cc1: some warnings being treated as errors
make[1]: *** [<builtin>: exec-reauth.o] Error 1
make[1]: Leaving directory '/tmp/guix-build-hurd-minimal-boot0-0.9.git20231217.drv-0/source/libshouldbeinlibc'
make: *** [Makefile:262: libshouldbeinlibc] Error 2
error: in phase 'build': uncaught exception:
srfi-34 #<condition &invoke-error [program: "make" arguments: ("-j" "1" "lib-subdirs=libshouldbeinlibc libihash libstore" "prog-subdirs=" "other-subdirs=") exit-status: 2 term-signal: #f stop-signal: #f] 7e9700> 
phase `build' failed after 4.1 seconds
command "make" "-j" "1" "lib-subdirs=libshouldbeinlibc libihash libstore" "prog-subdirs=" "other-subdirs=" failed with status 2
builder for `/gnu/store/pb157d8kfdsdz6grqrksha459aqjh99l-hurd-minimal-boot0-0.9.git20231217.drv' failed with exit code 1
@ build-failed /gnu/store/pb157d8kfdsdz6grqrksha459aqjh99l-hurd-minimal-boot0-0.9.git20231217.drv - 1 builder for `/gnu/store/pb157d8kfdsdz6grqrksha459aqjh99l-hurd-minimal-boot0-0.9.git20231217.drv' failed with exit code 1
--8<---------------cut here---------------end--------------->8---

This is beacuse <mach/mach_host.h> in ‘glibc-bootstrap’ expects
‘kernel_boot_info_t’ to be defined, but the <mach/host_info.h> header
from the updated ‘gnumach-headers-boot0’ no longer defines it.

(Note that there’s additional confusion due to origin inheritance:
upgrading ‘gnumach-headers’ upgrades ‘gnumach-headers-boot0’, even
though that’s not indented.)

The patch below reverts to something close to what we have on ‘master’,
but glibc 2.39 fails to build then:

--8<---------------cut here---------------start------------->8---
i586-guix-gnu-gcc msg-destroy.c -c -std=gnu11 -fgnu89-inline  -g -O2 -Wall -Wwrite-strings -Wundef -fmerge-all-constants -frounding-math -fno-stack-protector -fno-common -Wp,-U_FORTIFY_SOURCE -Wno-parentheses -Wstrict-prototypes -Wold-style-definition -fmath-errno    -fPIE     -ftls-model=initial-exec     -I../include -I/tmp/guix-build-glibc-intermediate-2.39.drv-0/build/mach  -I/tmp/guix-build-glibc-intermediate-2.39.drv-0/build  -I../sysdeps/mach/hurd/i386  -I../sysdeps/mach/hurd/x86  -I../sysdeps/mach/hurd/i386/htl  -I../sysdeps/mach/hurd/htl  -I../sysdeps/hurd/htl  -I../sysdeps/mach/htl  -I../sysdeps/htl/include -I../sysdeps/htl  -I../sysdeps/pthread  -I../sysdeps/i386/htl  -I../sysdeps/x86/htl  -I../sysdeps/mach/hurd  -I../sysdeps/gnu  -I../sysdeps/unix/bsd  -I../sysdeps/unix/inet  -I../sysdeps/mach/i386  -I../sysdeps/mach/x86  -I../sysdeps/mach/include -I../sysdeps/mach  -I../sysdeps/i386/i586  -I../sysdeps/i386/fpu  -I../sysdeps/x86/fpu  -I../sysdeps/i386  -I../sysdeps/x86/include -I../sysdeps/x86  -I../sysdeps/wordsize-32  -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/hurd/include -I../sysdeps/hurd  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/ieee754  -I../sysdeps/generic -I../hurd -I/tmp/guix-build-glibc-intermediate-2.39.drv-0/build/hurd/ -I../mach -I/tmp/guix-build-glibc-intermediate-2.39.drv-0/build/mach/ -I.. -I../libio -I. -nostdinc -isystem /gnu/store/vkqj1gblhllcj9k26jpjp13qwcm55j8p-gcc-cross-boot0-11.4.0-lib/lib/gcc/i586-guix-gnu/11.4.0/include -isystem /gnu/store/vkqj1gblhllcj9k26jpjp13qwcm55j8p-gcc-cross-boot0-11.4.0-lib/lib/gcc/i586-guix-gnu/11.4.0/include-fixed -isystem /gnu/store/vqdzmb3i7ds3ghwvlj44xcasgq8nln55-hurd-core-headers-0.9.git20231217/include -D_LIBC_REENTRANT -include /tmp/guix-build-glibc-intermediate-2.39.drv-0/build/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC     -DTOP_NAMESPACE=glibc -o /tmp/guix-build-glibc-intermediate-2.39.drv-0/build/mach/msg-destroy.o -MD -MP -MF /tmp/guix-build-glibc-intermediate-2.39.drv-0/build/mach/msg-destroy.o.dt -MT /tmp/guix-build-glibc-intermediate-2.39.drv-0/build/mach/msg-destroy.o
msg-destroy.c: In function '__mach_msg_destroy':
msg-destroy.c:114:21: error: unknown type name 'mach_port_name_inlined_t'; did you mean 'mach_port_name_array_t'?
  114 |                     mach_port_name_inlined_t *inlined_ports = (mach_port_name_inlined_t *)addr;
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~
      |                     mach_port_name_array_t
msg-destroy.c:114:64: error: 'mach_port_name_inlined_t' undeclared (first use in this function); did you mean 'mach_port_name_array_t'?
  114 |                     mach_port_name_inlined_t *inlined_ports = (mach_port_name_inlined_t *)addr;
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                mach_port_name_array_t
msg-destroy.c:114:64: note: each undeclared identifier is reported only once for each function it appears in
msg-destroy.c:114:90: error: expected expression before ')' token
  114 |                     mach_port_name_inlined_t *inlined_ports = (mach_port_name_inlined_t *)addr;
      |                                                                                          ^
msg-destroy.c:116:63: error: request for member 'name' in something not a structure or union
  116 |                         mach_msg_destroy_port(inlined_ports[i].name, name);
      |                                                               ^
make[2]: *** [../o-iterator.mk:9: /tmp/guix-build-glibc-intermediate-2.39.drv-0/build/mach/msg-destroy.o] Error 1
make[2]: Leaving directory '/tmp/guix-build-glibc-intermediate-2.39.drv-0/glibc-2.39/mach'
make[1]: *** [Makefile:484: mach/subdir_lib] Error 2
make[1]: Leaving directory '/tmp/guix-build-glibc-intermediate-2.39.drv-0/glibc-2.39'
make: *** [Makefile:9: all] Error 2
error: in phase 'build': uncaught exception:
srfi-34 #<condition &invoke-error [program: "make" arguments: ("-j" "1") exit-status: 2 term-signal: #f stop-signal: #f] 9a4da0> 
phase `build' failed after 44.6 seconds
command "make" "-j" "1" failed with status 2
builder for `/gnu/store/18p66bbg3w2l4rmvkqc0z57bl0j1wqlq-glibc-intermediate-2.39.drv' failed with exit code 1
--8<---------------cut here---------------end--------------->8---

Any idea where to go from here?

Of course we could upgrade ‘glibc-bootstrap’, but it’s even better if we
can avoid it.

Ludo’.

diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index b31f976900..911625003c 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2628,10 +2628,11 @@ (define gnumach-headers-boot0
    (package
      (inherit gnumach-headers)
      (name "gnumach-headers-boot0")
-     (version "1.8+git20230410")
+     ;; Note: The version used here must be compatible with the <mach.h> and
+     ;; related headers in 'glibc-bootstrap'.
+     (version "1.8+git20221224")
      (source
       (origin
-        (inherit (package-source gnumach-headers))
         (method
          (git-fetch-from-tarball
           (origin
@@ -2641,7 +2642,14 @@ (define gnumach-headers-boot0
                   "gnumach-" version ".tar.gz"))
             (sha256
              (base32
-              "1s09256g2ny46idrn8frzs7r51la9ni45bmglmswlsmz9ii7dpi4")))))))
+              "0vb19ynvrxz302snqxkd0wgizwa5fw2x06a4zjsllqb9ijbq9mc8")))))
+        (uri (git-reference
+              (url "https://git.savannah.gnu.org/git/hurd/gnumach.git")
+              (commit (string-append "v" version))))
+        (file-name (git-file-name "gnumach" version))
+        (sha256
+         (base32
+          "0f49zqxf64ds75rmskizpybl2mw7sxs05k59gjp3pgspvr87w7gs"))))
      (native-inputs (list autoconf-boot0 automake-boot0 texinfo-boot0))
      (arguments
       (substitute-keyword-arguments (package-arguments gnumach-headers)
@@ -2691,10 +2699,9 @@ (define hurd-headers-boot0
    (package
      (inherit hurd-headers)
      (name "hurd-headers-boot0")
-     (version "0.9.git20230520")
+     (version "0.9.git20230216")
      (source
       (origin
-        (inherit (package-source hurd-headers))
         (method
          (git-fetch-from-tarball
           (origin
@@ -2704,7 +2711,14 @@ (define hurd-headers-boot0
                   "hurd-v" version ".tar.gz"))
             (sha256
              (base32
-              "0ybmx7bhy21zv1if2hfdspn13zn68vki1na72sw2jj87gj8przna")))))))
+              "1f75nlkcl00dqnnrbrj1frvzs2qibfpygj3gwywqi85aldjl48y7")))))
+        (uri (git-reference
+              (url "https://git.savannah.gnu.org/git/hurd/hurd.git")
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "0jm1dnqkx4kdwmby0z5w0yqp9m5qp4hbxd4jxlyhiqm8nkw9mkvv"))))
      (native-inputs
       (list autoconf-boot0 automake-boot0 mig-boot0))
      (inputs '()))))
@@ -2714,10 +2728,12 @@ (define hurd-minimal-boot0
    (package
      (inherit hurd-minimal)
      (name "hurd-minimal-boot0")
+     (version (package-version hurd-headers-boot0))
      (source (package-source hurd-headers-boot0))
      (native-inputs
       (list autoconf-boot0 automake-boot0 gnumach-headers-boot0 mig-boot0))
-     (inputs (list gnumach-headers-boot0)))))
+     (inputs (list gnumach-headers-boot0))
+     (propagated-inputs '()))))
 
 (define/system-dependent hurd-core-headers-boot0
   ;; Return the Hurd and Mach headers as well as initial Hurd libraries for