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.

Community
  • 1
  • 1
Jakob
  • 3,570
  • 3
  • 36
  • 49
  • 7
    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. – amon Oct 08 '14 at 18:37
  • 1
    thanks. I think [this answer](http://stackoverflow.com/questions/558803/how-to-add-a-default-include-path-for-gcc-in-linux) will help to adjust the compiler settings. – Jakob Oct 08 '14 at 20:12
  • 3
    I just asked Heroku to add libgdbm-dev to their stack. – Jakob Oct 16 '14 at 11:16

1 Answers1

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.

D. Gertzen
  • 21
  • 3