On Tue, Apr 10, 2012 at 04:54:31PM +0200, Eelco Dolstra wrote:

> The better solution is to prevent Glibc from looking in /etc/ld.so.cache.  
> This
> is an unintended side-effect of r30069:
 
> * Build Glibc with sysconfdir set to /etc.  This causes it to look for
>   ?localtime? (the default time zone definition) in /etc rather than
>   $out/etc, allowing us to override the time zone globally in NixOS.
 
> Before this change, our Glibc looked in $out/etc/ld.so.cache, which didn't 
> exist.

Agreed, that's a much better solution. 

The attached patch makes ld.so and ldconfig use $out/etc/ld.so.cache. I've
reverted my earlier patch, and tested it out on a non-nixos system. 

--Jack 

--
Jack (John) Cummings                           http://mudshark.org/
PGP fingerprint: A927 992E 197B 0A86 27BC  964D A1DA CBAC CC48 B110
diff -r d98c64b7f68a pkgs/development/libraries/glibc/2.13/common.nix
--- a/pkgs/development/libraries/glibc/2.13/common.nix	Fri Apr 06 22:11:26 2012 -0700
+++ b/pkgs/development/libraries/glibc/2.13/common.nix	Tue Apr 10 17:16:15 2012 -0700
@@ -75,6 +75,9 @@
     /* Allow nixos and nix handle the locale-archive. */
     ./nix-locale-archive.patch
 
+    /* don't use /etc/ld.so.ccache, for non-nixos systems */
+    ./dont_use_system_ld_so_cache.patch
+
     /* Without this patch many KDE binaries crash. */
     ./glibc-elf-localscope.patch
   ] ++ stdenv.lib.optional installLocales ./catalan-firstdays.patch;
diff -r d98c64b7f68a pkgs/development/libraries/glibc/2.13/dont_use_system_ld_so_cache.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgs/development/libraries/glibc/2.13/dont_use_system_ld_so_cache.patch	Tue Apr 10 17:16:15 2012 -0700
@@ -0,0 +1,68 @@
+diff -rc glibc-2.13/elf/Makefile glibc-2.13.new/elf/Makefile
+*** glibc-2.13/elf/Makefile	Mon Jan 17 20:34:07 2011
+--- glibc-2.13.new/elf/Makefile	Tue Apr 10 15:25:20 2012
+***************
+*** 459,469 ****
+  $(objpfx)sprof: $(libdl)
+  
+  $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
+! SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
+! CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
+  		    -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
+! CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
+! CFLAGS-cache.c = $(SYSCONF-FLAGS)
+  
+  CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
+  
+--- 459,469 ----
+  $(objpfx)sprof: $(libdl)
+  
+  $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
+! PREFIX-FLAGS := -D'PREFIX="$(prefix)"'
+! CFLAGS-ldconfig.c = $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
+  		    -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
+! CFLAGS-dl-cache.c = $(PREFIX-FLAGS)
+! CFLAGS-cache.c = $(PREFIX-FLAGS)
+  
+  CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
+  
+diff -rc glibc-2.13/elf/ldconfig.c glibc-2.13.new/elf/ldconfig.c
+*** glibc-2.13/elf/ldconfig.c	Mon Jan 17 20:34:07 2011
+--- glibc-2.13.new/elf/ldconfig.c	Tue Apr 10 15:45:09 2012
+***************
+*** 51,57 ****
+  #endif
+  
+  #ifndef LD_SO_CONF
+! # define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
+  #endif
+  
+  /* Get libc version number.  */
+--- 51,57 ----
+  #endif
+  
+  #ifndef LD_SO_CONF
+! # define LD_SO_CONF PREFIX "/ld.so.conf"
+  #endif
+  
+  /* Get libc version number.  */
+diff -rc glibc-2.13/sysdeps/generic/dl-cache.h glibc-2.13.new/sysdeps/generic/dl-cache.h
+*** glibc-2.13/sysdeps/generic/dl-cache.h	Mon Jan 17 20:34:07 2011
+--- glibc-2.13.new/sysdeps/generic/dl-cache.h	Tue Apr 10 12:42:09 2012
+***************
+*** 29,35 ****
+  #endif
+  
+  #ifndef LD_SO_CACHE
+! # define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
+  #endif
+  
+  #ifndef add_system_dir
+--- 29,35 ----
+  #endif
+  
+  #ifndef LD_SO_CACHE
+! # define LD_SO_CACHE PREFIX "/ld.so.cache"
+  #endif
+  
+  #ifndef add_system_dir

Attachment: pgpCDSPtCwBh0.pgp
Description: PGP signature

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to