~ruther/guix-local

5d3db67cf61298429008110f7e0886fe44496509 — Andreas Enge 5 months ago 45d15c6
gnu: Remove glibc-2.32.

* gnu/packages/base.scm (glibc-2.32): Delete variable.
* gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch,
gnu/packages/patches/glibc-skip-c++.patch: Remove files.
* gnu/local.mk (dist_patch_DATA): Unregister files. Order glibc patches.

Fixes: guix/guix#3572
Change-Id: I8df841580c64ce0964817700a1f66da41fd5aab4
4 files changed, 9 insertions(+), 181 deletions(-)

M gnu/local.mk
M gnu/packages/base.scm
D gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch
D gnu/packages/patches/glibc-skip-c++.patch
M gnu/local.mk => gnu/local.mk +9 -11
@@ 1436,27 1436,26 @@ dist_patch_DATA =						\
  %D%/packages/patches/glib-appinfo-watch.patch			\
  %D%/packages/patches/glib-skip-failing-test.patch		\
  %D%/packages/patches/glibc-2.33-riscv64-miscompilation.patch	\
  %D%/packages/patches/glibc-2.35-CVE-2023-4911.patch	\
  %D%/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch	\
  %D%/packages/patches/glibc-2.37-versioned-locpath.patch	\
  %D%/packages/patches/glibc-2.38-ldd-x86_64.patch		\
  %D%/packages/patches/glibc-2.39-git-updates.patch	\
  %D%/packages/patches/glibc-2.40-dl-cache.patch		\
  %D%/packages/patches/glibc-2.35-CVE-2023-4911.patch	\
  %D%/packages/patches/glibc-2.41-bootstrap-system.patch	\
  %D%/packages/patches/glibc-2.41-hurd-local-clock_gettime_MONOTONIC.patch	\
  %D%/packages/patches/glibc-2.41-ldd-x86_64.patch		\
  %D%/packages/patches/glibc-allow-kernel-2.6.32.patch		\
  %D%/packages/patches/glibc-boot-2.16.0.patch			\
  %D%/packages/patches/glibc-boot-2.2.5.patch			\
  %D%/packages/patches/glibc-boot-2.16.0.patch			\
  %D%/packages/patches/glibc-bootstrap-system-2.2.5.patch 	\
  %D%/packages/patches/glibc-bootstrap-system-2.16.0.patch 	\
  %D%/packages/patches/glibc-bootstrap-system.patch		\
  %D%/packages/patches/glibc-2.41-bootstrap-system.patch	\
  %D%/packages/patches/glibc-cross-objcopy.patch		\
  %D%/packages/patches/glibc-cross-objdump.patch		\
  %D%/packages/patches/glibc-dl-cache.patch			\
  %D%/packages/patches/glibc-hidden-visibility-ldconfig.patch	\
  %D%/packages/patches/glibc-hurd-clock_gettime_monotonic.patch	\
  %D%/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch	\
  %D%/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch	\
  %D%/packages/patches/glibc-2.41-hurd-local-clock_gettime_MONOTONIC.patch	\
  %D%/packages/patches/glibc-2.37-versioned-locpath.patch	\
  %D%/packages/patches/glibc-2.38-ldd-x86_64.patch		\
  %D%/packages/patches/glibc-2.41-ldd-x86_64.patch		\
  %D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch	\
  %D%/packages/patches/glibc-hurd-getauxval.patch		\
  %D%/packages/patches/glibc-hurd-gettyent.patch		\


@@ 1472,9 1471,8 @@ dist_patch_DATA =						\
  %D%/packages/patches/glibc-ldd-x86_64.patch			\
  %D%/packages/patches/glibc-locales.patch			\
  %D%/packages/patches/glibc-reinstate-prlimit64-fallback.patch	\
  %D%/packages/patches/glibc-skip-c++.patch			\
  %D%/packages/patches/glibc-versioned-locpath.patch		\
  %D%/packages/patches/glibc-supported-locales.patch     	\
  %D%/packages/patches/glibc-versioned-locpath.patch		\
  %D%/packages/patches/gmime-disable-tests.patch		\
  %D%/packages/patches/gmp-arm-asm-nothumb.patch		\
  %D%/packages/patches/gmp-faulty-test.patch			\

M gnu/packages/base.scm => gnu/packages/base.scm +0 -55
@@ 1354,61 1354,6 @@ with the Linux kernel.")
           ;; This phase fails trying to create /etc/ld.so.cache
           (delete 'install-utf8-c-locale)))))))

(define-public glibc-2.32
  (package
    (inherit glibc-2.35)
    (version "2.32")
    (source (origin
              (inherit (package-source glibc))
              (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
              (sha256
               (base32
                "0di848ibffrnwq7g2dvgqrnn4xqhj3h96csn69q4da51ymafl9qn"))
              (patches (search-patches
                        "glibc-skip-c++.patch"
                        "glibc-ldd-powerpc.patch"
                        "glibc-ldd-x86_64.patch"
                        "glibc-dl-cache.patch"
                        "glibc-hidden-visibility-ldconfig.patch"
                        "glibc-versioned-locpath.patch"
                        "glibc-allow-kernel-2.6.32.patch"
                        "glibc-reinstate-prlimit64-fallback.patch"
                        "glibc-supported-locales.patch"
                        "glibc-hurd-clock_t_centiseconds.patch"
                        "glibc-2.31-hurd-clock_gettime_monotonic.patch"
                        "glibc-hurd-signal-sa-siginfo.patch"
                        "glibc-hurd-mach-print.patch"
                        "glibc-hurd-gettyent.patch"))
              #;
              (patches (search-patches "glibc-ldd-x86_64.patch"
                                       "glibc-hidden-visibility-ldconfig.patch"
                                       "glibc-versioned-locpath.patch"
                                       "glibc-allow-kernel-2.6.32.patch"
                                       "glibc-reinstate-prlimit64-fallback.patch"
                                       "glibc-supported-locales.patch"
                                       "glibc-hurd-clock_t_centiseconds.patch"
                                       "glibc-hurd-clock_gettime_monotonic.patch"
                                       "glibc-hurd-signal-sa-siginfo.patch"))))

    (arguments
     (substitute-keyword-arguments (package-arguments glibc)
       ((#:make-flags flags '())
        ;; Arrange so that /etc/rpc & co. go to $out/etc.
        `(list (string-append "sysconfdir="
                              (assoc-ref %outputs "out")
                              "/etc")))
       ((#:phases phases)
        `(modify-phases ,phases
           (add-before 'configure 'set-etc-rpc-installation-directory
             (lambda* (#:key outputs #:allow-other-keys)
               ;; Install the rpc data base file under `$out/etc/rpc'.
               (let ((out (assoc-ref outputs "out")))
                 (substitute* "sunrpc/Makefile"
                   (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
                    (string-append out "/etc/rpc" suffix "\n"))
                   (("^install-others =.*$")
                    (string-append "install-others = " out "/etc/rpc\n"))))))))))))

(define-public (make-gcc-libc base-gcc libc)
  "Return a GCC that targets LIBC."
  (package (inherit base-gcc)

D gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch => gnu/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch +0 -84
@@ 1,84 0,0 @@
This is needed to run Python on the Hurd, especially during the build of
python-boot0.

Adapted from https://salsa.debian.org/glibc-team/glibc/-/blob/glibc-2.31/debian/patches/hurd-i386/unsubmitted-clock_t_centiseconds.diff

Use the realtime clock for the monotonic clock. This is of course not a proper
implementation (which is being done in Mach), but will permit to fix at least
the iceweasel stack.

vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disable the
former.

From 0aa1dfd580cf9ad7b812c307b128decb782b825f Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Mon, 2 Mar 2020 18:59:04 +0100
Subject: [PATCH 2/2] Use realtime clock for the monotonic clock.

---
 sysdeps/mach/clock_gettime.c       | 2 +-
 sysdeps/mach/hurd/bits/posix_opt.h | 6 +++---
 sysdeps/posix/clock_getres.c       | 1 +
 sysdeps/pthread/timer_create.c     | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sysdeps/mach/clock_gettime.c b/sysdeps/mach/clock_gettime.c
index ac3547df3c..af8681ba4e 100644
--- a/sysdeps/mach/clock_gettime.c
+++ b/sysdeps/mach/clock_gettime.c
@@ -25,7 +25,7 @@
 int
 __clock_gettime (clockid_t clock_id, struct timespec *ts)
 {
-  if (clock_id != CLOCK_REALTIME)
+  if (clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_REALTIME)
     {
       errno = EINVAL;
       return -1;
diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 0050151332..27b3a28ab7 100644
--- a/sysdeps/mach/hurd/bits/posix_opt.h
+++ b/sysdeps/mach/hurd/bits/posix_opt.h
@@ -163,10 +163,10 @@
 #define _POSIX_THREAD_PROCESS_SHARED	-1
 
 /* The monotonic clock might be available.  */
-#define _POSIX_MONOTONIC_CLOCK	0
+#define _POSIX_MONOTONIC_CLOCK	200809L
 
-/* The clock selection interfaces are available.  */
-#define _POSIX_CLOCK_SELECTION	200809L
+/* The clock selection interfaces are not really available yet.  */
+#define _POSIX_CLOCK_SELECTION	-1
 
 /* Advisory information interfaces could be available in future.  */
 #define _POSIX_ADVISORY_INFO	0
diff --git a/sysdeps/posix/clock_getres.c b/sysdeps/posix/clock_getres.c
index fcd79fd554..1dd02aa449 100644
--- a/sysdeps/posix/clock_getres.c
+++ b/sysdeps/posix/clock_getres.c
@@ -52,6 +52,7 @@ __clock_getres (clockid_t clock_id, struct timespec *res)
   switch (clock_id)
     {
     case CLOCK_REALTIME:
+    case CLOCK_MONOTONIC:
       retval = realtime_getres (res);
       break;
 
diff --git a/sysdeps/pthread/timer_create.c b/sysdeps/pthread/timer_create.c
index 9d8a9ea8ae..3430582c09 100644
--- a/sysdeps/pthread/timer_create.c
+++ b/sysdeps/pthread/timer_create.c
@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)
       return -1;
     }
 
-  if (clock_id != CLOCK_REALTIME)
+  if (clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC)
     {
       __set_errno (EINVAL);
       return -1;
-- 
2.24.0


D gnu/packages/patches/glibc-skip-c++.patch => gnu/packages/patches/glibc-skip-c++.patch +0 -31
@@ 1,31 0,0 @@
When building, say, glibc 2.31 using a compiler that's itself linked
against 2.33, linking fails with:

  gcc -Wl,-rpath-link=/tmp/guix-build-glibc-2.31.drv-0/build:/tmp/guix-build-glibc-2.31.drv-0/build/math:/tmp/guix-build-glibc-2.31.drv-0/build/elf:/tmp/guix-build-glibc-2.31.drv-0/build/dlfcn:/tmp/guix-build-glibc-2.31.drv-0/build/nss:/tmp/guix-build-glibc-2.31.drv-0/build/nis:/tmp/guix-build-glibc-2.31.drv-0/build/rt:/tmp/guix-build-glibc-2.31.drv-0/build/resolv:/tmp/guix-build-glibc-2.31.drv-0/build/mathvec:/tmp/guix-build-glibc-2.31.drv-0/build/support:/tmp/guix-build-glibc-2.31.drv-0/build/crypt:/tmp/guix-build-glibc-2.31.drv-0/build/nptl -nostdlib -nostartfiles -o /tmp/guix-build-glibc-2.31.drv-0/build/support/links-dso-program    -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both /tmp/guix-build-glibc-2.31.drv-0/build/csu/crt1.o /tmp/guix-build-glibc-2.31.drv-0/build/csu/crti.o `gcc  --print-file-name=crtbegin.o` /tmp/guix-build-glibc-2.31.drv-0/build/support/links-dso-program.o -lstdc++ -lgcc -lgcc_s  -Wl,-dynamic-linker=/gnu/store/...-glibc-2.31/lib/ld-linux-x86-64.so.2  /tmp/guix-build-glibc-2.31.drv-0/build/libc.so.6 /tmp/guix-build-glibc-2.31.drv-0/build/libc_nonshared.a -Wl,--as-needed /tmp/guix-build-glibc-2.31.drv-0/build/elf/ld.so -Wl,--no-as-needed -lgcc  `gcc  --print-file-name=crtend.o` /tmp/guix-build-glibc-2.31.drv-0/build/csu/crtn.o
  ld: /gnu/store/...-gcc-10.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../../libstdc++.so: undefined reference to `fstat64@GLIBC_2.33'
  ld: /gnu/store/...-gcc-10.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../../libstdc++.so: undefined reference to `lstat@GLIBC_2.33'
  ld: /gnu/store/...-gcc-10.3.0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../../libstdc++.so: undefined reference to `stat@GLIBC_2.33'
  collect2: error: ld returned 1 exit status

This is unsurprising given that libstdc++.so here is linked against 2.33,
whereas libc.so.6 here is 2.31.

This patch works around it by not building the offending program.

diff --git a/support/Makefile b/support/Makefile
index bb9889ef..6614943b 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -210,12 +210,7 @@ CFLAGS-support_paths.c = \
 # -fexcess-precision=standard.
 CFLAGS-timespec.c += -fexcess-precision=standard
 
-ifeq (,$(CXX))
 LINKS_DSO_PROGRAM = links-dso-program-c
-else
-LINKS_DSO_PROGRAM = links-dso-program
-LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
-endif
 
 ifeq (yes,$(have-selinux))
 LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux