【问题标题】:Trouble installing fast_xor Gem on Ubuntu for Discourse在 Ubuntu for Discourse 上安装 fast_xor Gem 时遇到问题
【发布时间】:2013-03-22 22:52:31
【问题描述】:

我对 ruby​​、rvm、gems 等术语非常陌生;但我正在尝试在 Ubuntu 12.10 服务器上安装 Discourse。我使用 bundle install 安装了所有 gem,除了一个 fast_xor

Installing fast_xor (1.1.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/ubuntu/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb 
creating Makefile

make
compiling xor.c
xor.c: In function ‘string_xor’:
xor.c:28:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
xor.c:45:7: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
linking shared-object xor.so

make install
/usr/bin/install -c -m 0755 xor.so /home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/fast_xor-1.1.1/lib/fast_xor
/usr/bin/install: cannot create regular file `/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/fast_xor-1.1.1/lib/fast_xor': No such file or directory
make: *** [install-so] Error 1


Gem files will remain installed in /home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/fast_xor-1.1.1 for inspection.
Results logged to /home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/fast_xor-1.1.1/ext/xor/gem_make.out

An error occurred while installing fast_xor (1.1.1), and Bundler cannot continue.
Make sure that `gem install fast_xor -v '1.1.1'` succeeds before bundling.

我已从 Git 签出 fast_xor 项目,但从源代码编译时收到类似错误。

rvm list 只列出一个版本的 Ruby:

ubuntu@ip-10-245-40-185:~/discourse$ rvm list

rvm rubies

=* ruby-2.0.0-p0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

我不知道从这里去哪里?

【问题讨论】:

  • 在 Ubuntu 12.04 上安装了 gem,构建也没有问题。你有机会打开 12,04。另外,它是 LTS,这意味着它支持到 2017 年。
  • 我认为错误信息意味着路径/home/ubuntu/.rvm/gems/ruby-2.0.0-p0/gems/fast_xor-1.1.1/lib/fast_xor 中的目录之一不存在。
  • @tc 正确,/lib/ 目录不存在 - 但即使我在尝试安装 Gem 之前手动创建它,似乎构建过程的某些部分会删除该目录,如下所示构建失败,目录丢失。

标签: ruby ubuntu rvm ubuntu-12.10 ruby-2.0


【解决方案1】:

在您的Gemfile 中替换该行:

gem 'fast_xor'

对于以下一个(从已修复错误的 Git 存储库中提取 fast_xor):

gem "fast_xor", :git => "git://github.com/CodeMonkeySteve/fast_xor.git"

如果由于某种原因 git 协议在您的网络中被防火墙(如我的情况),那么您可以将其替换为 HTTPS:

gem "fast_xor", :git => "https://github.com/CodeMonkeySteve/fast_xor.git"

【讨论】:

    【解决方案2】:

    这是 gem 中的一个错误:https://github.com/CodeMonkeySteve/fast_xor/issues/5

    在提问之前始终检查项目的问题跟踪器 - stavkoverflow 用于解决问题而不是报告错误。

    【讨论】:

    • 那个问题是 12 小时前打开的,6 小时后 我问了我的问题。我很欣赏这个答案,但没有必要谴责。 :)
    猜你喜欢
    • 1970-01-01
    • 2012-08-27
    • 2015-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-01
    相关资源
    最近更新 更多