使用Vulcan在Heroku上安装raspell gem

时间:2013-01-08 05:38:14

标签: heroku gem aspell

我想使用thinking-sphinx-raspell gem来为我们网站上的搜索提供您所希望的建议。它适用于我的开发机器(Mountain Lion),但我在Heroku Cedar上部署它时遇到了困难。

宝石取决于raspell宝石,宝石又取决于aspell。因为asopll不包含在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。我已将此路径添加到PATHC_INCLUDE_PATHCPLUS_INCLUDE_PATH,并将CFLAGS设置为-I/app/bin

我做错了什么?或者我正在尝试一些不能在Heroku上工作的东西?

1 个答案:

答案 0 :(得分:0)

你有没有看过Heroku的buildpacks? https://devcenter.heroku.com/articles/buildpacks

它们似乎是一种自定义堆栈的方法。 (自从你提出问题以来,它们可能已被引入。)