我为Ruby Gem编写了一个C扩展。但#find_header的行为太奇怪了。
# extconf.rb
require 'mkmf'
find_header 'pocketsphinx.h', '/usr/local/include/pocketsphinx'
find_header 'cmd_ln.h', '/usr/local/include/sphinxbase'
find_library 'pocketsphinx', 'ps_args'
find_library 'sphinxbase', 'cmd_ln_init'
create_makefile 'pocket_sphinx/pocket_sphinx'
这是我通过运行rake-compiler提供的$ rake compile
得到的:
$ rake compile
cd tmp/x86_64-darwin13.0/pocket_sphinx/2.1.2
/Users/siegfried/.rvm/rubies/ruby-2.1.2/bin/ruby -I. ../../../../ext/pocket_sphinx/extconf.rb
checking for pocketsphinx.h in /usr/local/include/pocketsphinx... no
checking for cmd_ln.h in /usr/local/include/sphinxbase... yes
checking for ps_args() in -lpocketsphinx... yes
checking for cmd_ln_init() in -lsphinxbase... yes
creating Makefile
它显示缺少标题,但实际上并非如此。
$ ls /usr/local/include/pocketsphinx
cmdln_macro.h fsg_set.h pocketsphinx.h pocketsphinx.pxd pocketsphinx_export.h ps_lattice.h ps_mllr.h
有什么问题?