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

View File

@ -115,14 +115,8 @@ end
class IncompatibleCxxStdlibs < Homebrew::InstallationError
def initialize(f, dep, wrong, right)
super f, <<-EOS.undent
#{f} dependency #{dep} was built with the following
C++ standard library: #{wrong.type_string} (from #{wrong.compiler})
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
#{f} dependency #{dep} was built with a different C++ standard
library (#{wrong.type_string} from #{wrong.compiler}). This could cause problems at runtime.
EOS
end
end

View File

@ -123,7 +123,11 @@ class FormulaInstaller
stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs
stdlib_in_use = CxxStdlib.new(stdlibs.first, MacOS.default_compiler)
begin
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
tab = Tab.for_keg f.prefix