[Nix-dev] Nix inside of Red Hat Linux a.k.a. glibc 2.5 support

Peter Simons simons at cryp.to
Tue Jun 23 23:26:39 CEST 2009


Hi,

the Red Hat kernel contains non-standard patches that break glibc from
version 2.6 on insofar as that it over-estimates the kernel's
capabilities. This phenomenon leads to unpleasant malfunctions, i.e. in
coreutils and bash.

The only way to work around the problem appears to be to downgrade the
installation to glibc 2.5. In Nixpkgs 0.12 this used to work fine, but
my attempts to build stdenv-updates with glibc 2.5 were unsuccessful.

With the following patch applied

  --- a/pkgs/top-level/all-packages.nix
  +++ b/pkgs/top-level/all-packages.nix
  @@ -3028,7 +3028,12 @@ let
       inherit fetchurl stdenv pkgconfig gettext;
     };

  -  glibc = useFromStdenv "glibc" glibc29;
  +  glibc = useFromStdenv "glibc" glibc25;
  +
  +  glibc25 = import ../development/libraries/glibc-2.5 {
  +    inherit fetchurl stdenv kernelHeaders;
  +    installLocales = getPkgConfig "glibc" "locales" false;
  +  };

     glibc27 = import ../development/libraries/glibc-2.7 {
       inherit fetchurl stdenv kernelHeaders;

"nix-env -i -A nixUnstable" begins the bootstrapping process by
compiling glibc 2.5, but the package doesn't pass the ./configure phase:

  [...]
  checking for unistd.h... yes
  checking for long double... yes
  checking size of long double... configure: error: cannot compute sizeof (long double), 77
  See `config.log' for more details.
  builder for `/nix/store/f04zbn1m4cc587x7l2jl9b2r2f4wjnsb-glibc-2.5.drv' failed with exit code 1
  cannot build derivation `/nix/store/sz0mv3paqzna8138q9cy1pggwjl9xsbk-gcc-wrapper-4.3.3.drv': 1 dependencies couldn't be built
  cannot build derivation `/nix/store/7b3iwgrwzw3i9kmi7nf49jcm0p7p6rrg-gcc-wrapper-4.3.3.drv': 1 dependencies couldn't be built
  cannot build derivation `/nix/store/lkv0kn9my7xl1a3p2qq7k6vlmbhbqw06-stdenv-linux.drv': 1 dependencies couldn't be built
  cannot build derivation `/nix/store/a28w5z5wzl24h2010h2ghj1r3j5ha69s-nix-0.13pre15214.drv': 1 dependencies couldn't be built
  error: build of `/nix/store/a28w5z5wzl24h2010h2ghj1r3j5ha69s-nix-0.13pre15214.drv' failed

The configure script calls "AC_CHECK_SIZEOF(long double, 0)". That macro
tries to compile and run a small test program, but fails because
libc.so.6 cannot be found:

  configure:7235: $? = 0
  configure:7238: test -s conftest.o
  configure:7241: $? = 0
  configure:7252: result: yes
  configure:7255: checking size of long double
  configure:7574: gcc -o conftest -g -O2   conftest.c  >&5
  configure:7577: $? = 0
  configure:7579: ./conftest
  ./conftest: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
  configure:7582: $? = 127
  configure: program exited with status 127
  configure: failed program was:
  | /* confdefs.h.  */
  |
  | [...]
  |
  | long longval () { return (long) (sizeof (long double)); }
  | unsigned long ulongval () { return (long) (sizeof (long double)); }
  | #include <stdio.h>
  | #include <stdlib.h>
  | int
  | main ()
  | {
  |
  |   FILE *f = fopen ("conftest.val", "w");
  |   if (! f)
  |     exit (1);
  |   if (((long) (sizeof (long double))) < 0)
  |     {
  |       long i = longval ();
  |       if (i != ((long) (sizeof (long double))))
  | 	exit (1);
  |       fprintf (f, "%ld\n", i);
  |     }
  |   else
  |     {
  |       unsigned long i = ulongval ();
  |       if (i != ((long) (sizeof (long double))))
  | 	exit (1);
  |       fprintf (f, "%lu\n", i);
  |     }
  |   exit (ferror (f) || fclose (f) != 0);
  |
  |   ;
  |   return 0;
  | }
  configure:7592: error: cannot compute sizeof (long double), 77

What baffles me is that glibc 2.9 performs the exact same test and
succeeds!

Can someone please help me figure out how to fix this problem?

I guess it would be possible to set LD_LIBRARY_PATH -- there *is* a
libc.so.6 in the build inputs, after all --, but I wonder whether there
is a better solution? Apparently this has been solved for 2.9?

Take care,
Peter




More information about the nix-dev mailing list