pivotal-sprout / sprout-wrap

Pivotal Labs uses this project with sprout, soloist and librarian-chef to build developer workstations
The Unlicense
157 stars 250 forks source link

Needs patch to work under XCode 5.1 #36

Closed tylerholland closed 10 years ago

tylerholland commented 10 years ago

This is probably an issue with one of the dependencies, but in case you run into this when running with sprout-wrap, it wasn't clear to me what was wrong. This might help others.

The current build fails if the system has been updated to XCode 5.1. The initial bundle fails on both json (1.7.7) and yajl-ruby (1.1.0).

Solution for now seems to be installing those gems manually with:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install json -v '1.7.7'

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install yaji-ruby -v '1.1.0'

(Note: if using system ruby, you may need to run those commands with sudo)

Reference: http://stackoverflow.com/questions/22352838/ruby-gem-install-json-fails-on-mavericks-and-xcode-5-1-unknown-argument-mul), which refers to the XCode 5.1 Release Note:

The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. 
This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.

Projects using invalid compiler options will need to be changed to remove those options. 
To help ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning:

-Wno-error=unused-command-line-argument-hard-error-in-future

To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning.

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName

Not sure what the long term solution would be if that workaround is disabled in the future.

hiremaga commented 10 years ago

@codeword Are we seeing this issue with the Jenkins build that produces the Labs image?

cunnie commented 10 years ago

(to @hiremaga ): The current jenkins build is still using Xcode 5.0 so it has not encountered this problem, but we were able to verify this issue on a 5.1 machine.

the quick an dirty solution is to run (in the sprout-wrap directory):

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future sudo -E bundle

to ensure proper installation of the gems that soloist requires.

cunnie commented 10 years ago

an alternative to the ARCHFLAG override is to use a newer ruby version. We verified the ruby 2.0.0-p451 does not pass the unrecognized command line options and thus is able to install the native extensions.

For example, with rbenv, we found the following allowed us to dispense with the ARCHFLAGs setting to build the JSON gem.

rbenv install 2.0.0-p451
rbenv local 2.0.0-p451
bundle install
hiremaga commented 10 years ago

We might need to introduce an omnibus for soloist with ruby 2.0.0-p451 or greater vendored.

See https://www.pivotaltracker.com/story/show/69569956

hiremaga commented 10 years ago

The README update in #44 helps describe one workaround.

hiremaga commented 10 years ago

With 10.9.3 out this is no longer an issue. System Ruby on 10.9.3 is 2.0.0p451