我从official git mirror获得了ruby源,然后检出了ruby_1_9_2
分支。
git clone http://github.com/ruby/ruby.git git checkout ruby_1_9_2
所以,现在,我想编译1.9.2-head。但正如您稍后会看到的那样,我希望找到适用于1.8的解决方案。
编译它的标准方法是:
autoconf ./configure make make install
这样可行,但它产生了一个仅x86_64的版本:
$ ruby -v ruby 1.9.2dev (2010-06-14 revision 28321) [x86_64-darwin10.3.0]
我显然不关心PPC,因为我在10.6,但我想同时拥有i386和x86_64,因为some things需要以32位完成。
$ system_profiler -detailLevel mini SPSoftwareDataType | ack '^ {6}' | head -3 System Version: Mac OS X 10.6.4 (10F569) Kernel Version: Darwin 10.4.0 64-bit Kernel and Extensions: No $ uname -a Darwin meaningless.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
答案 0 :(得分:4)
使用--with-arch
选项./configure
:
$ ./configure --with-arch=x86_64,i386
--with-arch
采用以逗号分隔的体系结构列表,应该为其构建Ruby。
成功构建后的输出:
$ file ruby ruby: Mach-O universal binary with 2 architectures ruby (for architecture x86_64): Mach-O 64-bit executable x86_64 ruby (for architecture i386): Mach-O executable i386 $ arch -i386 ./ruby -v ruby 1.9.2dev (2010-06-29 revision 28468) [universal.i386-darwin10.4.0] $ arch -x86_64 ./ruby -v ruby 1.9.2dev (2010-06-29 revision 28468) [universal.x86_64-darwin10.4.0] $ ./ruby -v ruby 1.9.2dev (2010-06-29 revision 28468) [universal.x86_64-darwin10.4.0]
答案 1 :(得分:1)
对于RVM,it says you can't have fat binaries,但this commit合并my patch的情况并非如此。
使用最新的rvm,您可以使用与手动构建中相同的配置标志来安装ruby-1.9.2-head
:
$ rvm install ruby-1.9.2-head -C --with-arch=x86_64,i386
$ rvm use 1.9.2-head info: Using ruby 1.9.2 head $ file `which ruby` | perl -pe 's|^.*/||' ruby: Mach-O universal binary with 2 architectures ruby (for architecture x86_64): Mach-O 64-bit executable x86_64 ruby (for architecture i386): Mach-O executable i386