难以在新的RHEL6服务器上安装ruby-filemagic gem [英] Having difficulty installing ruby-filemagic gem on new RHEL6 server

查看:224
本文介绍了难以在新的RHEL6服务器上安装ruby-filemagic gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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

  [server @mine ext.rb --with-magiclib 
在-ltrue中检查magic_open()... no
***错误:缺少编译此模块所需的库
*** extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少
必需的库和/或头文件。查看mkmf.log文件以获取更多
的详细信息。您可能需要配置选项。

更新:

以下是结果的mkmf.log:

  have_library:在-ltrue中检查magic_open()... ------- ------------- 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:在函数't'中:
conftest.c:3:错误:'magic_open'未声明(在此函数中首次使用)
conftest.c:3:错误:(每个未声明的标识符被报告)
检查的程序是:
/ * begin * /
1:/ * top * /只有一次
conftest.c:3:error:
2:int main(){return 0; }
3:int t(){void((* volatile p)()); p =(void((*)()))magic_open;返回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:找不到-ltrue
collect2:ld返回1退出状态
检查程序为:
/ * begin * /
1:/ * top * /
2 :int main(){return 0; }
3:int t(){magic_open();返回0; }
/ * end * /






解决方案

我需要这样做:

  yum install file-devel 



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


It appears to be looking for the libmagic.so.1 file. I have that file. It is located in /usr/lib64. I am not running this installation as the root user.

I am also using rvm and Bundler. This is the result of my "bundle" command, when it gets to the ruby-filemagic line in my Gemfile:

[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.

UPDATE:

Here are the results of the 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 */


I can't figure out what to do to make this work.

解决方案

I needed to do:

yum install file-devel

That apparently contains the libmagic header files that the filemagic ruby gem required in order to compile. It worked like a champ after that.

这篇关于难以在新的RHEL6服务器上安装ruby-filemagic gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆