在新的RHEL6服务器上安装ruby-filemagic gem时遇到困难
它似乎在寻找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 */
我无法弄清楚如何做到这一点。
在Ubuntu 12.04上遇到同样的问题。 刚刚通过以下命令安装了libmagic-dev
软件包:
sudo apt-get install libmagic-dev
在Mac上,使用自制软件:
sudo brew install libmagic
我需要这样做:
yum install file-devel
这显然包含了filemagic ruby gem为了编译而需要的libmagic头文件。 之后它就像一个冠军。
我在OpenSuse 11.3上遇到了同样的问题。 这有助于:
zypper install file-devel
- 你能在Gemfile中拥有多个版本的gem吗?
- Bundler找不到gem“bundler”的兼容版本:
- capistrano错误消息:请安装pg适配器:`gem install activerecord-pg-adapter`(无法加载此类文件 –
- 如何在部署到heroku时解决rails中的更新捆绑器警告?
- 在能够使用Capistrano进行部署之前,是否需要在我的服务器上手动安装Bundler?
- Rails:构建bundler gemfile的选项
- 在Ruby on Rails中,在“gem install ”之后,如何使它扩展Array,或者使用它的类方法?
- 在windows上开发,在heroku上运行独角兽
- Bundler:如何在没有导轨的情况下使用?