使用 RVM Mac OS X 安装 Ruby 1.9.2 时出现问题
我为我的无知道歉 - 我对此很陌生 - 但我已经尝试了一切,但无法使用 RVM 安装 1.9.2。我相信我已经正确安装了 RVM,当我安装 1.9.2 时,当 ruby 尝试编译时,我的 make 日志中出现以下错误:
ld: in /usr/local/lib/libz.1.dylib, file was built for unsupported file format which is
not the architecture being linked (x86_64) for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [../../../.ext/x86_64-darwin10.6.0/digest/md5.bundle] Error 1
make: *** [mkmain.sh] Error 1
一些其他信息:我在 32 位中运行 OS X,并收到类似的错误- 将 (x86_64) 替换为我相信 (i36)。我现在运行的是 64 位。
*更新*:
我已经完成了 TinMan 要求我做的所有事情,但仍然无济于事 - 只是想指出我可以很好地安装 1.8.7。尝试安装 1.9.1 和 1.9.2 时出现以下错误消息:
`Installing Ruby from source to: /Users/tl/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...
ruby-1.9.2-p180 - #fetching
ruby-1.9.2-p180 - #downloading ruby-1.9.2-p180, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8609k 100 8609k 0 0 655k 0 0:00:13 0:00:13 --:--:-- 939k
ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /Users/tl/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #extracted to /Users/tl/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #configuring
ruby-1.9.2-p180 - #compiling
ERROR: Error running 'make ', please read /Users/tl/.rvm/log/ruby-1.9.2-p180/make.log
ERROR: There has been an error while running make. Halting the installation.`
此外,我还升级了 autoconf、automake、m4 和 libtools。
最后,我的路径和 .bash_profiles 分别如下所示:
PATH
`/usr/local/upgraded/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin`
.bash
`export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"`
*Update 2*
我按照此处的说明更新了我的 autoconf、automake、m4 和 libtools: http://tom.meinlschmidt.org/2010/11/ 22/upgrade-autoconfautomake-in-osx/
RVM信息: `系统:
system:
uname: "Darwin Tam-Les-MacBook-Pro.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:11:58 PST 2010; root:xnu-1504.9.26~3/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
zsh: "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"
rvm:
version: "rvm 1.5.2 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/usr/local/upgraded/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/opt/local/bin:/Users/tl/.rvm/bin:/Users/tl/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""`
此外,您的 PATH 看起来不允许 RVM 自行初始化。当 RVM 初始化后,它会首先将其路径放入 ~/.rvm。
你是怎么做到的?我对此真的很陌生,并且通过纯粹的猜测工作已经走到了这一步。我知道效率很低。
*更新 3*
大家好 - 我已经放弃这个了有一段时间了,但这个周末我要再试一次。感谢您的所有建议,我会让您知道接下来会发生什么。对于像我这样的新手来说,我严重低估了安装东西的难度。
I apologize for my ignorance - I'm very new to this - but I have tried everything and cannot get 1.9.2 installed using RVM. I believe I have installed RVM correctly, and when I go to install 1.9.2 I get the following error in my make log when ruby tries to compile:
ld: in /usr/local/lib/libz.1.dylib, file was built for unsupported file format which is
not the architecture being linked (x86_64) for architecture x86_64
collect2: ld returned 1 exit status
make[1]: *** [../../../.ext/x86_64-darwin10.6.0/digest/md5.bundle] Error 1
make: *** [mkmain.sh] Error 1
Some other information: I was running OS X in 32 bit, and received a similar error - replace the (x86_64) with I believe (i36). I am now running in 64 bit.
*Update*:
I have done everything TinMan has asked me to do, and still no avail - Just want to point out that I can install 1.8.7 just fine. Attempting to install 1.9.1 and 1.9.2 gives me the following error message:
`Installing Ruby from source to: /Users/tl/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...
ruby-1.9.2-p180 - #fetching
ruby-1.9.2-p180 - #downloading ruby-1.9.2-p180, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8609k 100 8609k 0 0 655k 0 0:00:13 0:00:13 --:--:-- 939k
ruby-1.9.2-p180 - #extracting ruby-1.9.2-p180 to /Users/tl/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #extracted to /Users/tl/.rvm/src/ruby-1.9.2-p180
ruby-1.9.2-p180 - #configuring
ruby-1.9.2-p180 - #compiling
ERROR: Error running 'make ', please read /Users/tl/.rvm/log/ruby-1.9.2-p180/make.log
ERROR: There has been an error while running make. Halting the installation.`
Additionally, I have upgraded my autoconf, automake, m4, and libtools.
Lastly, my path and .bash_profiles respectively look like:
PATH
`/usr/local/upgraded/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin`
.bash
`export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"`
*Update 2*
I updated my autoconf, automake, m4, and libtools following the instructions here:
http://tom.meinlschmidt.org/2010/11/22/upgrade-autoconfautomake-in-osx/
RVM Info:
`system:
system:
uname: "Darwin Tam-Les-MacBook-Pro.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:11:58 PST 2010; root:xnu-1504.9.26~3/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
zsh: "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"
rvm:
version: "rvm 1.5.2 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/]"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/usr/local/upgraded/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/opt/local/bin:/Users/tl/.rvm/bin:/Users/tl/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""`
Also, your PATH doesn't look like RVM has been allowed to initialize itself. When RVM has been initialized it will put its path to your ~/.rvm first.
How do you do that? I'm really new to this, and have gotten this far through sheer guess work. Inefficient I know.
*Update 3*
Hi all - it's been a while since I've given up on this, but I am going to try again this weekend. Thanks for all the advice and I'll let you know what happens from there. For a newbie such as myself, I severely underestimated how difficult just installing something is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我不知道你是否还在继续,但我通过这样做成功了 ::
sudo rm /usr/local/lib/libz.*
:)
可能某些软件安装了错误lib...错误的架构
I don't know if you're still on it, but i succeeded just by doing this ::
sudo rm /usr/local/lib/libz.*
:)
Probably some software has installed a wrong lib... Well wrong architecture
当您从 32 位升级到 64 位时,RVM 控制下的所有 Ruby 二进制文件都需要重新编译。这意味着 Ruby 和 gems 带有已编译的 C。
以下是我之前尝试过的几个步骤:
rvm get head
更新您的 RVM。当前转速RVM的版本是1.5.1,昨天更新了。rvm uninstall
重新安装所有 Rubies,然后使用相同版本号的rvm install
。这应该会使 Ruby 版本达到 64 位。gem pristine -all
为每个已安装的 Ruby 重建 gem。您可能可以使用 rvm ruby 'gem pristine --all' 自动完成所有这些操作。编辑:
尝试输入
rvm Notes
并按照处理 Mac OS 依赖项的说明进行操作。您可能遗漏了导致问题的某些内容。如果这没有帮助,请使用错误消息的文本编辑您的原始问题,以便我们可以看到它。啊,去过那里。执行 rm ~/.rvm/src/ruby-1.9.2-p180/* 来清空该目录。 RVM 将特定 Ruby 的 tarball 下载到
~/.rvm/archive
目录中,然后将其解压到~/.rvm/src
中。如果在提取过程中出现问题,它可能只有部分文件,这会导致配置/制作周期失败。编辑:
您是如何安装和升级它们的? Mac OS 上的 Ruby 需要 Apple 的标头和 XCode。
请将
rvm info
的输出添加到您的原始问题中。它将具有各种环境信息。另外,您的 PATH 看起来不允许 RVM 自行初始化。当 RVM 初始化后,它会首先将其路径放入您的
~/.rvm
中。编辑:
rvm info
的输出显示 RVM 尚未初始化。它已安装,但这不是同一件事。When you upgrade from 32bit to 64bit, all the Ruby binaries under RVM's control need to be recompiled. This means Ruby and gems with compiled C.
Here's a couple steps to try off the top of my head, having done this a while back:
rvm get head
. The current rev. of RVM is 1.5.1, having updated yesterday.rvm uninstall
with the version of Ruby, followed byrvm install
with the same version number. That should bring the Ruby versions to 64-bit.gem pristine -all
for each installed Ruby. You could probably do them all automatically usingrvm ruby 'gem pristine --all'
.Edit:
Try typing
rvm notes
and follow the instructions for handling dependencies for Mac OS. You might be missing something that is causing the problem. If that doesn't help edit your original question with the text of the error message so we can see it.Ah, been there. Do
rm ~/.rvm/src/ruby-1.9.2-p180/*
to empty that directory. RVM downloads the tarball for a particular Ruby into the~/.rvm/archive
dir, then extracts it to~/.rvm/src
. If something goes wrong during the extract it might have only some of the files, which causes a failure during the configuration/make cycle.Edit:
HOW did you install and upgrade them? Ruby on Mac OS requires Apple's headers and XCode.
Please add the output of
rvm info
to your original question. It will have all sorts of environment info.Also, your PATH doesn't look like RVM has been allowed to initialize itself. When RVM has been initialized it will put its path to your
~/.rvm
first.Edit:
The output from
rvm info
shows that RVM has not been initialized. It is installed, but that is not the same thing.我认为这是由以前安装的 MacPorts 引起的。通过运行删除这些符号/其他东西
为我修复它
I think this is caused by a previous MacPorts installation. removing those symbols / whatelse by running
fixed it for me
我放弃了在 OS X 10.8 上使用 RVM 安装 Ruby 1.9.3 的尝试,而是使用自制程序来完成此操作。
它就像一个魅力——用一个命令安装 ruby:
$brew install ruby
I gave up trying to install Ruby 1.9.3 using RVM on OS X 10.8, and used homebrew to do so.
It worked like a charm -- installs ruby with one single command:
$ brew install ruby
如果您没有对 OS X 安装做过任何疯狂的事情,那么这应该是开箱即用的。我的建议:
由于您的 RVM 安装仅适用于您的“tl”用户,因此使用全新用户尝试 RVM 会给您一个干净的开始。如果新用户安装 RVM + Ruby 1.9.2 也失败,那么我建议重新安装您的计算机,因为可能发生了太多事情。
This should work out-of-the-box if you haven't done any crazy things to your OS X install. What I suggest:
Since your RVM installation is only for your 'tl' user trying out RVM with a brand new user gives you a bit of a clean start. If installing RVM + Ruby 1.9.2 fails with the new user as well then I suggest reinstalling your machine since there's probably too much going on.
某些程序已将 zlib 版本安装到您的 /usr/local 中,该版本无法用于将 Ruby 链接到它,因为它是(我认为)i386 而您的 Ruby-in-minting 是 x64。
您的选择:
1) 通过简单的重命名暂时将 /usr/local 完全移开
,然后再次尝试编译。这是一种硬核措施,但这可能会为您提供正确的链接库。
2) 弯曲 RVM 以使用适合您的 zlib 的架构来构建 Ruby。首先使用
file
并检查您的 zlib 是哪个架构。这将告诉您需要为哪个架构配置 RVM
3) 安装较新的 zlib,默认情况下它可能会使用正确的架构进行编译 - http://www.zlib.net/ 然后重试使用默认设置构建您的 ruby。
4)确实,正如 Piotr 建议的那样,只需删除有问题的 zlib 副本,然后查看哪个程序在查找它时会出现段错误:-P
Some program has installed a version of zlib into your /usr/local that cannot be used to link Ruby against it because it's (I suppose) i386 and your Ruby-in-minting is x64.
Your options:
1) Temporarily move /usr/local out of the way altogether by doing a simple rename
and try compiling again. This is kind of a hardcore measure but this is likely to give you the right libraries linked.
2) Bend RVM to build Ruby with architecture that fits this zlib you have in there. First use
file
and check which arch your zlib is.This will tell you for which arch you need to configure RVM
3) Install a newer zlib which will likely compile with proper arch by default - http://www.zlib.net/ and then retry building your ruby with default settings.
4) Indeed as Piotr suggested just deleting the offending copy of zlib and see which program will segfault looking for it :-P
试试这个,效果就像一个魅力: https://rvm.io/packages/zlib/
Try this, works like a charm: https://rvm.io/packages/zlib/
RVM 依赖于 MacOSX 下的 Homebrew,因此无论哪种方式,您都会回到案例调用
RVM depends on Homebrew under MacOSX, so either way you'll get back to the case calling