gem Rdmtx的问题

时间:2017-05-09 02:25:30

标签: ruby-on-rails ruby rubygems

当我尝试安装Rdmtx gem时,我正面临着这个问题:

$ gem install Rdmtx
Building native extensions.  This could take a while...
ERROR:  Error installing Rdmtx:
    ERROR: Failed to build gem native extension.

    /Users/alberto/.rbenv/versions/2.2.5/bin/ruby -r ./siteconf20170508-97735-7c5328.rb extconf.rb
checking for main() in -ldmtx... no
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling Rdmtx.c
Rdmtx.c:26:10: fatal error: 'dmtx.h' file not found
#include <dmtx.h>
         ^
1 error generated.
make: *** [Rdmtx.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/alberto/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/Rdmtx-0.3.1 for inspection.
Results logged to /Users/alberto/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-16/2.2.0-static/Rdmtx-0.3.1/gem_make.out

我已经通过brew安装了libdmtx,但问题仍然存在。

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

我可以在安装libdtmx之前重现错误,但之后按预期安装了gem。库没有安装头文件,或者gem安装过程没有找到正确的位置。要检查第一个,请查看是否可以在/usr中找到标题:

$ find /usr -name dmtx.h
/usr/local/Cellar/libdmtx/0.7.4/include/dmtx.h
/usr/local/include/dmtx.h

您可以尝试运行brew doctor以查看是否存在任何问题。如果没有任何结果,请确保在运行brew config时,您会看到如下所示的行:

HOMEBREW_PREFIX: /usr/local

如果文件安装在/usr/local/include中,则不能在那里查看gem安装。但是,不知道该怎么办。