How to manually create a universal ruby ​​on Mac OS X? What about rvm?

I got ruby ​​sources from the official git mirror , then checked the branch ruby_1_9_2.

git clone http://github.com/ruby/ruby.git
git checkout ruby_1_9_2

So, for now, I want to compile 1.9.2-head. But, as you will see later, I hope for a solution that works for 1.8 as well.

Standard compilation method:

autoconf
./configure
make
make install

This works, but it gives me the x86_64 assembly:

$ ruby ​​-v
ruby 1.9.2dev (2010-06-14 revision 28321) [x86_64-darwin10.3.0]

I don't care about PPC, obviously, since I'm at 10.6, but I want to have i386 and x86_64, because some things need to be done in 32-bit.

So what I want to know:

  • i386 x86_64 .
  • RVM ruby.

, :

$ 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
+3
2

--with-arch ./configure:

$ ./configure --with-arch=x86_64,i386

--with-arch , Ruby .


kch:

:

$ 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]
+4

RVM, , , , , .

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
+1

Source: https://habr.com/ru/post/1752198/


All Articles