Skip to content
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

Precompile the extensions #88

Closed
fabiopelosin opened this issue Sep 4, 2013 · 12 comments
Closed

Precompile the extensions #88

fabiopelosin opened this issue Sep 4, 2013 · 12 comments

Comments

@fabiopelosin
Copy link
Member

The extensions should be pre compiled to allow installation without build tools. It should support OS X and Linux (Travis)

@alloy
Copy link
Member

alloy commented Sep 5, 2013

I believe rake-compiler is supposed to aid in that aspect.

@alloy
Copy link
Member

alloy commented Oct 15, 2013

Ok, as I understand it atm, I think the following has to be done:

RubyGems will first check if a ‘platform’ specific version of a gem exists, in which case it will install that over the plain version of the gem. (In our case that’s x86_64-darwin-12 on OS X 10.8 and (probably) x86_64-darwin-13 on 10.9.)

This means that prebuilt extensions for all MRI versions we want to support should be in the same specific prebuilt gem for each platform (10.8 & 10.9).

Regardless of how/when MRI rubies have been built, as long as the architecture and MRI versions are compatible, the same prebuilt extension should work. E.g. an extension built for OS X 10.9’s MRI v2, should also work with a MRI v2 built by e.g. RVM on OS X 10.9.

The MRI versions we should support are:

  • 1.8.7 (default on OS X 10.8)
  • 1.9.3
  • 2.0.0 (default on OS X 10.9)

In conclusion, this means that we need to push the following gems:

  • xcodeproj: This plain one is used on all platforms for which we don’t provide prebuilt extensions.
  • xcodeproj-x86_64-darwin-12: This one should contain prebuilt extensions for the aforementioned MRI versions prebuilt on OS X 10.8.
  • xcodeproj-x86_64-darwin-13: This one should contain prebuilt extensions for the aforementioned MRI versions prebuilt on OS X 10.9.

Finally, it would be great if we can build all these gems from one machine. Maybe we can cross compile for 10.9 from 10.8 and vice-versa. This probably depends on wether or not the 10.8/10.9 SDKs come with their respective stock rubies, which I think they don’t. Maybe we can just make copies of the stock rubies?

@alloy
Copy link
Member

alloy commented Oct 15, 2013

Afaik patch levels should be C API compatible, but need to find out if MRI’s scheme also means that 1.9.2 is compatible to 1.9.3 and 2.0.1 would be compatible with 2.0.0.

@alloy
Copy link
Member

alloy commented Oct 15, 2013

From @headius re MRI compatibility:

The conclusion being: We should prebuilt extensions on latest minor version and test it once on older minors.

@alloy
Copy link
Member

alloy commented Oct 15, 2013

And the definitive answer on compatibility by Matz (http://twitter.com/yukihiro_matz/status/390055492027822081):

binary compatible between patch levels. source upward compatible between versions, unless clearly expressed otherwise.

@alloy
Copy link
Member

alloy commented Oct 20, 2013

On 10.8, the stock Ruby is a universal version, which means the platform is not x86_64-darwin-12, but rather is universal-darwin12. I guess that means we need to build packages for both platforms. Need to check if Ruby 1.8.7 is still usable on 10.9 and if so check if it’s universal or not.

@fabiopelosin
Copy link
Member Author

Need to check if Ruby 1.8.7 is still usable on 10.9 and if so check if it’s universal or not.

I would not bother to support Ruby 1.8.7 on OS X 10.9, who would ever want to do that?

@alloy
Copy link
Member

alloy commented Oct 21, 2013

@irrationalfab Well, not me, but if it’s easy to switch for people, then I’m sure people will do it. But I’m not even sure if people are able/supposed to switch the Ruby versions…

@alloy
Copy link
Member

alloy commented Oct 21, 2013

Ok, Gem::Platform has a === implementation that matches if any of both platforms has ‘universal’ for its CPU: https://github.com/rubygems/rubygems/blob/master/lib/rubygems/platform.rb#L132.

So maybe the universal 1.8.7 stock OS X version will install a ‘x86_64’ version if no ‘universal’ package exists. But since that means it would fail on ‘i386’, in this case, that doesn’t make much sense to me.

So I think we do need to have two precompiled packages, one for x64_86+i386 and one for just x64_86 and then also for 10.9, unless RubyGems accepts just ‘darwin’ for the platform, instead of ‘darwin12’ and ‘darwin13’.

Finally, I have no idea how to test this, other than creating a test gem… :/

@alloy alloy closed this as completed in 95ab798 Oct 22, 2013
@alloy
Copy link
Member

alloy commented Oct 22, 2013

To be clear, I ended up only supporting OS X rubies, so:

  • MRI 1.8.7 on OS X 10.8
  • MRI 2.0.0 on OS X 10.9

The installer (extconf.rb) also ensures these rubies live in /System/Library/Frameworks/Ruby.framework.

@alloy
Copy link
Member

alloy commented Oct 22, 2013

The last thing to check is if a new OS X 10.8/10.9 install comes with make out of the box, because RubyGems insists on running make after running extconf.rb. Atm we create a no-op Makefile if a prebuilt binary should be used.

@kylef
Copy link
Contributor

kylef commented Oct 22, 2013

@alloy:

$ which make
/usr/bin/make
$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
$ uname -a
Darwin Kyles-MacBook-Pro.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants