From 764390aaddda08e7020c30358e738bca9ed2e5d4 Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Wed, 17 Aug 2016 22:26:42 -0700 Subject: [PATCH 1/2] Document 'w' CCCFG flag --- Library/Homebrew/extend/ENV/super.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index ff7e5b4755f1a..7361dba0b3b61 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -78,6 +78,7 @@ def setup_build_environment(formula = nil) # g - Enable "-stdlib=libc++" for clang. # h - Enable "-stdlib=libstdc++" for clang. # K - Don't strip -arch , -m32, or -m64 + # w - Pass -no_weak_imports to the linker # # On 10.8 and newer, these flags will also be present: # s - apply fix for sed's Unicode support From 9c7f24b84aea4ae1b465afa41445385ada4f2ffb Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Wed, 17 Aug 2016 22:55:16 -0700 Subject: [PATCH 2/2] Add permit_weak_imports directive Issue Homebrew/homebrew-core#3727 suggested we set -no_weak_imports for new versions of Xcode to ensure that e.g. building on 10.11 against the 10.12 SDK doesn't result in a situation where autotools thinks symbols exist that don't actually exist on the current platform. Further discussion in golang/go#16770 revealed that some packages require weak imports to build normally. --- Library/Homebrew/extend/ENV/shared.rb | 2 ++ Library/Homebrew/extend/os/mac/extend/ENV/std.rb | 4 ++++ Library/Homebrew/extend/os/mac/extend/ENV/super.rb | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index c253942ac6be4..c3bd9830a3790 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -293,6 +293,8 @@ def warn_about_non_apple_gcc(name) def permit_arch_flags; end + def permit_weak_imports; end + private def cc=(val) diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb index d9cabc50e4842..21c375a7682a2 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb @@ -146,4 +146,8 @@ def x11 append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed? end + + def permit_weak_imports + remove "LDFLAGS", "-Wl,-no_weak_imports" + end end diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index e482020e85177..188008b1f0887 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -107,6 +107,10 @@ def set_x11_env_if_installed ENV.x11 = MacOS::X11.installed? end + def permit_weak_imports + remove "HOMEBREW_CCCFG", "w" + end + # These methods are no longer necessary under superenv, but are needed to # maintain an interface compatible with stdenv. alias_method :macosxsdk, :noop