1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 05:00:16 +00:00

Define "brokenRedHatKernel = true" in $NIXPKGS_CONFIG to build a system that

works on Red Hat Linux, i.e. that is based on glibc version 2.5.

Furthermore, this patch fixes a number of gcc 4.3.3 build errors in glibc 2.5
that occur on both x86 and x86_64. The older version of this library is still
useful for running Nix on a Red Hat host. Newer version of glibc fail to detect
the kernel's capabilities correctly (due to mad patches applied to the kernel
by Red Hat).

The individual changes are:

 * Re-activated glibc 2.5 in all-packages.nix.

 * Fix incomplete header search path in bootstrap tools.

   Gcc-wrapper sets "-B<prefix>" to tell the compiler about its installation
   root. Unfortunately, the setting doesn't add $gcc/lib/gcc/*/*/include-fixed
   to the search path. That directory is required, however, because it contains
   the system-specific "limits.h" file, and the glibc 2.5 builds tries to find
   that file via #include_next.

 * Support intrinsic functions like __signbit() or atof() correctly to avoid
   compile-time conflicts.

 * Switch to NPTL. Linuxthreads is no longer supported.

 * Added a meta attribute to glibc package.

 * Updated nixUnstable to version 0.13pre15614 from trunk. The previous version
   failed regression tests.

 * Fix more strict type checking in binutils since 2.18.50.0.3.

   Without this patch, the build failed on x86, saying:

     ../sysdeps/i386/fpu/ftestexcept.c: Assembler messages:
     ../sysdeps/i386/fpu/ftestexcept.c:33: Error: suffix or operands invalid for `fnstsw'

svn path=/nixpkgs/branches/stdenv-updates/; revision=16037
This commit is contained in:
Peter Simons 2009-06-24 20:10:51 +00:00
parent 8f0f5c403d
commit 7534cbe4b8
7 changed files with 1890 additions and 30 deletions

View file

@ -17,8 +17,15 @@ if test -z "$nativeLibc"; then
# against the crt1.o from our own glibc, rather than the one in
# /usr/lib. (This is only an issue when using an `impure'
# compiler/linker, i.e., one that searches /usr/lib and so on.)
echo "-B$libc/lib/ -idirafter $libc/include" > $out/nix-support/libc-cflags
#
# Unfortunately, setting -B appears to override the default search
# path. Thus, the gcc-specific "../includes-fixed" directory is
# now longer searched and glibc's <limits.h> header fails to
# compile, because it uses "#include_next <limits.h>" to find the
# limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again.
echo "-B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib" > $out/nix-support/libc-ldflags
# The dynamic linker is passed in `ldflagsBefore' to allow

View file

@ -1,6 +1,5 @@
# glibc cannot have itself in its rpath.
export NIX_NO_SELF_RPATH=1
export NIX_DONT_SET_RPATH=1
source $stdenv/setup
@ -9,17 +8,12 @@ export PWD_P=$(type -tP pwd)
postUnpack() {
cd $sourceRoot
unpackFile $linuxthreadsSrc
cd ..
cd $sourceRoot/..
}
preConfigure() {
# Use Linuxthreads instead of NPTL.
rm -rf nptl
for i in configure io/ftwtest-sh; do
substituteInPlace "$i" \
--replace "@PWD@" "pwd"
@ -27,7 +21,7 @@ preConfigure() {
mkdir ../build
cd ../build
configureScript=../$sourceRoot/configure
}
@ -38,6 +32,7 @@ postConfigure() {
# test binaries.
export NIX_CFLAGS_LINK=
export NIX_LDFLAGS_BEFORE=
export NIX_DONT_SET_RPATH=1
}
@ -48,11 +43,6 @@ postInstall() {
rm $out/etc/ld.so.cache
(cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
# Workaround for the wrong <semaphore.h> getting installed. This
# appears to be a regression:
# http://www.mail-archive.com/debian-glibc@lists.debian.org/msg31543.html
cp ../$sourceRoot/linuxthreads/semaphore.h $out/include
# Fix for NIXOS-54 (ldd not working on x86_64). Make a symlink
# "lib64" to "lib".
if test -n "$is64bit"; then

View file

@ -12,22 +12,26 @@ stdenv.mkDerivation {
md5 = "1fb29764a6a650a4d5b409dda227ac9f";
};
linuxthreadsSrc = fetchurl {
url = http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.5.tar.bz2;
md5 = "870d76d46dcaba37c13d01dca47d1774";
};
patches = [ ./glibc-pwd.patch ./glibc-getcwd-param-MAX.patch ];
patches = [ ./glibc-pwd.patch ./glibc-getcwd-param-MAX.patch ./glibc-inline.patch ./x86-fnstsw.patch ];
inherit kernelHeaders installLocales;
inherit (stdenv) is64bit;
# `--with-tls --without-__thread' enables support for TLS but causes
# it not to be used. Required if we don't want to barf on 2.4
# kernels. Or something.
configureFlags="--enable-add-ons
--with-headers=${kernelHeaders}/include
--with-tls --without-__thread --disable-sanity-checks
--disable-sanity-checks
${if profilingLibraries then "--enable-profile" else "--disable-profile"}";
# Workaround for this bug:
# http://sourceware.org/bugzilla/show_bug.cgi?id=411
# I.e. when gcc is compiled with --with-arch=i686, then the
# preprocessor symbol `__i686' will be defined to `1'. This causes
# the symbol __i686.get_pc_thunk.dx to be mangled.
NIX_CFLAGS_COMPILE = "-U__i686";
meta = {
homepage = http://www.gnu.org/software/libc/;
description = "The GNU C Library";
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: package/.../glibc/x86-fnstsw.patch
# Copyright (C) 2008 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
Fix more strict checking in binutils since 2.18.50.0.3:
sysdeps/i386/fpu/ftestexcept.c:33: Error: suffix or operands invalid for `fnstsw'
- Rene Rebe <rene@exactcode.de>
--- glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c.vanilla 2008-09-02 12:45:07.000000000 +0200
+++ glibc-2.6.1/sysdeps/i386/fpu/ftestexcept.c 2008-09-02 12:46:37.000000000 +0200
@@ -26,7 +26,7 @@
int
fetestexcept (int excepts)
{
- int temp;
+ short temp;
int xtemp = 0;
/* Get current exceptions. */

View file

@ -4,12 +4,12 @@
, supportOldDBs ? true
}:
stdenv.mkDerivation {
name = "nix-0.13pre15214";
stdenv.mkDerivation rec {
name = "nix-0.13pre15614";
src = fetchurl {
url = http://hydra.nixos.org/build/17407/download/1/nix-0.13pre15214.tar.bz2;
sha256 = "b2423eebb0c70fa2c38d11b5d5e6d8794ebc7283dfde8d1f1c02c54846014ab2";
url = "http://hydra.nixos.org/build/32581/download/4/${name}.tar.bz2";
sha256 = "236c84cf85739fe1deddd8f98f634eac03df9c7a588f4c1e234e80e84a471d00";
};
buildInputs = [perl curl openssl];

View file

@ -3028,7 +3028,12 @@ let
inherit fetchurl stdenv pkgconfig gettext;
};
glibc = useFromStdenv "glibc" glibc29;
glibc = useFromStdenv "glibc" (if getConfig ["brokenRedHatKernel"] false then glibc25 else glibc29);
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;