Files
Jörg Thalheim bbffe120eb glibc: fix darwin-cross-build.patch for glibc 2.42
The darwin-cross-build.patch failed to apply when cross-compiling glibc.

Regenerate the patch against glibc 2.42 sources. Also extend the
patch to cover the 'check xcheck test' target which was previously
unpatched but needs the same ulimit and AR fixes for consistency.

Tested: nix build --file . pkgsCross.aarch64-multiplatform.glibc
Tested: nix build --file . pkgsCross.gnu64.glibc
2026-01-26 19:31:47 +01:00

92 lines
3.5 KiB
Diff

enable cross-compilation of glibc on Darwin (build=Darwin, host=Linux)
* increase ulimit for open files: macOS default of 256 is too low for glibc build system
* use host version of ar, which is given by environment variable
* build system uses stamp.os and stamp.oS files, which only differ in case;
this fails on macOS, so replace .oS with .o_S
--- a/Makefile.in 2026-01-26 09:08:32.283335000 +0100
+++ b/Makefile.in 2026-01-26 09:08:44.281448649 +0100
@@ -17,10 +17,12 @@
.PHONY: all install bench
all .DEFAULT:
- $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
+ ulimit -n 1024; \
+ $(MAKE) -r AR=$$AR PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
check xcheck test:
- $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) \
+ ulimit -n 1024; \
+ $(MAKE) -r AR=$$AR PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) \
CC="$(TEST_CC)" CXX="$(TEST_CXX)" \
cc-option-wimplicit-fallthrough="$(test-cc-option-wimplicit-fallthrough)" \
config-cflags-mprefer-vector-width="$(test-config-cflags-mprefer-vector-width)" \
@@ -33,8 +35,9 @@
objdir=`pwd` $@
install:
+ ulimit -n 1024; \
LC_ALL=C; export LC_ALL; \
- $(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
+ $(MAKE) -r AR=$$AR PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
bench bench-clean bench-build:
$(MAKE) -C $(srcdir)/benchtests $(PARALLELMFLAGS) objdir=`pwd` $@
--- a/Makerules 2026-01-26 09:08:32.283426000 +0100
+++ b/Makerules 2026-01-26 09:09:20.363730545 +0100
@@ -804,8 +804,8 @@
ifndef objects
# Create the stamp$o files to keep the parent makefile happy.
-subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
-$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o):
+subdir_lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o))
+$(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o)):
$(make-target-directory)
rm -f $@; > $@
else
@@ -816,7 +816,7 @@
# The parent will then actually add them all to the archive in the
# archive rule, below.
define o-iterator-doit
-$(objpfx)stamp$o: $(o-objects); $$(do-stamp)
+$(objpfx)stamp$(subst .oS,.o_S,$o): $(o-objects); $$(do-stamp)
endef
define do-stamp
$(make-target-directory)
@@ -832,14 +832,14 @@
# on the stamp files built above.
define o-iterator-doit
$(common-objpfx)$(patsubst %,$(libtype$o),c): \
- $(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
+ $(subdirs-stamp-o) $(common-objpfx)stamp$(subst .oS,.o_S,$o); $$(do-makelib)
endef
define do-makelib
cd $(common-objdir) && \
$(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
endef
subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
-subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
+subdirs-stamp-o = $(subst %,$(subst .oS,.o_S,$o),$(subdirs-stamps))
ifndef subdir
$(subdirs-stamps): subdir_lib;
endif
@@ -850,7 +850,7 @@
# This makes all the object files.
.PHONY: objects objs libobjs extra-objs
objects objs: libobjs extra-objs
-libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
+libobjs: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$(subst .oS,.o_S,$o))
extra-objs: $(addprefix $(objpfx),$(extra-objs))
# Canned sequence for building an extra library archive.
@@ -1366,7 +1366,7 @@
$(rmobjs)
define rmobjs
$(foreach o,$(object-suffixes-for-libc),
--rm -f $(objpfx)stamp$o $(o-objects))
+-rm -f $(objpfx)stamp$(subst .oS,.o_S,$o) $(o-objects))
endef
# Also remove the dependencies and generated source files.