As anyone who glances at my posts will quickly notice, I’ve been on a bit of an automation kick recently. I find automation to be refreshingly simple and fun. I’ve been pushing a lot at work to integrate automated tests into our development cycle, and I’m hoping that all my work will pay off soon.
First, some backstory. Some time ago we started writing an iPad app, since we primarily do business to business apps at work, I can’t leave you with many details, but for the time being, we’re stuck supporting an app with a minimum requirement of iOS 5. A total bummer for me, iOS 6 has all sorts of things like Auto Layouts, and a bunch of lowish level awesomeness, and with iOS 7 having been out for a long time (in OS years) there’s all sorts of things in Xcode 5 that we can’t use.
Alas, after some fighting with Xcode, I discovered that as long as I don’t mind a great many quirks, I can shove the iOS 6.1 sdk back into Xcode. I’ll spare you the details since as of Feb. 1, all apps submitted to the App Store must be iOS 7 optimized or face rejection. Speaking of rejection, so far, I’m (2-0) for approval in the App Store.
We had some new features requested in our app, and one day while I was in the middle of implementing them, I came in to work to find Xcode 5.1 had been automatically updated on my machine. Yay! Though the excitement lasted for only a small moment. As all of my co-workers know, I am a HUGE vim fan. I don’t know if it’s the immense productivity, or the look on people’s faces when they try to use my computer, but I can not live without vim. Because of this, I searched high and low until I finally found an Xcode plugin for vim. XVim is easily my favorite open source project, and my all time favorite vim plugin. I’ve been using it since the early days when it only had a few hundred commits. So I open up my freshly installed Xcode 5.1 to find that all of my plugins, including XVim have been wiped off of the face of the planet. Xcode 5.1 never had a GM build (or if it did, no one noticed) so none of my plugins had been updated to support it. I had to switch to an unstable development branch for most of my plugins to get things up and running again. But eventually, I got things working again. And that was that, I falsely assumed.
Nokogiri, a popular ruby gem, has been the bane of my existence today. When we went to install our ruby gems we ended up with this little issue in our install.
linking shared-object nokogiri/nokogiri.bundle
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: *** [nokogiri.bundle] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out
First off, how awesome is it that the log file ends in “make.out”. That has honestly been the only thing helping me make my way though this nightmarish install. I spent from about 5pm to 7pm just trying to figure this one out before I finally gave up and left work.
And before anyone asks, Yes, my first thought was Xcode’s command line tools. Yes they were installed. Don’t even start.
Something just wouldn’t sit right with me on this one. If you look at Nokogiri’s install guide they say that the easiest way to install in OS X is with MacPorts or Homebrew. I for one have been left unimpressed with both. MacPorts is completely unusable from within our corporate network, and Homebrew is some kind of unintelligible beast that feeds off of the hearts of those who dare to google how to perform the simplest task such as installing a specific version of a package.
Along with the install guide’s extreme lack of explanation I was also left with concern over how many Stack Overflow answers say you just need Xcode’s command line tools installed. (1, 2, 3, 4, you get the point)
When I installed Nokogiri on my machine, everything just worked. Turns out, Xcode 5.1 stuck again. In command line tools supplied with Xcode 5.1, Nokogiri 1.6.1 will not install. We tried everything we could find. It just doesn’t work. But, in Xcode 5.0.X, the command line tools work just fine. Not being an expert on Nokogiri, I don’t know why this is, but just getting it to work is fine with me.
The first thing you need to do is head on over here to get the latest Xcode 5.0.X command line tools. You have to log in with an Apple Developer account, but it doesn’t have to be a paid one. Just search for “Command Line Tools” and download “Command Line Tools (OS X Mavericks) for Xcode – Late October 2014”
Once it’s downloaded, install it.
This will keep the command line tools installed that are in Xcode, but it will also install the old tools in /Library/Developer/CommandLineTools/ Since your Xcode tools will be used by default, we need to do a little magic to switch over to the old tools before installing the gem.
#use the 5.0.X command line tools
sudo xcode-select -s /Library/Developer/CommandLineTools/
#install the gem
sudo gem install nokogiri
#reset the command line tools (optional)
sudo xcode-select -r
That’s really all there is to it.
1 thought on “Xcode 5.1 Ruined My Night – Again”
The new version of clang throws up on unknown command-line flags. This will get things to work:
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem [whatever you want to do with gem]