XML::LibXSLT fails to install at Heroku
Asked Answered
E

1

8

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.

Eric answered 8/10, 2014 at 7:36 Comment(3)
You would need the libgdbm-dev package. The *-dev packages include the header files, which are required for linking. As you can't install packages, you might be able to install XML::LibXSLT with the header files located in a directory under your control. This is then a question of feeding the appropriate paths to the compiler.Overarch
thanks. I think this answer will help to adjust the compiler settings.Eric
I just asked Heroku to add libgdbm-dev to their stack.Eric
C
2

Just try to install the developer package of libgdbm

apt-get install libgdbm-dev

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

Castorina answered 16/6, 2016 at 6:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.