2017-08-08 10 views
1

DBIパッケージを使用してMySQLデータベースに接続するPerlスクリプトを作成しました。それは必ずしもすべての依存関係がインストールされている他のLinuxプラットフォーム上で実行するようにするには、私は次のコマンドを使用してPar Packer (pp)とすべての依存関係を含む単一のスタンドアロンのファイル作成しています:Perl DBIモジュールのすべての依存関係をPARパッカーアーカイブに追加する方法

pp -c -x -o myscript myscript.pl 

をスタンドアロンのファイルがどこのマシン上で正常に動作しますしかし、他のマシンでは、DBI - > connect()が実行された行で次のエラーが発生します。

install_driver(mysql) failed: Can't load '/tmp/par-6d756e7a/cache-44c3853ef3002ad860cfe135d24ccc8829af39da/89fc0e43.so' for module DBD::mysql: libmysqlclient.so.20: cannot open shared object file: No such file or directory at /usr/lib/x86_64-linux-gnu/perl/5.22/DynaLoader.pm line 187. 
at /usr/local/share/perl/5.22.1/PAR/Heavy.pm line 123. 
Compilation failed in require at (eval 15) line 3. 
Perhaps a required shared library or dll isn't installed where expected 
at DBI/DBHandler.pm line 41. 

ファイルが不足しているようですが、修正方法はわかりません。追加すると、-lib=/tmp/par-6d756e7a/cache-44c3853ef3002ad860cfe135d24ccc8829af39da/89fc0e43.soは機能しません。

更新1

以下LIBSは、既にエラーが発生したサーバにインストールされている:ここ

$ dpkg -l | grep mysql 
ii libdbd-mysql-perl     4.028-2+deb8u2    amd64  Perl5 database interface to the MySQL database 
ii libmysqlclient18:amd64    5.5.54-0+deb8u1    amd64  MySQL database client library 
ii mysql-client       5.5.54-0+deb8u1    all   MySQL database client (metapackage depending on the latest version) 
ii mysql-client-5.5      5.5.54-0+deb8u1    amd64  MySQL database client binaries 
ii mysql-common       5.5.54-0+deb8u1    all   MySQL database common files, e.g. /etc/mysql/my.cnf 

は、例えば、スクリプトである:

#!/usr/bin/perl 

use DBI; 

my $dbh = DBI -> connect("dbi:mysql:homo_sapiens_core_89_38:ensembldb.ensembl.org:3306", "anonymous") || die "Connection Error: $DBI::errstr\n"; 

my $sth = $dbh -> prepare("SELECT * FROM exon limit 10"); 
my $success = $sth -> execute(); 

if (!$success && !defined $DBI::errstr){ 
    print STDERR "Query not successful. No error message returned. Try to continue.\n"; 
} 
elsif (!$success && defined $DBI::errstr){ 
    die "SQL Error: $DBI::errstr\n"; 
} 

while (my @row = $sth -> fetchrow_array){ 
    print join("\t", @row)."\n"; 
} 

$sth -> finish(); 

$dbh -> disconnect(); 

答えて

2

の以下の部分エラーメッセージ:

libmysqlclient.so.20: cannot open shared object file: No such file or directory 

...通常、アンパック/インストールしようとしているシステムにMySQLクライアントライブラリがインストールされていないことを意味します。インストールする必要があります。たとえば、Ubuntuの場合:

sudo apt-get install mysql-client 
+0

このlibは既にインストールされているようです(上記の更新を参照)。 –

関連する問題