2014-10-08 71 views
8

我无法安装上的XML::LibXSLT。它看起来像所需的库gdbm未安装,尽管是在Heroku堆雪松和雪松-14的listed as installed Ubuntu packages。已经有类似的问题报告过in this question,但Heroku没有,并且不允许安装新的Ubuntu软件包。XML :: LibXSLT无法在Heroku上安装

要重现该错误,创建一个最小的仓库,需要XML ::中的libxslt cpanfile

$ 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的软件包libgdbm3libxslt1-dev(与heroku run dpkg --get-selection确认)所以我想知道为什么编译仍然失败。

+7

您将需要'libgdbm-dev'包。 '* -dev'包中包含头文件,这些文件是链接所必需的。由于您无法安装软件包,因此您可以安装XML :: LibXSLT,并将头文件放置在您控制的目录中。这是一个将合适的路径提供给编译器的问题。 – amon 2014-10-08 18:37:21

+1

谢谢。我认为[这个答案](http://stackoverflow.com/questions/558803/how-to-add-a-default-include-path-for-gcc-in-linux)将有助于调整编译器设置。 – Jakob 2014-10-08 20:12:12

+3

我只是要求Heroku将libgdbm-dev添加到他们的堆栈中。 – Jakob 2014-10-16 11:16:34

回答

2

只是尝试安装的libgdbm的开发包

apt-get install libgdbm-dev 

CPAN往往需要DEV-包安装的模块。