Ruby Gems在GitLab上安装错误(找不到-lmagic_ext)

时间:2014-05-09 10:12:30

标签: ruby gcc rubygems puppet gitlab

我正在尝试安装GitLab,它在尝试安装charlock_holmes的步骤失败,以下是我收到的错误输出...

我是通过Puppet安装的,但是它似乎是在从源代码构建charlock_holmes的过程中找不到最终make的库lmagic_ext。

有人能指出我正确的方向吗?

Error: Could not update: Execution of '/usr/bin/gem install -v 0.6.9.4 --no-rdoc --no-ri charlock_holmes' returned 1: ERROR:  Error ins                                          talling charlock_holmes:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby extconf.rb
checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
  -- tar zxvf file-5.08.tar.gz
  -- ./configure --prefix=/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/ --disable-shared --enable-stat                                          ic --with-pic
  -- patch -p0 < ../file-soft-check.patch
  -- make -C src install
  -- make -C magic install
checking for main() in -lmagic_ext... yes
checking for magic.h... yes
creating Makefile

make  clean

make
gcc -I.  -I/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/include -I. -I/usr/lib64/ruby/1.8/x86_64-linux                                           -I. -DHAVE_UNICODE_UCNV_H -DHAVE_MAGIC_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ss                                          p-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC  -Wall -funroll-loops  -c encoding_detector.c
common.h:14: warning: 'charlock_new_enc_str' defined but not used
gcc -I.  -I/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/include -I. -I/usr/lib64/ruby/1.8/x86_64-linux                                           -I. -DHAVE_UNICODE_UCNV_H -DHAVE_MAGIC_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ss                                          p-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC  -Wall -funroll-loops  -c converter.c
common.h:23: warning: 'charlock_new_str' defined but not used
common.h:32: warning: 'charlock_new_str2' defined but not used
gcc -I.  -I/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/include -I. -I/usr/lib64/ruby/1.8/x86_64-linux                                           -I. -DHAVE_UNICODE_UCNV_H -DHAVE_MAGIC_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ss                                          p-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC  -Wall -funroll-loops  -c ext.c
common.h:14: warning: 'charlock_new_enc_str' defined but not used
common.h:23: warning: 'charlock_new_str' defined but not used
common.h:32: warning: 'charlock_new_str2' defined but not used
g++ -I.  -I/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/include -I. -I/usr/lib64/ruby/1.8/x86_64-linux                                           -I. -DHAVE_UNICODE_UCNV_H -DHAVE_MAGIC_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ss                                          p-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC  -Wall -funroll-loops   -c transliterator.cpp
common.h:14: warning: 'VALUE charlock_new_enc_str(const char*, size_t, void*)' defined but not used
common.h:32: warning: 'VALUE charlock_new_str2(const char*)' defined but not used
gcc -shared -o charlock_holmes.so encoding_detector.o converter.o ext.o transliterator.o -L. -L/usr/lib64 -L.  -rdynamic -Wl,-export-dy                                          namic -L/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes     -lruby -lmagic_ext -licui18n -licui18n  -lpthread                                           -lrt -ldl -lcrypt -lm   -lc
/usr/bin/ld: cannot find -lmagic_ext
collect2: ld returned 1 exit status
make: *** [charlock_holmes.so] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/extensions/x86_64-linux/1.8/charlock_holmes-0.6.9.4/gem_make.out
Building native extensions.  This could take a while...

Error: /Stage[main]/Gitlab::Setup/Package[charlock_holmes]/ensure: change from absent to 0.6.9.4 failed: Could not update: Execution of                                           '/usr/bin/gem install -v 0.6.9.4 --no-rdoc --no-ri charlock_holmes' returned 1: ERROR:  Error installing charlock_holmes:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby extconf.rb
checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
  -- tar zxvf file-5.08.tar.gz
  -- ./configure --prefix=/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/ --disable-shared --enable-stat                                          ic --with-pic
  -- patch -p0 < ../file-soft-check.patch
  -- make -C src install
  -- make -C magic install
checking for main() in -lmagic_ext... yes
checking for magic.h... yes
creating Makefile

make  clean

make
gcc -I.  -I/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/include -I. -I/usr/lib64/ruby/1.8/x86_64-linux                                           -I. -DHAVE_UNICODE_UCNV_H -DHAVE_MAGIC_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ss                                          p-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC  -Wall -funroll-loops  -c encoding_detector.c
common.h:14: warning: 'charlock_new_enc_str' defined but not used
gcc -I.  -I/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/include -I. -I/usr/lib64/ruby/1.8/x86_64-linux                                           -I. -DHAVE_UNICODE_UCNV_H -DHAVE_MAGIC_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ss                                          p-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC  -Wall -funroll-loops  -c converter.c
common.h:23: warning: 'charlock_new_str' defined but not used
common.h:32: warning: 'charlock_new_str2' defined but not used
gcc -I.  -I/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/include -I. -I/usr/lib64/ruby/1.8/x86_64-linux                                           -I. -DHAVE_UNICODE_UCNV_H -DHAVE_MAGIC_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ss                                          p-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC  -Wall -funroll-loops  -c ext.c
common.h:14: warning: 'charlock_new_enc_str' defined but not used
common.h:23: warning: 'charlock_new_str' defined but not used
common.h:32: warning: 'charlock_new_str2' defined but not used
g++ -I.  -I/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/dst/include -I. -I/usr/lib64/ruby/1.8/x86_64-linux                                           -I. -DHAVE_UNICODE_UCNV_H -DHAVE_MAGIC_H    -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ss                                          p-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -fPIC  -Wall -funroll-loops   -c transliterator.cpp
common.h:14: warning: 'VALUE charlock_new_enc_str(const char*, size_t, void*)' defined but not used
common.h:32: warning: 'VALUE charlock_new_str2(const char*)' defined but not used
gcc -shared -o charlock_holmes.so encoding_detector.o converter.o ext.o transliterator.o -L. -L/usr/lib64 -L.  -rdynamic -Wl,-export-dy                                          namic -L/usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes     -lruby -lmagic_ext -licui18n -licui18n  -lpthread                                           -lrt -ldl -lcrypt -lm   -lc
/usr/bin/ld: cannot find -lmagic_ext
collect2: ld returned 1 exit status
make: *** [charlock_holmes.so] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/extensions/x86_64-linux/1.8/charlock_holmes-0.6.9.4/gem_make.out
Building native extensions.  This could take a while...

1 个答案:

答案 0 :(得分:0)

似乎你正在使用系统ruby 1.8,这是非常弃用的。更新为>= 1.9.3,这是GitLab所需要的。建议从源代码构建它。如果您通过包管理器安装它,请确保还安装了具有本机扩展的gem所需的ruby devel包。