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

本文是小编为大家收集整理的关于难以在新Rhel6服务器上安装Ruby-FileMagic Gem的处理方法,想解了难以在新Rhel6服务器上安装Ruby-FileMagic Gem的问题怎么解决?难以在新Rhel6服务器上安装Ruby-FileMagic Gem问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

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

我也使用RVM和Bundler.这是我的"捆绑"命令的结果,当它到达我的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.

更新:

这是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 */

我无法弄清楚该怎么做.

推荐答案

我需要做:

yum install file-devel

显然包含filemagic红宝石宝石为了编译所需的libmagic标头文件.之后它像冠军一样工作.

其他推荐答案

在Ubuntu 12.04上也有相同的问题.刚刚通过以下命令安装libmagic-dev软件包:

sudo apt-get install libmagic-dev

其他推荐答案

在Mac上使用Homebrew:

sudo brew install libmagic

本文地址:https://www.itbaoku.cn/post/786688.html