Ubuntu14.04 で Image::Magick

  • 2
    Like
  • 0
    Comment

依頼で第三者が作成した CGI を Web サーバに設置した。Webサーバー Apache なので、 cgiモジュール有効にして、 ExecCGI 設定するだけで簡単と思っていたら Perl の ImageMagick モジュールに思いの外てこずったのでメモ。

パーミッション設定

まずは動作するかチェック


# ./index.cgi
bash: ./index.cgi: Permission denied
# ls -alh
total 100K
drwxr-xr-x 6 hoge hoge 4.0K May  9 08:01 .
drwxr-xr-x 5 hoge hoge 4.0K May 15 23:42 ..
-rw-r--r-- 1 hoge hoge  364 May 15 23:25 common.cgi
-rw-r--r-- 1 hoge hoge 9.2K May 15 23:25 common.css
-rw-r--r-- 1 hoge hoge 2.5K May 15 23:25 common-sys.cgi
drwxr-xr-x 2 hoge hoge 4.0K May  9 08:01 data
-rw-r--r-- 1 hoge hoge  749 May 15 23:25 error.htm
-rw-r--r-- 1 hoge hoge 2.2K May 15 23:25 form.cgi
-rw-r--r-- 1 hoge hoge 2.4K May 15 23:25 form.htm
-rw-r--r-- 1 hoge hoge  12K May 15 23:25 form.js
-rw-r--r-- 1 hoge hoge  111 May 15 23:25 .htaccess
-rw-r--r-- 1 hoge hoge 1.6K May 15 23:25 image.js
drwxr-xr-x 2 hoge hoge 4.0K May  9 08:01 images
-rw-r--r-- 1 hoge hoge   39 May 15 23:25 index.cgi
-rw-r--r-- 1 hoge hoge 1.4K May 15 23:25 insch.cgi
drwxr-xr-x 4 hoge hoge 4.0K May 15 23:46 libpman
-rw-r--r-- 1 hoge hoge 1.4K May 15 23:25 s-common.css
-rw-r--r-- 1 hoge hoge 2.4K May 15 23:25 sel.cgi
-rw-r--r-- 1 hoge hoge 2.2K May 15 23:25 sel.htm
drwxr-xr-x 2 hoge hoge 4.0K May  9 08:01 setting
-rw-r--r-- 1 hoge hoge 1.2K May 15 23:25 style.css

ということで、安直に 777 に設定


# chmod 777 index.cgi

ImageMagickモジュール

# ./index.cgi
Can't locate Image/Magick.pm in @INC (you may need to install the Image::Magick module) (@INC contains: libpman ../lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at libpman/pkstaff/photo.pl line 19.
BEGIN failed--compilation aborted at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at setting/sys-setting.cgi line 8.
Compilation failed in require at ./common-sys.cgi line 14.
Compilation failed in require at ./form.cgi line 7.
Compilation failed in require at ./index.cgi line 3.

試しに form.cgi の中身を見てみる


# cat form.cgi
#!/usr/bin/perl

# ʸ�������ɤ�EUC

require './common.cgi';
PMBase::set_cgi_subname('form');
require './common-sys.cgi';

## Header
PMStaff::Base::print_sheader();

## Init
{
    $InsMode = '';
    $CopyMode = '';
}
...

更に setting/sys-setting.cgi の中身を見てみる

# cat setting/sys-setting.cgi
#!/usr/bin/perl

## �����ƥ�����
##==============

## �����������̾�
##---------------
require 'pkstaff/photo.pl';
PKStaff::Photo::set_read_error('�����ν̾��˼��Ԥ��ޤ�����');

# ���ޤ��Ϲ⤵�������ͤ�Ķ���Ƥ������硢�������̾�����
#
PKStaff::Photo::install_limit(600);

# �����Υե������ɤ������ͤ��Ѥ���
#
#PKStaff::Photo::set_limit_width_and_height_for('photo2', 200, 200);

...

ちゃんとエラーメッセージ理解すればカンタンなんだけど、ここでは Perl うろ覚えで INC 構文がどこかにあるんだと思い込んで検索したけど該当なし


# grep -R INC *
#

改めてエラーメッセージ見てみる

# ./index.cgi
Can't locate Image/Magick.pm in @INC (you may need to install the Image::Magick module) (@INC contains: libpman ../lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at libpman/pkstaff/photo.pl line 19.
BEGIN failed--compilation aborted at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at setting/sys-setting.cgi line 8.
Compilation failed in require at ./common-sys.cgi line 14.
Compilation failed in require at ./form.cgi line 7.
Compilation failed in require at ./index.cgi line 3.

改めてエラーの場所を特定


# grep -R Magick *
libpman/pkstaff/photo.pl:   use Image::Magick;
libpman/pkstaff/photo.pl:   my $image = Image::Magick->new();

なるほど、 Perl は use 構文でこう指定するのですね。
必要なライブラリを、 cgi プログラム作成者がディレクトリ内に全て自前で配置しているということがないかどうか、 use で検索


# grep -R use *
common.cgi:use lib '../lib';
common.cgi:use lib 'libpman';
error.htm:      <button type="button" onclick="javascript:history.back()" id="bu-back" class="bu-back" onMouseOut="restoreStyle()" onMouseOver="swapStyle('bu-back','bu-back-on')"><span class="hide">����</span></button>
form.htm:    <td colspan="2"><button type="submit" id="bu-search" 
...

余計なのが出てきたので検索しなおし

# grep -R 'use ' *
common.cgi:use lib '../lib';
common.cgi:use lib 'libpman';
libpman/pkstaff/photo.pl:   use Image::Magick;

なるほど、多分 ImageMagick モジュールがシステムにインストールされていることが前提なのでしょうね。それさえ入れれば良さそうですね。
まずは ImageMagick 本体をインストール


# apt-get install imagemagick
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gir1.2-gudev-1.0 libfile-copy-recursive-perl libgudev-1.0-0 ttf-dejavu-core
  update-inetd
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  fontconfig fontconfig-config fonts-dejavu-core ghostscript gir1.2-glib-2.0
  gsfonts hicolor-icon-theme imagemagick-common libavahi-client3
  libavahi-common-data libavahi-common3 libcairo2 libcgmanager0 libcroco3
  libcups2 libcupsfilters1 libcupsimage2 libdatrie1 libdjvulibre-text
  libdjvulibre21 libfftw3-double3 libfontconfig1 libgcrypt11
  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgirepository-1.0-1
  libglib2.0-0 libgnutls26 libgraphite2-3 libgs9 libgs9-common libharfbuzz0b
  libijs-0.35 libilmbase6 libjasper1 libjbig0 libjbig2dec0 libjson-c2 libjson0
  liblcms2-2 liblqr-1-0 libmagickcore5 libmagickcore5-extra libmagickwand5
  libnetpbm10 libopenexr6 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0
  libpaper-utils libpaper1 libpixman-1-0 libplymouth2 librsvg2-2
  librsvg2-common libtasn1-6 libthai-data libthai0 libtiff5 libudev1
  libwmf0.2-7 libx11-6 libxcb-render0 libxcb-shm0 libxcb1 libxml2 libxrender1
  netpbm plymouth poppler-data python-gi ttf-dejavu-core upstart
Suggested packages:
  ghostscript-x hpijs imagemagick-doc autotrace cups-bsd lpr lprng enscript
  ffmpeg gimp gnuplot grads hp2xx html2ps libwmf-bin mplayer povray radiance
  sane-utils texlive-base-bin transfig xdg-utils ufraw-batch cups-common
  libfftw3-bin libfftw3-dev rng-tools gnutls-bin fonts-droid libjasper-runtime
  liblcms2-utils ttf-baekmuk ttf-arphic-gbsn00lp ttf-arphic-bsmi00lp
  ttf-arphic-gkai00mp ttf-arphic-bkai00mp librsvg2-bin libwmf0.2-7-gtk
  poppler-utils fonts-japanese-mincho fonts-ipafont-mincho
  fonts-japanese-gothic fonts-ipafont-gothic fonts-arphic-ukai
  fonts-arphic-uming fonts-unfonts-core python-gi-cairo graphviz
  upstart-monitor
Recommended packages:
  libglib2.0-data shared-mime-info
The following NEW packages will be installed:
  fontconfig fonts-dejavu-core ghostscript gsfonts hicolor-icon-theme
  imagemagick imagemagick-common libavahi-client3 libavahi-common-data
  libavahi-common3 libcairo2 libcgmanager0 libcroco3 libcups2 libcupsfilters1
  libcupsimage2 libdatrie1 libdjvulibre-text libdjvulibre21 libfftw3-double3
  libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgraphite2-3 libgs9
  libgs9-common libharfbuzz0b libijs-0.35 libilmbase6 libjasper1 libjbig0
  libjbig2dec0 libjson-c2 libjson0 liblcms2-2 liblqr-1-0 libmagickcore5
  libmagickcore5-extra libmagickwand5 libnetpbm10 libopenexr6 libpango-1.0-0
  libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1 libpixman-1-0
  librsvg2-2 librsvg2-common libtasn1-6 libthai-data libthai0 libtiff5
  libudev1 libwmf0.2-7 libxcb-render0 libxcb-shm0 libxrender1 netpbm
  poppler-data
The following packages will be upgraded:
  fontconfig-config gir1.2-glib-2.0 libfontconfig1 libgcrypt11
  libgirepository-1.0-1 libglib2.0-0 libgnutls26 libplymouth2 libx11-6 libxcb1
  libxml2 plymouth python-gi ttf-dejavu-core upstart
15 upgraded, 59 newly installed, 0 to remove and 411 not upgraded.
Need to get 21.9 MB of archives.
After this operation, 66.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libgcrypt11 amd64 1.5.3-2ubuntu4.4 [238 kB]
Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libtasn1-6 amd64 3.4-3ubuntu0.4 [43.6 kB]
Get:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libgnutls26 amd64 2.12.23-12ubuntu2.7 [395 kB]
...

...
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.30.7-0ubuntu1.6) ...
g_module_open() failed for /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.so: libjpeg.so.8: cannot open shared object file: No such file or directory
g_module_open() failed for /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so: libjpeg.so.8: cannot open shared object file: No such file or directory
g_module_open() failed for /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jasper.so: libjpeg.so.8: cannot open shared object file: No such file or directory

なんか最後の方出てるけど今回の動作には問題なかった

次には Perl モジュール入れるには?? ディストリビューションで用意されているパッケージを入れるという方針で。


# apt-cache search imagemagick
groff - GNU troff text-formatting system
imagemagick - image manipulation programs
imagemagick-common - image manipulation programs -- infrastructure
imagemagick-dbg - debugging symbols for ImageMagick
...

いっぱい出てきたのでフィルターかける。


# apt-cache search imagemagick | grep perl
perlmagick - Perl interface to the ImageMagick graphics routines
libchart-gnuplot-perl - module for generating two- and three-dimensional plots
libgraphics-magick-perl - format-independent image processing - perl interface

libgraphics-magick-perl 、これかな?


# apt-get install libgraphics-magick-perl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gir1.2-gudev-1.0 libfile-copy-recursive-perl libgudev-1.0-0 ttf-dejavu-core
  update-inetd
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libgraphicsmagick3
Suggested packages:
  graphicsmagick-dbg
The following NEW packages will be installed:
  libgraphics-magick-perl libgraphicsmagick3
0 upgraded, 2 newly installed, 0 to remove and 411 not upgraded.
Need to get 1,094 kB of archives.
After this operation, 3,852 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty/universe libgraphicsmagick3 amd64 1.3.18-1ubuntu3 [1,041 kB]
Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty/universe libgraphics-magick-perl amd64 1.3.18-1ubuntu3 [53.2 kB]
Fetched 1,094 kB in 0s (19.2 MB/s)            
Selecting previously unselected package libgraphicsmagick3.
(Reading database ... 37289 files and directories currently installed.)
Preparing to unpack .../libgraphicsmagick3_1.3.18-1ubuntu3_amd64.deb ...
Unpacking libgraphicsmagick3 (1.3.18-1ubuntu3) ...
Selecting previously unselected package libgraphics-magick-perl.
Preparing to unpack .../libgraphics-magick-perl_1.3.18-1ubuntu3_amd64.deb ...
Unpacking libgraphics-magick-perl (1.3.18-1ubuntu3) ...
Processing triggers for man-db (2.6.1-2ubuntu1) ...
Setting up libgraphicsmagick3 (1.3.18-1ubuntu3) ...
Setting up libgraphics-magick-perl (1.3.18-1ubuntu3) ...
Processing triggers for libc-bin (2.15-0ubuntu10.7) ...
ldconfig deferred processing now taking place

これでどうかな?


# ./index.cgi 
Can't locate Image/Magick.pm in @INC (you may need to install the Image::Magick module) (@INC contains: libpman ../lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at libpman/pkstaff/photo.pl line 19.
BEGIN failed--compilation aborted at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at setting/sys-setting.cgi line 8.
Compilation failed in require at ./common-sys.cgi line 14.
Compilation failed in require at ./form.cgi line 7.
Compilation failed in require at ./index.cgi line 3.

あれ、違った! ググると、libimage-magick-perl というものが正解らしい。


# apt-get install libimage-magick-perl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'perlmagick' instead of 'libimage-magick-perl'
The following packages were automatically installed and are no longer required:
  gir1.2-gudev-1.0 libfile-copy-recursive-perl libgudev-1.0-0 ttf-dejavu-core
  update-inetd
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libperl5.18 perl perl-base perl-modules
Suggested packages:
  perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl make
  libb-lint-perl libcpanplus-dist-build-perl libcpanplus-perl
  libfile-checktree-perl liblog-message-perl libobject-accessor-perl
  imagemagick-doc
The following NEW packages will be installed:
  libperl5.18 perlmagick
The following packages will be upgraded:
  perl perl-base perl-modules
3 upgraded, 2 newly installed, 0 to remove and 408 not upgraded.
Need to get 6,608 kB of archives.
After this operation, 585 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl amd64 5.18.2-2ubuntu1.1 [2,648 kB]
Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl-base amd64 5.18.2-2ubuntu1.1 [1,146 kB]
Get:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perl-modules all 5.18.2-2ubuntu1.1 [2,673 kB]
Get:4 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main libperl5.18 amd64 5.18.2-2ubuntu1.1 [1,332 B]
Get:5 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/main perlmagick amd64 8:6.7.7.10-6ubuntu3.6 [139 kB]
Fetched 6,608 kB in 0s (21.1 MB/s)
(Reading database ... 37319 files and directories currently installed.)
Preparing to unpack .../perl_5.18.2-2ubuntu1.1_amd64.deb ...
Unpacking perl (5.18.2-2ubuntu1.1) over (5.18.2-2ubuntu1) ...
Preparing to unpack .../perl-base_5.18.2-2ubuntu1.1_amd64.deb ...
Unpacking perl-base (5.18.2-2ubuntu1.1) over (5.18.2-2ubuntu1) ...
Processing triggers for man-db (2.6.1-2ubuntu1) ...
Setting up perl-base (5.18.2-2ubuntu1.1) ...
(Reading database ... 37319 files and directories currently installed.)
Preparing to unpack .../perl-modules_5.18.2-2ubuntu1.1_all.deb ...
Unpacking perl-modules (5.18.2-2ubuntu1.1) over (5.18.2-2ubuntu1) ...
Selecting previously unselected package libperl5.18.
Preparing to unpack .../libperl5.18_5.18.2-2ubuntu1.1_amd64.deb ...
Unpacking libperl5.18 (5.18.2-2ubuntu1.1) ...
Selecting previously unselected package perlmagick.
Preparing to unpack .../perlmagick_8%3a6.7.7.10-6ubuntu3.6_amd64.deb ...
Unpacking perlmagick (8:6.7.7.10-6ubuntu3.6) ...
Processing triggers for man-db (2.6.1-2ubuntu1) ...
Setting up libperl5.18 (5.18.2-2ubuntu1.1) ...
Setting up perl-modules (5.18.2-2ubuntu1.1) ...
Setting up perl (5.18.2-2ubuntu1.1) ...
Setting up perlmagick (8:6.7.7.10-6ubuntu3.6) ...
Processing triggers for libc-bin (2.15-0ubuntu10.7) ...
ldconfig deferred processing now taking place

cgi実行してみる

# ./index.cgi Can't load '/usr/lib/perl5/auto/Image/Magick/Magick.so' for module Image::Magick: libgomp.so.1: cannot open shared object file: No such file or directory at /usr/lib/perl/5.18/DynaLoader.pm line 184.
 at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at libpman/pkstaff/photo.pl line 19.
BEGIN failed--compilation aborted at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at setting/sys-setting.cgi line 8.
Compilation failed in require at ./common-sys.cgi line 14.
Compilation failed in require at ./form.cgi line 7.
Compilation failed in require at ./index.cgi line 3.
&Image::Magick::constant not defined. The required ImageMagick libraries are not installed or not installed properly.
END failed--call queue aborted at ./index.cgi line 3.

こんどは共有オブジェクトライブラリが無い。
ここから少し迷走してしまう。


# apt-get intall perlmagick
E: Invalid operation intall

ミスタイプしたり

# apt-get install perlmagick
Reading package lists... Done
Building dependency tree       
Reading state information... Done
perlmagick is already the newest version.
The following packages were automatically installed and are no longer required:
  gir1.2-gudev-1.0 libfile-copy-recursive-perl libgudev-1.0-0 ttf-dejavu-core
  update-inetd
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 408 not upgraded.

別のパッケージが必要なのかと思ったり。実際は perlmagick は Ubuntu 14.04 においては先程インストールした libimage-magick-perl と同じものを指すので意味がなかった。


# apt-get install libmagick-devel
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libmagick-devel

develパッケージが必要かなと探してみたり。


# apt-cache search libmagick
libmagick++-dev - object-oriented C++ interface to ImageMagick - development files
libmagick++5 - object-oriented C++ interface to ImageMagick
libmagickcore-dev - low-level image manipulation library - development files
libmagickcore5 - low-level image manipulation library
libmagickcore5-extra - low-level image manipulation library - extra codecs
libmagickwand-dev - image manipulation library - development files
libmagickwand5 - image manipulation library
graphicsmagick-libmagick-dev-compat - image processing libraries providing ImageMagick interface

迷路から戻って、改めてエラーメッセージを見てみる。


# ./index.cgi Can't load '/usr/lib/perl5/auto/Image/Magick/Magick.so' for module Image::Magick: libgomp.so.1: cannot open shared object file: No such file or directory at /usr/lib/perl/5.18/DynaLoader.pm line 184.
 at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at libpman/pkstaff/photo.pl line 19.
BEGIN failed--compilation aborted at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at setting/sys-setting.cgi line 8.
Compilation failed in require at ./common-sys.cgi line 14.
Compilation failed in require at ./form.cgi line 7.
Compilation failed in require at ./index.cgi line 3.
&Image::Magick::constant not defined. The required ImageMagick libraries are not installed or not installed properly.
END failed--call queue aborted at ./index.cgi line 3.

なんだ、 libgomp1.so.1 が無いと出てるじゃん。
Ubuntu パッケージ検索で探すと libgomp1 で収録だそうで。
http://packages.ubuntu.com/ja/

# apt-get install libomp1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libomp1

おっと


# apt-get install libgomp1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gir1.2-gudev-1.0 libfile-copy-recursive-perl libgudev-1.0-0 ttf-dejavu-core
  update-inetd
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  gcc-4.8-base
The following NEW packages will be installed:
  gcc-4.8-base
The following packages will be upgraded:
  libgomp1
1 upgraded, 1 newly installed, 0 to remove and 407 not upgraded.
Need to get 39.3 kB of archives.
After this operation, 227 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
...

実行してみる


# ./index.cgi 
Can't load '/usr/lib/perl5/auto/Image/Magick/Magick.so' for module Image::Magick: libltdl.so.7: cannot open shared object file: No such file or directory at /usr/lib/perl/5.18/DynaLoader.pm line 184.
 at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at libpman/pkstaff/photo.pl line 19.
BEGIN failed--compilation aborted at libpman/pkstaff/photo.pl line 19.
Compilation failed in require at setting/sys-setting.cgi line 8.
Compilation failed in require at ./common-sys.cgi line 14.
Compilation failed in require at ./form.cgi line 7.
Compilation failed in require at ./index.cgi line 3.
&Image::Magick::constant not defined. The required ImageMagick libraries are not installed or not installed properly.
END failed--call queue aborted at ./index.cgi line 3.

今度は libltdl.so.7 が無いと出たので同様に

# apt-get install libltdl7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gir1.2-gudev-1.0 libfile-copy-recursive-perl libgudev-1.0-0 ttf-dejavu-core
  update-inetd
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libltdl-dev
Suggested packages:
  libtool-doc
The following packages will be upgraded:
  libltdl-dev libltdl7
2 upgraded, 0 newly installed, 0 to remove and 405 not upgraded.
Need to get 192 kB of archives.
After this operation, 20.5 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
...

今度はどうかな

# ./index.cgi 
defined(%hash) is deprecated at ../lib/charcode/jcode.pl line 700.
    (Maybe you should just omit the defined()?)
defined(%hash) is deprecated at ../lib/charcode/jcode.pl line 709.
    (Maybe you should just omit the defined()?)
Content-type: text/html; charset=euc-jp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-jp">
...

動いた

あとはパーミッションなどを設定して、やれやれ。