-
-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing Nokogiri 1.6.2 fails on Mac with Xcode 5.1 #1101
Comments
This is a problem with the stock ruby rbconfig.rb file. I removed it from mine and things are MOSTLY building fine: --- /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb 2014-04-22 22:27:52.000000000 -0700
+++ /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb~ 2013-10-30 23:18:46.000000000 -0700
@@ -15,7 +15,7 @@
CONFIG["MAJOR"] = "2"
CONFIG["MINOR"] = "0"
CONFIG["TEENY"] = "0"
- CONFIG["PATCHLEVEL"] = "451"
+ CONFIG["PATCHLEVEL"] = "247"
CONFIG["INSTALL"] = '/usr/bin/install -c'
CONFIG["EXEEXT"] = ""
CONFIG["prefix"] = (TOPDIR || DESTDIR + "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr")
@@ -37,7 +37,7 @@
CONFIG["rubyhdrdir"] = "$(includedir)/$(RUBY_VERSION_NAME)"
CONFIG["UNIVERSAL_INTS"] = "'long long' long int short"
CONFIG["UNIVERSAL_ARCHNAMES"] = universal
- CONFIG["configure_args"] = " '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--prefix=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr' '--sysconfdir=/Library/Ruby/Site' '--with-sitedir=/Library/Ruby/Site' '--enable-shared' '--with-arch=x86_64,i386' '--with-bundled-md5' '--with-bundled-sha1' '--with-bundled-sha2' '--with-bundled-rmd160' 'ac_cv_func_getcontext=no' 'ac_cv_func_setcontext=no' 'ac_cv_c_compiler_gnu=no' 'rb_cv_pri_prefix_long_long=ll' 'CC=xcrun clang' 'CFLAGS=-arch x86_64 -arch i386 -g -Os -pipe ' 'LDFLAGS=-arch x86_64 -arch i386 ' 'CXX=xcrun clang++' 'CXXFLAGS=-arch x86_64 -arch i386 -g -Os -pipe '"
+ CONFIG["configure_args"] = " '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--prefix=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr' '--sysconfdir=/Library/Ruby/Site' '--with-sitedir=/Library/Ruby/Site' '--enable-shared' '--with-arch=x86_64,i386' 'ac_cv_func_getcontext=no' 'ac_cv_func_setcontext=no' 'ac_cv_c_compiler_gnu=no' 'rb_cv_pri_prefix_long_long=ll' 'CC=xcrun clang' 'CFLAGS=#{arch_flag} -g -Os -pipe ' 'LDFLAGS=#{arch_flag} ' 'CXX=xcrun clang++' 'CXXFLAGS=#{arch_flag} -g -Os -pipe '"
CONFIG["vendorarchdir"] = "$(vendorlibdir)/$(sitearch)"
CONFIG["vendorlibdir"] = "$(vendordir)/$(ruby_version)"
CONFIG["vendordir"] = "$(rubylibprefix)/vendor_ruby"
@@ -71,7 +71,7 @@
CONFIG["DLDLIBS"] = ""
CONFIG["SOLIBS"] = ""
CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
- CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
+ CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)"
CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
CONFIG["LIBRUBY"] = "$(LIBRUBY_SO)"
CONFIG["LIBRUBY_ALIASES"] = "lib$(RUBY_BASE_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_INSTALL_NAME).dylib"
@@ -79,7 +79,7 @@
CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
CONFIG["RUBYW_INSTALL_NAME"] = ""
CONFIG["rubyw_install_name"] = ""
- CONFIG["LIBRUBY_DLDFLAGS"] = "-Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -install_name $(libdir)/$(LIBRUBY_SO) -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(ruby_version) $(XLDFLAGS)"
+ CONFIG["LIBRUBY_DLDFLAGS"] = "-undefineddynamic_lookup -multiply_definedsuppress -install_name $(libdir)/$(LIBRUBY_SO) -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(ruby_version) $(XLDFLAGS)"
CONFIG["LIBRUBY_LDSHARED"] = "$(CC) -dynamiclib"
CONFIG["EXTDLDFLAGS"] = ""
CONFIG["EXTLDFLAGS"] = ""
@@ -102,7 +102,6 @@
CONFIG["ARCHFILE"] = ""
CONFIG["LIBRUBY_RELATIVE"] = "no"
CONFIG["EXTOUT"] = ".ext"
- CONFIG["RUNRUBY_COMMAND"] = "$(MINIRUBY) $(srcdir)/tool/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT)"
CONFIG["PREP"] = "miniruby$(EXEEXT)"
CONFIG["BTESTRUBY"] = "$(MINIRUBY)"
CONFIG["CROSS_COMPILING"] = "no"
@@ -122,8 +121,8 @@
CONFIG["LDSHARED"] = "$(CC) -dynamic -bundle"
CONFIG["CCDLFLAGS"] = ""
CONFIG["STATIC"] = ""
- CONFIG["ARCH_FLAG"] = arch_flag || " -arch x86_64 -arch i386"
- CONFIG["DLDFLAGS"] = "-Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress"
+ CONFIG["ARCH_FLAG"] = arch_flag || " #{arch_flag} "
+ CONFIG["DLDFLAGS"] = "-undefineddynamic_lookup -multiply_definedsuppress"
CONFIG["ALLOCA"] = ""
CONFIG["codesign"] = "codesign"
CONFIG["POSTLINK"] = "test -z '$(RUBY_CODESIGN)' || codesign -s '$(RUBY_CODESIGN)' -f $@"
@@ -165,7 +164,7 @@
CONFIG["EGREP"] = "/usr/bin/grep -E"
CONFIG["GREP"] = "/usr/bin/grep"
CONFIG["CPP"] = "$(CC) -E"
- CONFIG["CXXFLAGS"] = "$(ARCH_FLAG) -g -Os -pipe "
+ CONFIG["CXXFLAGS"] = "#{arch_flag} -g -Os -pipe "
CONFIG["CXX"] = "xcrun clang++"
CONFIG["OBJEXT"] = "o"
CONFIG["CPPFLAGS"] = "-D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)"
@@ -190,7 +189,7 @@
CONFIG["build_vendor"] = "apple"
CONFIG["build_cpu"] = "x86_64"
CONFIG["build"] = "x86_64-apple-darwin13"
- CONFIG["RUBY_RELEASE_DATE"] = "2014-02-24"
+ CONFIG["RUBY_RELEASE_DATE"] = "2013-06-27"
CONFIG["RUBY_PROGRAM_VERSION"] = "2.0.0"
CONFIG["target_alias"] = ""
CONFIG["host_alias"] = ""
@@ -210,7 +209,8 @@
CONFIG["infodir"] = "$(DESTDIR)/usr/share/info"
CONFIG["docdir"] = "$(datarootdir)/doc/$(PACKAGE)"
CONFIG["oldincludedir"] = "/usr/include"
- CONFIG["includedir"] = (ENV['SDKROOT'] || (File.exists?(File.join(CONFIG['prefix'],'include')) ? '' : %x(xcode-select --print-path >/dev/null 2>&1 && xcrun --sdk macosx --show-sdk-path 2>/dev/null).chomp)) + "$(prefix)/include"
+ DEFAULTSDK = ENV['SDKROOT'] || %x{xcode-select --print-path >/dev/null 2>&1 && xcrun --sdk macosx --show-sdk-path 2>/dev/null}.chomp
+ CONFIG["includedir"] = DEFAULTSDK + "$(prefix)/include"
CONFIG["localstatedir"] = "$(prefix)/var"
CONFIG["sharedstatedir"] = "$(prefix)/com"
CONFIG["sysconfdir"] = "$(DESTDIR)/Library/Ruby/Site" |
I think @drbrain has some ENV var you can set to avoid my hack. |
From stack overflow, try:
PS: I wish apple would upgrade their ruby to the patchlevel that has @zenspider's fixes |
Huh.. that one on line 71 looks suspect. I don't think that's my change and therefore not my ~ file. :/ |
If someone with the offending version of Xcode/clang could submit a PR with an appropriate extconf.rb change, I'd be happy to ask someone else with a Mac to review. ;) Otherwise, I'll close this out in 30 days. Thanks! |
@drbrain's ENV hack can probably be worked into the extconf w/o much issue. |
Very helpful, thanks everyone (although I'm still not clear on the best way to proceed: use the |
IMO: ARCHFLAGS is the least-effort fix Building your own ruby is the best fix (rvm, etc can do this for you) Editing rbconfig.rb is the most "dangerous" fix (not that dangerous at all) |
Downsides: (1) The ARCHFLAGS trick is guaranteed to stop working in the future (though one hopes Apple will update its system Ruby by then). (2) I believe that the edited rbconfig.rb will get overwritten next time you install a new version of Xcode... Once again, fantastic gathering of info; thanks to all. |
On May 14, 2014, at 8:05, Eric Hodel [email protected] wrote:
I only went this route because I'm lazy and forgetful. Presumably (hah) when apple updates this file, it will be with a fix. Until then, I don't have to remember an env var that I don't want to use globally. |
So what actions are necessary, if any, to resolve this in the Nokogiri codebase? |
I'm hoping this will be fixed by Apple in the course of the current Xcode 6 release process. |
@flavorjones I think setting ARCHFLAGS in the generated makefile upon detection of apple ruby will allow you to work around the apple bug |
OK, to be clear, I have no convenient way of testing such a change, being a Can someone who cares deeply about this issue please test the change and On Wed, Jun 4, 2014 at 10:25 PM, Eric Hodel [email protected]
|
I'm using the ARCHFLAGS command line from above but nokogiri still fails to build. I'm on OSX 10.9.2. Any ideas what data I can collect or other options to try? clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future] make failed, exit code 2 |
On Jun 5, 2014, at 9:40, Mike Dalessio [email protected] wrote:
I'm your huckleberry. I'm not deeply invested in this, but I offered to be your OSX beta tester and that's what I'll do. |
Fix for stock ruby 2.0.0 on osx 10.9. Fixes #1101.
Thank you!
|
Hi all, Thanks for the quick fix and commit. I'm going to sound a bit daft here as this is the first time I'm working with git due to a Chef project I've been put on. How do I incorporate this fix into my environment? This is blocking me from getting fog-softlayer installed. I tried cloning nokogiri and getting the fix but building fails as there is no gemspec file and I do not know what I need to do to make progress. Thanks in advance. |
Building 1.6.3.rc2 now, which will include this fix. |
I was able to install. Thanks! |
As is well known, Xcode 5.1 includes a version of clang that is much pickier than previous versions. This affects Nokogiri:
By the way, preceding that there are also some warnings, but they are not fatal. I mention them here just in case it might be possible to fix them:
I was able to work around this by temporarily reverting to Xcode 5.0.2 (installation succeeds with no warnings), but that is not a viable long-term solution.
The text was updated successfully, but these errors were encountered: