Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML::LibXSLT fails to install at Heroku

I fail to install XML::LibXSLT on Heroku. It looks like the required libraries gdbm is not installed, despite being listed as installed Ubuntu packages at Heroku stack cedar and cedar-14. Similar problems have been reported in this question but not on Heroku and its not allowed to install new Ubuntu packages.

To reproduce the error, create a minimal repository, requiring XML::LibXSLT in 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"

Create a new Heroku app with heroku-buildpack-perl to run cpanm:

$ heroku create --stack cedar --buildpack https://github.com/miyagawa/heroku-buildpack-perl.git
$ git push heroku master

The error log contains

! 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 ..

To get more verbose error message, try to install by hand:

$ heroku run cpanm --verbose XML::LibXSLT

The fails with the following error

....
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.

As noted above, Heroku has installed Ubuntu packages libgdbm3 and libxslt1-dev (confirm with heroku run dpkg --get-selection) so I wonder why compilation still fails.

like image 565
Jakob Avatar asked Oct 08 '14 07:10

Jakob


1 Answers

Just try to install the developer package of libgdbm

apt-get install libgdbm-dev

CPAN needs often the dev-packages to install the modules.

like image 100
D. Gertzen Avatar answered Nov 11 '22 15:11

D. Gertzen