C++ stdlibs: issue warning, don't fail the build

This commit is contained in:
Misty De Meo 2014-02-02 02:12:57 -08:00
parent edf474cb63
commit d885d98164
3 changed files with 15 additions and 15 deletions

View File

@ -168,13 +168,15 @@ class Build
# want to record the stdlib for something that installs no # want to record the stdlib for something that installs no
# dylibs. # dylibs.
stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs
# It's technically possible for the same lib to link to multiple # This currently only tracks a single C++ stdlib per dep,
# C++ stdlibs, but very bad news. Right now we don't track this # though it's possible for different libs/executables in
# woeful scenario. # a given formula to link to different ones.
stdlib_in_use = CxxStdlib.new(stdlibs.first, ENV.compiler) stdlib_in_use = CxxStdlib.new(stdlibs.first, ENV.compiler)
# This will raise and fail the build if there's an begin
# incompatibility.
stdlib_in_use.check_dependencies(f, deps) stdlib_in_use.check_dependencies(f, deps)
rescue IncompatibleCxxStdlibs => e
opoo e.message
end
# This second check is recorded for checking dependencies, # This second check is recorded for checking dependencies,
# so executable are irrelevant at this point. If a piece # so executable are irrelevant at this point. If a piece

View File

@ -115,14 +115,8 @@ end
class IncompatibleCxxStdlibs < Homebrew::InstallationError class IncompatibleCxxStdlibs < Homebrew::InstallationError
def initialize(f, dep, wrong, right) def initialize(f, dep, wrong, right)
super f, <<-EOS.undent super f, <<-EOS.undent
#{f} dependency #{dep} was built with the following #{f} dependency #{dep} was built with a different C++ standard
C++ standard library: #{wrong.type_string} (from #{wrong.compiler}) library (#{wrong.type_string} from #{wrong.compiler}). This could cause problems at runtime.
This is incompatible with the standard library being used
to build #{f}: #{right.type_string} (from #{right.compiler})
Please reinstall #{dep} using a compatible compiler.
hint: Check https://github.com/Homebrew/homebrew/wiki/C++-Standard-Libraries
EOS EOS
end end
end end

View File

@ -123,7 +123,11 @@ class FormulaInstaller
stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs
stdlib_in_use = CxxStdlib.new(stdlibs.first, MacOS.default_compiler) stdlib_in_use = CxxStdlib.new(stdlibs.first, MacOS.default_compiler)
begin
stdlib_in_use.check_dependencies(f, f.recursive_dependencies) stdlib_in_use.check_dependencies(f, f.recursive_dependencies)
rescue IncompatibleCxxStdlibs => e
opoo e.message
end
stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs :skip_executables => true stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs :skip_executables => true
tab = Tab.for_keg f.prefix tab = Tab.for_keg f.prefix