【发布时间】:2013-01-08 05:38:13
【问题描述】:
我想使用thinking-sphinx-raspell gem 来为我们网站上的搜索提供您的意思建议。它可以在我的开发机器(Mountain Lion)上运行,但我在 Heroku Cedar 上部署它时遇到了困难。
gem 依赖于raspell gem,而后者又依赖于aspell。因为 aspell 不包含在 Heroku Cedar 堆栈中,所以我使用 Vulcan 在 Heroku 机器上编译它,将二进制文件添加到我的 git 存储库,然后将其推送到 Heroku。我更详细地描述了这些步骤here。
这会导致打包阶段出错:
Installing raspell (1.3)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for ruby.h... yes
checking for aspell.h... no
checking for main() in -laspell... no
creating Makefile
make
gcc -I. -I/usr/local/include/ruby-1.9.1/x86_64-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -DHAVE_RUBY_H -I/opt/local/include -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o raspell.o -c raspell.c
In file included from raspell.c:2:
raspell.h:6:20: error: aspell.h: No such file or directory
如果我理解正确的话,这种对 aspell.h 的依赖是在 raspell gem 的extconf.rb 中设置的:
have_header("aspell.h")
我将该头文件放在我项目的 bin 目录中。不是最好的地方,但我认为这不是问题所在。这对应于 Heroku 文件系统上的 /app/bin。我将此路径添加到PATH、C_INCLUDE_PATH、CPLUS_INCLUDE_PATH,并将CFLAGS 设置为-I/app/bin。
我做错了什么?还是我在尝试一些对 Heroku 不起作用的东西?
【问题讨论】: