【问题标题】:Having difficulty installing ruby-filemagic gem on new RHEL6 server在新的 RHEL6 服务器上安装 ruby​​-filemagic gem 有困难
【发布时间】:2012-05-07 12:18:24
【问题描述】:

它似乎在寻找 libmagic.so.1 文件。我有那个文件。它位于 /usr/lib64。我没有以 root 用户身份运行此安装。

我也在使用 rvm 和 Bundler。这是我的“bundle”命令的结果,当它到达我的 Gemfile 中的 ruby​​-filemagic 行时:

[server@mine ext]$ ruby extconf.rb --with-magiclib
checking for magic_open() in -ltrue... no
*** ERROR: missing required library to compile this module
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

更新:

这是 mkmf.log 的结果:

have_library: checking for magic_open() in -ltrue... -------------------- no

"gcc -o conftest -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/x86_64-linux -I.    -g -O2  -fPIC   conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.8.7-p358/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.8.7-p358/lib -L.  -rdynamic -Wl,-export-dynamic     -lruby-static -ltrue  -lrt -ldl -lcrypt -lm   -lc"
conftest.c: In function ‘t’:
conftest.c:3: error: ‘magic_open’ undeclared (first use in this function)
conftest.c:3: error: (Each undeclared identifier is reported only once
conftest.c:3: error: for each function it appears in.)
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { void ((*volatile p)()); p = (void ((*)()))magic_open; return 0; }
/* end */

"gcc -o conftest -I. -I/usr/local/rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/x86_64-linux -I.    -g -O2  -fPIC   conftest.c  -L. -L/usr/local/rvm/rubies/ruby-1.8.7-p358/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.8.7-p358/lib -L.  -rdynamic -Wl,-export-dynamic     -lruby-static -ltrue  -lrt -ldl -lcrypt -lm   -lc"
/usr/bin/ld: cannot find -ltrue
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { magic_open(); return 0; }
/* end */

我不知道该怎么做才能完成这项工作。

【问题讨论】:

    标签: ruby ruby-on-rails-3.1 rubygems bundler


    【解决方案1】:

    在 Ubuntu 12.04 上遇到同样的问题。刚刚通过以下命令安装了libmagic-dev 包:

    sudo apt-get install libmagic-dev
    

    【讨论】:

      【解决方案2】:

      在 Mac 上,使用自制软件:

      sudo brew install libmagic
      

      【讨论】:

      • 嘿,我仍然收到checking for magic_open() in -lmagic... no 有什么想法吗?
      • 首先确保 libmagic 安装正确。尝试ls -al /usr/local/include/|grep magic 并验证magic.h 是否存在)
      • file magic.h 在那里,但我有同样的错误,但我相信最近的 ruby​​-filemagic 的初始错误是这个 ld: library not found for -lgnurx clang: error: linker command failed with退出代码 1(使用 -v 查看调用)
      【解决方案3】:

      我需要做的:

      yum install file-devel
      

      这显然包含了 filemagic ruby​​ gem 编译所需的 libmagic 头文件。在那之后它就像一个冠军。

      【讨论】:

        【解决方案4】:

        我在 OpenSuse 11.3 上遇到了同样的问题。这有帮助:

        zypper install file-devel
        

        【讨论】:

          猜你喜欢
          • 2011-06-04
          • 2012-07-27
          • 1970-01-01
          • 1970-01-01
          • 2023-03-03
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多