From b9a4da47c0f08ae17c8892a98df276036f720520 Mon Sep 17 00:00:00 2001 From: Michael Stone Date: Fri, 26 Aug 2016 03:36:06 -0400 Subject: [PATCH] go: fix on darwin, make go-1.7 build with clang-3.8. (#18001) The darwin stdenv currently provides clang-3.7; however, a) go-1.7 currently expects a compiler that supports "-fdebug-prefix-map" arguments (which clang-3.8 supports but clang-3.7 does not) and b) even with clang-3.8, go-1.7 misinterprets the result of its runtime probes for support for the "-no-pie" flag, thereby failing to build runtime/cgo. This patch resolves (a) by building go-1.7 with clang-3.8 and resolves (b) by teaching go how to correctly probe "-no-pie" error messages from clang. --- pkgs/development/compilers/go/1.7.nix | 3 +++ pkgs/top-level/all-packages.nix | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/go/1.7.nix b/pkgs/development/compilers/go/1.7.nix index 61d6a5e8391..25ae26f2818 100644 --- a/pkgs/development/compilers/go/1.7.nix +++ b/pkgs/development/compilers/go/1.7.nix @@ -98,6 +98,9 @@ stdenv.mkDerivation rec { sed -i '/TestDisasmExtld/areturn' src/cmd/objdump/objdump_test.go + sed -i 's/unrecognized/unknown/' src/cmd/link/internal/ld/lib.go + sed -i 's/unrecognized/unknown/' src/cmd/go/build.go + touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd sed -i '1 a\exit 0' misc/cgo/errors/test.bash diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4c9f8dc5ca3..66f1667dc32 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4738,9 +4738,11 @@ in inherit (darwin.apple_sdk.frameworks) Security Foundation; }; - go_1_7 = callPackage ../development/compilers/go/1.7.nix { + go_1_7 = callPackage ../development/compilers/go/1.7.nix ({ inherit (darwin.apple_sdk.frameworks) Security Foundation; - }; + } // stdenv.lib.optionalAttrs stdenv.isDarwin { + stdenv = stdenvAdapters.overrideCC pkgs.stdenv pkgs.clang_38; + }); go = self.go_1_7;