5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

cpanでNet::SSLeay入れようとするとエラーになる

Last updated at Posted at 2015-01-10

perlのcpanからNet:SSLeayをインストールしようとしたら次のようなエラーになる事があります。

cpan[1]> install Net::SSLeay
Running install for module 'Net::SSLeay'
Running make for M/MI/MIKEM/Net-SSLeay-1.66.tar.gz
…略…
SSLeay.xs:163:25: error: openssl/err.h: No such file or directory
SSLeay.xs:164:27: error: openssl/lhash.h: No such file or directory
SSLeay.xs:165:26: error: openssl/rand.h: No such file or directory
SSLeay.xs:166:28: error: openssl/buffer.h: No such file or directory
SSLeay.xs:167:25: error: openssl/ssl.h: No such file or directory
SSLeay.xs:168:28: error: openssl/pkcs12.h: No such file or directory
SSLeay.xs:169:74: error: openssl/comp.h: No such file or directory
…略…
SSLeay.c:16528: error: expected '{' at end of input
make: *** [SSLeay.o] Error 1
  MIKEM/Net-SSLeay-1.66.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Failed during this command:
 MIKEM/Net-SSLeay-1.66.tar.gz                 : make NO

エラーを見るとOpenSSLのincludeファイルが見つからないということなので、例えばRHEL/CentOS系Linuxではyumでopenssl-develをインストールすればこのエラーは発生しなくなります。

yumを使っておらず、ソースからOpenSSLをインストールしている人は、インストールしたOpenSSLのincludeファイル等を指定してあげる必要があります。
OpenSSLをソースからインストールするとデフォルトでは「/usr/local/ssl」以下にインストールされるので、makepl_argにそのあたりを指定してあげればOKです。

# perl -MCPAN -e shell
cpan[1]> o conf makepl_arg "INSTALLDIRS=site LIBS='-L/usr/local/ssl/lib -lcrypto -lssl' INC=-I/usr/local/ssl/include"
cpan[2]> install Net::SSLeay
CPAN: Storable loaded ok (v2.20)
Going to read '/root/.cpan/Metadata'
  Database was generated on Sat, 10 Jan 2015 04:53:46 GMT
…略…
Installing /usr/local/share/man/man3/Net::SSLeay::Handle.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
  MIKEM/Net-SSLeay-1.66.tar.gz
  /usr/bin/make install  -- OK

ちなみにo conf commitしなければmakepl_argに設定した内容は保存されません。

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?