Lion上的32位Ruby编译失败

时间:2011-11-30 17:35:06

标签: ruby macos osx-lion 32-bit

我正在尝试在Lion上安装32位版本的Ruby,以便我可以与Oracle合作。但是我无法建立它。

对于1.9.3-p0,这是我得到的:

linking miniruby
i686-apple-darwin11-gcc-4.2.1: i386: No such file or directory
make: *** [miniruby] Error 1

我的构建变量如下:

CC = /usr/bin/gcc-4.2
LD = ld
LDSHARED = /usr/bin/gcc-4.2 -dynamic -bundle
CFLAGS = -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -arch i386 -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I. -I.ext/include/i386-darwin11.2.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  -arch i386
SOLIBS = 

我正在使用以下配置:

./configure --with-arch=i386 --prefix=/Users/fenris/.rbenv/versions/32-bit

任何帮助都将不胜感激。

3 个答案:

答案 0 :(得分:6)

自己使用rvm但是也尝试了rbenv并为我工作:

RBENV编译32位ruby-1.9.3-p0

!!!在执行此操作之前安装 libyaml 可能需要

安装libyaml

wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar -xzf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure --prefix=$HOME/.rbenv/versions/ruby-1.9.3-p0_32bit
make 
make install

安装ruby

cd
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar -xzf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0
autoconf
./configure --disable-pthread --with-opt-dir=$HOME/.rbenv/versions/ruby-1.9.3-p0_32bit --with-arch=i386 --prefix=$HOME/.rbenv/versions/ruby-1.9.3-p0_32bit 
make
make install

RVM编译32位ruby-1.9.3-p0

export rvm_archflags='-arch i386'
export rvm_architectures='i386'
export rvm_configure_flags=--target=i686-apple-darwin11
rvm install ruby-1.9.3-p0 --32 --patch osx-arch-fix -n i386

...

确认您运行的是32位红宝石

$ irb
['foo'].pack('p').size

// should return 8 on 64bit and 4 on 32bit.

答案 1 :(得分:1)

如果您使用的是rvm:

,请尝试此操作
rvm_architectures="i386" CFLAGS=" -arch i386" LDFLAGS=" -arch i386" rvm install 1.9.3-p0

答案 2 :(得分:0)

rvm install 1.9.3-p0 --with-gcc=clang