【发布时间】:2014-12-02 19:06:05
【问题描述】:
我无法在Heroku 上安装XML::LibXSLT。看起来所需的库 gdbm 没有安装,尽管在 Heroku stack cedar 和 cedar-14 上是 listed as installed Ubuntu packages。 in this question 报告了类似的问题,但 Heroku 上没有,并且不允许安装新的 Ubuntu 软件包。
要重现错误,请创建一个最小存储库,需要在cpanfile 中使用 XML::LibXSLT:
$ git init
$ echo 'requires "XML::LibXSLT";' > cpanfile
$ echo 'sub { [200,[], ['Hello World']] }' > app.psgi
$ git add cpanfile app.psgi
$ git commit -m "initial commit"
使用 heroku-buildpack-perl 创建一个新的 Heroku 应用以运行 cpanm:
$ heroku create --stack cedar --buildpack https://github.com/miyagawa/heroku-buildpack-perl.git
$ git push heroku master
错误日志包含
! Installing XML::LibXSLT failed. See /app/.cpanm/work/1412752363.1663/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'XML::LibXSLT' is not installed
! Bailing out the installation for ..
要获得更详细的错误消息,请尝试手动安装:
$ heroku run cpanm --verbose XML::LibXSLT
失败并出现以下错误
....
LD_RUN_PATH="/usr/lib" cc -shared -O2 -g -L/usr/local/lib -fstack-protector LibXSLT.o perl-libxml-mm.o -o blib/arch/auto/XML/LibXSLT/LibXSLT.so \
-L/usr/lib -lxslt -lxml2 -lz -lm -lexslt -lgdbm -lgdbm_compat -ldl -lm -lpthread -lc -lcrypt \
/usr/bin/ld: cannot find -lgdbm
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/XML/LibXSLT/LibXSLT.so] Error 1
FAIL
! Installing XML::LibXSLT failed. See /app/.cpanm/work/1412753360.2/build.log for details. Retry with --force to force install it.
作为noted above,Heroku 已经安装了Ubuntu 软件包libgdbm3 和libxslt1-dev(与heroku run dpkg --get-selection 确认)所以我想知道为什么编译仍然失败。
【问题讨论】:
-
您需要
libgdbm-dev包。*-dev包包含链接所需的头文件。由于您无法安装软件包,因此您可以安装 XML::LibXSLT,头文件位于您控制的目录中。这就是为编译器提供适当路径的问题。 -
谢谢。我认为this answer 将有助于调整编译器设置。
-
我只是让 Heroku 将 libgdbm-dev 添加到他们的堆栈中。