ruby - 32 位 Ruby 编译在 Lion 上失败

标签 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

如有任何帮助,我们将不胜感激。

最佳答案

我自己使用 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 位 ruby​​

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

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

关于ruby - 32 位 Ruby 编译在 Lion 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8330356/

相关文章:

mysql - Mac上的libmysqlclient15-dev?

macos - 用 applescript 复制数字表

bash - 使用 openssl 从 pkcs12 证书中提取信息

ruby - 这是什么意思?

mysql - Ruby 模型将 Controller 值存储在 MYSQL 中并添加字符

ios - 列出已安装的移动配置文件

python - 如何在 Mac OS X 10.7.4 上安装 lxml?我已经用尽了所有的选择

objective-c - NSTextView 的自定义对焦环

ruby - Jekyll front matter 输出计数

macos - 在 Mac OS X 10.11.6 El Capitan 上安装 ffmpeg 时出现问题