The intention is to get a clean build of MRI 1.8.7 and 1.9.3.
MRI 1.8.7 doesn't play nicely with LLVM based GCC compilers. In Mountain Lion, the only way to get a non-LLVM gcc is to build one yourself. The command line tools package in Xcode 4.4 does not contain a non-llvm based GCC.
- Upgrade to Mountain Lion
- Remove all previous copies of Xcode
- Install Xcode 4.4 from the App Store
- Install Command Line Tools via Xcode Preferences => Downloads
- Completely remove MacPorts (after saving a copy of your port list.)
- Re-install MacPorts itself
- Re-install your ports (git, macvim, whatever)
- Uninstall all of your rvm rubies you've compiled with previous MacOSX versions
- Delete all gemsets of rubies you've un-installed=
- Update rvm to stable: (rvm get stable)
- Reload your shell to get the right rvm version
- Install gcc-4.2 without llvm (sudo port install apple-gcc42)
- Build rvm ruby-1.8.7 using gcc-4.2 without llvm (Note, this is still a bit tricky since Mountain Lion also removes X11 from the OS. This will also result in an i686 build rather than an x86_64 build.)
- NOTE: Before installing all of your gems, you may want to get rid of rubygems-bundler, which unreasonably modifies the interpreter line of all your RVM gem based executable scripts. If you do this, make sure to run
rubygems-bundler-uninstaller
before uninstalling therubygems-bundler
gem.
CC=/opt/local/bin/gcc-apple-4.2 rvm install ruby-1.8.7 --enable-shared --without-tk --without-tcl
$ CC=/opt/local/bin/gcc-apple-4.2 rvm install ruby-1.8.7 --enable-shared --without-tk --without-tcl Installing Ruby from source to: /Users/jeff/.rvm/rubies/ruby-1.8.7-p370, this may take a while depending on your cpu(s)... ruby-1.8.7-p370 - #fetching ruby-1.8.7-p370 - #extracting ruby-1.8.7-p370 to /Users/jeff/.rvm/src/ruby-1.8.7-p370 ruby-1.8.7-p370 - #extracted to /Users/jeff/.rvm/src/ruby-1.8.7-p370 Applying patch 'stdout-rouge-fix' (located at /Users/jeff/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch) Applying patch 'no_sslv2' (located at /Users/jeff/.rvm/patches/ruby/1.8.7/no_sslv2.diff) ruby-1.8.7-p370 - #configuring ruby-1.8.7-p370 - #compiling ruby-1.8.7-p370 - #installing Retrieving rubygems-1.8.24 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 371k 100 371k 0 0 424k 0 --:--:-- --:--:-- --:--:-- 713k Extracting rubygems-1.8.24 ... Removing old Rubygems files... Installing rubygems-1.8.24 for ruby-1.8.7-p370 ... Installation of rubygems completed successfully. ruby-1.8.7-p370 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.8.7-p370 - #importing default gemsets (/Users/jeff/.rvm/gemsets/) Install of ruby-1.8.7-p370 - #complete Please be aware that you just installed a ruby that requires 2 patches just to be compiled on up to date l inux system. This may have known and unaccounted for security vulnerabilities. Please consider upgrading to Ruby 1.9.3-194 which will have all of the latest security patches.
That should get you up and running with a "clean" Ruby 1.8.7 in RVM on Mountain Lion.
I noticed segmentation faults when trying to run the Puppet spec tests that exercise OpenSSL. To work around this problem in Mountain Lion I also installed OpenSSL using rvm pkg
using gcc-apple-4.2
.
The following command may yield a bad link between ruby and OpenSSL:
rvm install 1.9.3 --enable-shared
Here's how I got something that works. The test is the following against the 3.x branch of Puppet:
(a)[jeff@maynard] (3.x)(clean)[█▃▁]1.9.3@puppet /workspace/a/src/puppet $ rspec spec/unit/face/ ... 228 examples, 0 failures, 11 pending
$ export CC=gcc-apple-4.2 $ rvm pkg install openssl $ rvm pkg install readline $ rvm install ruby-1.9.3 --enable-shared --without-tk --without-tcl
This should result in a MRI 1.9.3 that works well with OpenSSL.
$ rspec -fp spec/unit/face /Users/jeff/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead. ***..........................***.......................................................................*........................................................................................................................**** Pending: Puppet::Face[:catalog, v0.0.1] should actually have some testing... # Not yet implemented # ./spec/unit/face/catalog_spec.rb:6 Puppet::Face[:certificate_request, v0.0.1] should actually have some tests... # Not yet implemented # ./spec/unit/face/certificate_request_spec.rb:6 Puppet::Face[:certificate_revocation_list, v0.0.1] should actually have some tests... # Not yet implemented # ./spec/unit/face/certificate_revocation_list_spec.rb:6 Puppet::Face[:facts, v0.0.1] when uploading should set the terminus_class to :facter # Not yet implemented # ./spec/unit/face/facts_spec.rb:11 Puppet::Face[:facts, v0.0.1] when uploading should set the cache_class to :rest # Not yet implemented # ./spec/unit/face/facts_spec.rb:12 Puppet::Face[:facts, v0.0.1] when uploading should find the current certname # Not yet implemented # ./spec/unit/face/facts_spec.rb:13 Puppet::Face[:key, v0.0.1] should actually have some tests... # Not yet implemented # ./spec/unit/face/key_spec.rb:6 Puppet::Face[:report, v0.0.1] should actually have some tests... # Not yet implemented # ./spec/unit/face/report_spec.rb:6 Puppet::Face[:resource, v0.0.1] should actually have some tests... # Not yet implemented # ./spec/unit/face/resource_spec.rb:6 Puppet::Face[:resource_type, v0.0.1] should actually have some tests... # Not yet implemented # ./spec/unit/face/resource_type_spec.rb:6 Puppet::Face[:secret_agent, v0.0.1]#synchronize should retrieve and apply a catalog and return a report # This test doesn't work, but the code actually does - tested by LAK # ./spec/unit/face/secret_agent_spec.rb:11 Finished in 1.36 seconds 228 examples, 0 failures, 11 pending
On mountain lion we need the readline package installed. RVM provides this:
rvm pkg install readline
Then we link against this readline rather than one from Brew or MacPorts:
CC=gcc-apple-4.2 rvm install ruby-1.8.5 \
--enable-shared \
--without-tk \
--without-tcl \
--with-readline-dir=${HOME:-~}/.rvm/usr
$ CC=gcc-apple-4.2 rvm install ruby-1.8.5 --enable-shared --without-tk --without-tcl --with-readline-dir=/Users/j Installing Ruby from source to: /Users/jeff/.rvm/rubies/ruby-1.8.5-p231, this may take a while depending on your ruby-1.8.5-p231 - #downloading ruby-1.8.5-p231, this may take a while depending on your connection... ruby-1.8.5-p231 - #extracting ruby-1.8.5-p231 to /Users/jeff/.rvm/src/ruby-1.8.5-p231 ruby-1.8.5-p231 - #extracted to /Users/jeff/.rvm/src/ruby-1.8.5-p231 Applying patch 'openssl-1.0' (located at /Users/jeff/.rvm/patches/ruby/1.8.5/openssl-1.0.patch) Applying patch 'stdout-rouge-fix' (located at /Users/jeff/.rvm/patches/ruby/1.8.5/stdout-rouge-fix.patch) Applying patch 'no_sslv2' (located at /Users/jeff/.rvm/patches/ruby/1.8.5/no_sslv2.diff) Applying patch 'syck' (located at /Users/jeff/.rvm/patches/ruby/1.8.5/syck.patch) Applying patch 'backported-ossl-fixes' (located at /Users/jeff/.rvm/patches/ruby/1.8.5/backported-ossl-fixes.diff Applying patch 'math_gcc_fix' (located at /Users/jeff/.rvm/patches/ruby/1.8.5/math_gcc_fix.diff) Applying patch 'gcc44_dtoa' (located at /Users/jeff/.rvm/patches/ruby/1.8.5/gcc44_dtoa.diff) ruby-1.8.5-p231 - #configuring ruby-1.8.5-p231 - #compiling ruby-1.8.5-p231 - #installing Retrieving rubygems-1.3.5 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 271k 100 271k 0 0 560k 0 --:--:-- --:--:-- --:--:-- 618k Extracting rubygems-1.3.5 ... Removing old Rubygems files... Installing rubygems-1.3.5 for ruby-1.8.5-p231 ... Installation of rubygems completed successfully. ruby-1.8.5-p231 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.8.5-p231 - #importing default gemsets (/Users/jeff/.rvm/gemsets/) Install of ruby-1.8.5-p231 - #complete Please be aware that you just installed a ruby that requires 7 patches just to be compiled on up to date linux system. This may have known and unaccounted for security vulnerabilities. Please consider upgrading to Ruby 1.9.3-194 which will have all of the latest security patches.