在雪豹上安装link-parser gem的问题

时间:2011-02-25 05:21:26

标签: ruby rubygems

我不能让链接解析器gem在我的雪豹上运行。

当我尝试'sudo gem install linkparser'时,我得到:

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

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for pkg-config... no
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
    --with-link-grammar
    --without-link-grammar
    --with-pkg-config
    --without-pkg-config
extconf.rb:18: Couldn't find your pkg-config binary (RuntimeError)


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/linkparser-1.1.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/linkparser-1.1.0/ext/gem_make.out

当我从源代码编译链接语法4.3.5(它进展顺利)然后尝试做'rake'时:

Task library 'rake/manual.rb' failed to load: NameError: uninitialized constant MANUALDIR. Some tasks may not be available.
No DarkFish: LoadError: no such file to load -- darkfish-rdoc
Task library 'rake/rdoc.rb' failed to load: NameError: uninitialized constant RDOCDIR. Some tasks may not be available.
Task library 'rake/testing.rb' failed to load: NameError: uninitialized constant Spec. Some tasks may not be available.
rm -r coverage
rake clean
(in /Users/alan/linkparser/ext)
rm -r dictionary.o
rm -r linkage.o
rm -r linkparser.o
rm -r parseoptions.o
rm -r sentence.o
rake
(in /Users/alan/linkparser/ext)
gcc  -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c dictionary.c
gcc  -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c linkage.c
gcc  -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c linkparser.c
gcc  -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c parseoptions.c
gcc  -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    -Wall -DDEBUG -DHAVE_LINK_GRAMMAR_LINK_INCLUDES_H -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I/Library/Ruby/Site/1.8 -I. -c sentence.c
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup  -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib  -o linkparser_ext.bundle dictionary.o linkage.o linkparser.o parseoptions.o sentence.o  -lpthread -ldl -llink-grammar -lruby
ld: warning: in /usr/local/lib/liblink-grammar.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Specification tasks not defined: no such file to load -- spec/rake/spectask
rake aborted!
Don't know how to build task 'rdoc'

如何解决这个问题?在编译link-grammar时是否需要指定任何特殊的编译选项?

1 个答案:

答案 0 :(得分:3)

您似乎需要安装pkg-config

我建议首先安装XCode(如果你还没有),然后Homebrew(OS X的软件包管理器)安装它,然后再运行brew install pkg-config终端。

如果您已经安装了MacPorts或Fink,我相信您也可以在他们的存储库中找到合适的软件包。