diff options
author | Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> | 2015-08-21 02:12:27 +0300 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-10-03 14:08:51 +0200 |
commit | 0100b270694ecab8aaa13fa5f3d30639b50d7777 (patch) | |
tree | fae6ca03b0d5f9b68cd85a1f4e3a93cf39c72c6a /pkgs/servers | |
parent | 0054c8aa5a6bed9763cca4e130bae618120491f4 (diff) | |
download | nixlib-0100b270694ecab8aaa13fa5f3d30639b50d7777.tar nixlib-0100b270694ecab8aaa13fa5f3d30639b50d7777.tar.gz nixlib-0100b270694ecab8aaa13fa5f3d30639b50d7777.tar.bz2 nixlib-0100b270694ecab8aaa13fa5f3d30639b50d7777.tar.lz nixlib-0100b270694ecab8aaa13fa5f3d30639b50d7777.tar.xz nixlib-0100b270694ecab8aaa13fa5f3d30639b50d7777.tar.zst nixlib-0100b270694ecab8aaa13fa5f3d30639b50d7777.zip |
imake: Add uberhack to workaround broken 'gcc -x c'
Our cc-wrapper is broken whenever the '-x' flag is used: 'gcc -x c foo.c -o bar' doesn't work the same way as 'gcc foo.c -o bar' does. (Try both with NIX_DEBUG=1.) What happens is that passing '-x' causes linker-related flags (such as -Wl,-dynamic-linker) not to be added, just like if '-c' is passed. The bug happens outside the multiple-outputs branch as well, but it doesn't break imake there. It only breaks in multiple-outputs because linking without -Wl,-dynamic-linker produces a binary with an invalid ELF interpreter path. (Which arguably, is a bug in its own.)
Diffstat (limited to 'pkgs/servers')
-rw-r--r-- | pkgs/servers/x11/xorg/imake-cc-wrapper-uberhack.patch | 13 | ||||
-rw-r--r-- | pkgs/servers/x11/xorg/overrides.nix | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/pkgs/servers/x11/xorg/imake-cc-wrapper-uberhack.patch b/pkgs/servers/x11/xorg/imake-cc-wrapper-uberhack.patch new file mode 100644 index 000000000000..fe079eeb42a7 --- /dev/null +++ b/pkgs/servers/x11/xorg/imake-cc-wrapper-uberhack.patch @@ -0,0 +1,13 @@ +diff --git a/imake.c b/imake.c +index c20cd4a..ec2589b 100644 +--- a/imake.c ++++ b/imake.c +@@ -959,7 +959,7 @@ get_libc_version(FILE *inFile) + { + char aout[4096], *tmpdir; + FILE *fp; +- const char *format = "%s -o %s -x c -"; ++ const char *format = "f=$(mktemp imakeXXXXXX.c); cat > $f; %s $f -o %s"; + char *cc; + int len; + char *command; diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 607023f6f8e7..bbd78c886cf1 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -48,7 +48,7 @@ in imake = attrs: attrs // { inherit (xorg) xorgcffiles; x11BuildHook = ./imake.sh; - patches = [./imake.patch]; + patches = [./imake.patch ./imake-cc-wrapper-uberhack.patch]; setupHook = if stdenv.isDarwin then ./darwin-imake-setup-hook.sh else null; CFLAGS = [ "-DIMAKE_COMPILETIME_CPP=\\\"${if stdenv.isDarwin then "${args.tradcpp}/bin/cpp" |