简体   繁体   English

使用RVM Mac OS X安装Ruby 1.9.2时出现问题

[英]Trouble Installing Ruby 1.9.2 with RVM Mac OS X

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. 我为自己的无知道歉 - 我对此很新 - 但我已经尝试了一切,并且无法使用RVM安装1.9.2。 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: 我相信我已经正确安装了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

Some other information: I was running OS X in 32 bit, and received a similar error - replace the (x86_64) with I believe (i36). 其他一些信息:我在32位运行OS X,并收到类似的错误 - 用我认为(i36)替换(x86_64)。 I am now running in 64 bit. 我现在以64位运行。

*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. 我已经完成了TinMan要求我做的所有事情,但仍无济于事 - 只想指出我可以安装1.8.7就好了。 Attempting to install 1.9.1 and 1.9.2 gives me the following error message: 试图安装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.`

Additionally, I have upgraded my autoconf, automake, m4, and libtools. 另外,我已经升级了我的autoconf,automake,m4和libtools。

Lastly, my path and .bash_profiles respectively look like: 最后,我的路径和.bash_profiles分别如下所示:

PATH 路径

`/usr/local/upgraded/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin`

.bash .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* *更新2 *

I updated my autoconf, automake, m4, and libtools following the instructions here: http://tom.meinlschmidt.org/2010/11/22/upgrade-autoconfautomake-in-osx/ 我按照以下说明更新了我的autoconf,automake,m4和libtools: http ://tom.meinlschmidt.org/2010/11/22/upgrade-autoconfautomake-in-osx/

RVM Info: `system: RVM信息:`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 (wayneeseguin@gmail.com) [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. 此外,您的PATH看起来不像RVM已被允许初始化自身。 When RVM has been initialized it will put its path to your ~/.rvm first. 当RVM初始化时,它将首先将其路径放到〜/ .rvm。

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* *更新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. 对于像我这样的新手,我严重低估了安装东西的难度。

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 可能有些软件安装了错误的库......错误的架构

When you upgrade from 32bit to 64bit, all the Ruby binaries under RVM's control need to be recompiled. 当您从32位升级到64位时,需要重新编译RVM控制下的所有Ruby二进制文件。 This means Ruby and gems with compiled C. 这意味着Ruby和gems与编译C.

Here's a couple steps to try off the top of my head, having done this a while back: 这里有几个步骤试试我的头脑,我做了一会儿:

  1. Make sure your XCode is current. 确保您的XCode是最新的。 Do NOT trust the version on the Snow Leopard DVD as it's corrupt. 不要相信Snow Leopard DVD上的版本因为它已损坏。 Download AND INSTALL a current copy from Apple's XCode site . Apple的XCode站点下载并安装当前副本。
  2. Update your RVM using rvm get head . 使用rvm get head更新您的RVM。 The current rev. 目前的转速。 of RVM is 1.5.1, having updated yesterday. RVM是1.5.1,昨天更新了。
  3. Reinstall all your Rubies using rvm uninstall with the version of Ruby, followed by rvm install with the same version number. 使用带有Ruby版本的rvm uninstall重新安装所有rvm uninstall ,然后使用相同版本号的rvm install That should bring the Ruby versions to 64-bit. 这应该将Ruby版本带到64位。
  4. Rebuild the gems using gem pristine -all for each installed Ruby. 使用gem pristine -all为每个已安装的Ruby重建gem pristine -all You could probably do them all automatically using rvm ruby 'gem pristine --all' . 你可以使用rvm ruby 'gem pristine --all'自动完成所有这些操作。

Edit: 编辑:

[...] I was able to successfully install 1.8.7 but am still receiving the same error for 1.9.2. [...]我能够成功安装1.8.7但仍然收到1.9.2的相同错误。 Is there something else I'm missing? 还有什么我想念的吗? Does the .bash_profile matter in this situation? .bash_profile在这种情况下是否重要?

Try typing rvm notes and follow the instructions for handling dependencies for Mac OS. 尝试键入rvm notes并按照处理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. 如果这不能帮助您使用错误消息的文本编辑原始问题 ,那么我们就可以看到它。

[...] when it goes through the extraction phase it says: '#extracted to /Users/tl/.rvm/src/ruby-1.9.2-p180 (already extracted)' [...]当它经历提取阶段时,它说:'#remove到/Users/tl/.rvm/src/ruby-1.9.2-p180(已经提取)'

Ah, been there. 啊,去过那儿。 Do rm ~/.rvm/src/ruby-1.9.2-p180/* to empty that directory. 执行rm ~/.rvm/src/ruby-1.9.2-p180/*来清空该目录。 RVM downloads the tarball for a particular Ruby into the ~/.rvm/archive dir, then extracts it to ~/.rvm/src . RVM将特定Ruby的tarball下载到~/.rvm/archive目录中,然后将其提取到~/.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: 编辑:

have upgraded my autoconf, automake, m4, and libtools 升级了我的autoconf,automake,m4和libtools

HOW did you install and upgrade them? 你是如何安装和升级它们的? Ruby on Mac OS requires Apple's headers and XCode. Ruby on Mac OS需要Apple的标题和XCode。

Please add the output of rvm info to your original question. 请将rvm info的输出添加到原始问题中。 It will have all sorts of environment info. 它将有各种各样的环境信息。

Also, your PATH doesn't look like RVM has been allowed to initialize itself. 此外,您的PATH看起来不像RVM已被允许初始化自身。 When RVM has been initialized it will put its path to your ~/.rvm first. 当RVM初始化时,它将首先将其路径放到~/.rvm


Edit: 编辑:

The output from rvm info shows that RVM has not been initialized. rvm info的输出显示RVM尚未初始化。 It is installed, but that is not the same thing. 它已安装,但这不是一回事。

  1. CAREFULLY read the documentation, and check-off that you have done the steps in the "Post-Install" section of " Installation " on the RVM site. 请仔细阅读文档,并检查您是否已完成RVM站点上“ 安装 ”的“ 安装后”部分中的步骤。 Go through the "Troubleshooting your Install" section also, then do it again. 另请参阅“安装故障排除”部分,然后再进行一次。
  2. Confirm that you have installed the current version of Apple's XCode development system. 确认您已安装Apple的XCode开发系统的当前版本。

I gave up trying to install Ruby 1.9.3 using RVM on OS X 10.8, and used homebrew to do so. 我放弃了尝试在OS X 10.8上使用RVM安装Ruby 1.9.3,并使用自制程序来执行此操作。 It worked like a charm -- installs ruby with one single command: 它就像一个魅力 - 用一个命令安装ruby:

$ brew install ruby $ brew install ruby

I think this is caused by a previous MacPorts installation. 我认为这是由以前的MacPorts安装引起的。 removing those symbols / whatelse by running 通过运行删除那些符号/ whatelse

sudo rm /usr/local/lib/libz.* 

fixed it for me 为我修好了

RVM依赖于MacOSX下的Homebrew,所以无论哪种方式你都会回到案例调用

brew install ruby

This should work out-of-the-box if you haven't done any crazy things to your OS X install. 如果您没有对OS X安装做任何疯狂的事情,这应该是开箱即用的。 What I suggest: 我的建议是什么:

  1. Try reinstalling the Developer Tools from scratch. 尝试从头开始重新安装开发人员工具。
  2. Create a new user in OS X, log in and try installing RVM there in the normal fashion 在OS X中创建一个新用户,登录并尝试以正常方式安装RVM

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. 由于您的RVM安装仅适用于'tl'用户,因此尝试使用全新用户的RVM可以让您有一个干净利落的开始。 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. 如果安装RVM + Ruby 1.9.2也失败了新用户,那么我建议重新安装你的机器,因为可能会有太多的事情发生。

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. 有些程序在你的/ usr / local中安装了一个版本的zlib,它不能用来链接Ruby,因为它(我想)i386和你的Ruby-in-minting是x64。

Your options: 你的选择:

1) Temporarily move /usr/local out of the way altogether by doing a simple rename 1)通过简单的重命名暂时将/ usr / local移开

 $mv /usr/local /usr/local-disabled

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. 2)弯曲RVM以使用适合您在那里的zlib的架构来构建Ruby。 First use file and check which arch your zlib is. 首先使用file并检查zlib是哪个拱。

$file /usr/local/lib/libz.1.dylib 
/usr/local/lib/libz.1.dylib: Mach-O dynamically linked shared library i386

This will tell you for which arch you need to configure RVM 这将告诉您配置RVM需要哪个arch

Place the following in your ~/.rvmrc file:
rvm_archflags="-arch i386"

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. 3)安装一个较新的zlib,默认情况下可能会使用正确的arch进行编译 - http://www.zlib.net/然后使用默认设置重新构建ruby。

4) Indeed as Piotr suggested just deleting the offending copy of zlib and see which program will segfault looking for it :-P 4)确实,正如Piotr建议只删除zlib的违规副本,看看哪个程序会出现段错误:-P

Try this, works like a charm: https://rvm.io/packages/zlib/ 尝试这个,就像一个魅力: https//rvm.io/packages/zlib/

rvm pkg install zlib
rvm reinstall 1.9.2 --with-zlib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM