0

Debian サーバーに Ruby gem をインストールする必要があります。これは、Ruby 以外のプログラマーである私にはあまり役に立たないエラー メッセージで失敗します。問題の診断を手伝ってもらえますか? 不足している「必要なライブラリおよび/またはヘッダー」は何ですか?

root ~ # gem install schleuder
Building native extensions.  This could take a while...
ERROR:  Error installing schleuder:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for magic_open() in -lmagic... 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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.8
    --with-magic-dir
    --without-magic-dir
    --with-magic-include
    --without-magic-include=${magic-dir}/include
    --with-magic-lib
    --without-magic-lib=${magic-dir}/lib
    --with-magiclib
    --without-magiclib


Gem files will remain installed in /var/lib/gems/1.8/gems/ruby-filemagic-0.4.2 for inspection.
Results logged to /var/lib/gems/1.8/gems/ruby-filemagic-0.4.2/ext/gem_make.out

ログファイル(これが正しいと仮定)は次のように述べています:

root ~ # cat /var/lib/gems/1.8/gems/ruby-filemagic-0.4.2/ext/mkmf.log
have_library: checking for magic_open() in -lmagic... -------------------- no

"gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I.    -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic     -lruby1.8-static -lmagic  -lpthread -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/lib/ruby/1.8/x86_64-linux -I.    -fno-strict-aliasing -g -g -O2  -fPIC   conftest.c  -L. -L/usr/lib -L.  -rdynamic -Wl,-export-dynamic     -lruby1.8-static -lmagic  -lpthread -lrt -ldl -lcrypt -lm   -lc"
/usr/bin/ld: cannot find -lmagic
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 */

--------------------
4

1 に答える 1

2

一部のRubygemには「ネイティブ拡張」が付属しています。つまり、完全にRubyで記述されているわけではありませんが、Cで記述された外部ライブラリへのバインディングが含まれています。多くの場合、これはパフォーマンス上の理由から、または確立されたライブラリではなく確立されたライブラリを使用するためです。車輪の再発明。

あなたの場合、ヘッダーファイルが欠落しているため、ネイティブ拡張機能をコンパイルできません。おそらくlibmagic-devDebianパッケージをインストールする必要があります。何かのようなもの

sudo apt-get install libmagic-dev

パッケージマネージャーによっては、うまくいくでしょう!

于 2012-12-03T12:13:43.247 に答える