Skip to content

Instantly share code, notes, and snippets.

@alloy
Last active August 29, 2015 13:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alloy/9857708 to your computer and use it in GitHub Desktop.
Save alloy/9857708 to your computer and use it in GitHub Desktop.
Fix system Ruby (2.0.0) on OS X 10.9.

Fix Apple's mess. They built Ruby in a custom way that has lead to these options not containing the original commas anymore, which when combined with the change they made to clang (in Xcode 5.1) to error out on unrecognized options leads to failing builds.

This is what a typical build failure will look like:

clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [foo.bundle] Error 1

To fix this, apply the patch like so (or manually download the patch):

$ curl -O https://gist.githubusercontent.com/alloy/9857708/raw/bd693fdf88b9c15a5667ca7a3d338c61edd674ff/osx-10.9-ruby-2.0.0-config-fix.diff
$ sudo patch /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb osx-10.9-ruby-2.0.0-config-fix.diff
patching file /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb
--- rbconfig.rb.osx-orig 2014-03-29 17:26:53.000000000 +0100
+++ rbconfig.rb 2014-03-29 17:32:26.000000000 +0100
@@ -122,7 +122,7 @@
CONFIG["CCDLFLAGS"] = ""
CONFIG["STATIC"] = ""
CONFIG["ARCH_FLAG"] = arch_flag || " #{arch_flag} "
- CONFIG["DLDFLAGS"] = "-undefineddynamic_lookup -multiply_definedsuppress"
+ CONFIG["DLDFLAGS"] = "-undefined dynamic_lookup -multiply_defined suppress"
CONFIG["ALLOCA"] = ""
CONFIG["codesign"] = "codesign"
CONFIG["POSTLINK"] = "test -z '$(RUBY_CODESIGN)' || codesign -s '$(RUBY_CODESIGN)' -f $@"
@sharplet
Copy link

Looks like the line starting with CONFIG["LIBRUBY_DLDFLAGS"] (i.e., L82) needs patching in the same way.

@alloy
Copy link
Author

alloy commented May 23, 2014

@sharplet While it has the same issue indeed, it’s afaik not used for anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment