From c7f337177e7712c4a5679cfb85fbe9d37371163a Mon Sep 17 00:00:00 2001 From: danielnachun Date: Tue, 9 Feb 2021 20:32:34 -0800 Subject: [PATCH] cc: prepend gcc libs to args when gcc is a dependency --- Library/Homebrew/shims/super/cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc index 3ee05771f7..277772b3f8 100755 --- a/Library/Homebrew/shims/super/cc +++ b/Library/Homebrew/shims/super/cc @@ -303,6 +303,12 @@ class Cmd end def ldflags_linux(args) + # Remove $HOMEBREW_PREFIX/lib from the args because it is already provided by the GCC specs, + # and breaks linkage to GCC runtime libraries. + # Don't remove it when using clang, which does not use specs like GCC does. + # https://github.com/Homebrew/brew/pull/10606 + args.pop() if tool !~ /^clang/ + unless mode == :ld wl = "-Wl," args << "-B#{@opt}/glibc/lib"