LoginSignup
5
6

More than 5 years have passed since last update.

curlをソースコードからコンパイルしたときの備忘録

Last updated at Posted at 2017-01-07

環境

  • Raspberry Pi 2
  • Rasbian
    • Debian(jessie)

ソースコードからインストール

$ curl -O https://curl.haxx.se/download/curl-7.52.1.tar.bz2
$ tar xf curl-7.52.1.tar.bz2
$ cd curl-7.52.1
$ ./configure
$ make
$ make install

正常にインストールできたか確認のため次のコマンドを実行。

$ curl http://google.com
curl: (48) An unknown option was passed in to libcurl

エラーになったので原因の調査を行う。

原因調査

curlのバージョンを確認

$ curl -V
curl 7.52.1 (armv7l-unknown-linux-gnueabihf) libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29 libssh2/1.4.3 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API SPNEGO NTLM NTLM_WB SSL libz TLS-SRP 

どうやら、curlが7.52.1に対し、libcurlが7.38.0になっていることが原因らしいので、修正する必要があるらしい。
7.38.0は今回コンパイルしてインストールする前に入っていたバージョン)

修正作業

curlが参照しているlibcurlを確認。

$ which curl
/usr/local/bin/curl
$ ldd /usr/local/bin/curl
    linux-vdso.so.1 (0x7eec8000)
    /usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76fe0000)
    libcurl.so.4 => /usr/lib/arm-linux-gnueabihf/libcurl.so.4 (0x76f65000)
    libssl.so.1.0.0 => /usr/lib/arm-linux-gnueabihf/libssl.so.1.0.0 (0x76f0b000)
    libcrypto.so.1.0.0 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0 (0x76d9d000)
    libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x76d76000)
    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76c35000)
    libidn.so.11 => /usr/lib/arm-linux-gnueabihf/libidn.so.11 (0x76bf3000)
    librtmp.so.1 => /usr/lib/arm-linux-gnueabihf/librtmp.so.1 (0x76bca000)
    libssh2.so.1 => /usr/lib/arm-linux-gnueabihf/libssh2.so.1 (0x76ba8000)
    libgssapi_krb5.so.2 => /usr/lib/arm-linux-gnueabihf/libgssapi_krb5.so.2 (0x76b5e000)
    libkrb5.so.3 => /usr/lib/arm-linux-gnueabihf/libkrb5.so.3 (0x76aaa000)
    libk5crypto.so.3 => /usr/lib/arm-linux-gnueabihf/libk5crypto.so.3 (0x76a6b000)
    libcom_err.so.2 => /lib/arm-linux-gnueabihf/libcom_err.so.2 (0x76a58000)
    liblber-2.4.so.2 => /usr/lib/arm-linux-gnueabihf/liblber-2.4.so.2 (0x76a3c000)
    libldap_r-2.4.so.2 => /usr/lib/arm-linux-gnueabihf/libldap_r-2.4.so.2 (0x769e8000)
    libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x769c0000)
    /lib/ld-linux-armhf.so.3 (0x54b25000)
    libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x769ac000)
    libgnutls-deb0.so.28 => /usr/lib/arm-linux-gnueabihf/libgnutls-deb0.so.28 (0x7689f000)
    libhogweed.so.2 => /usr/lib/arm-linux-gnueabihf/libhogweed.so.2 (0x76866000)
    libnettle.so.4 => /usr/lib/arm-linux-gnueabihf/libnettle.so.4 (0x76826000)
    libgmp.so.10 => /usr/lib/arm-linux-gnueabihf/libgmp.so.10 (0x767b4000)
    libgcrypt.so.20 => /lib/arm-linux-gnueabihf/libgcrypt.so.20 (0x76710000)
    libkrb5support.so.0 => /usr/lib/arm-linux-gnueabihf/libkrb5support.so.0 (0x766f7000)
    libkeyutils.so.1 => /lib/arm-linux-gnueabihf/libkeyutils.so.1 (0x766ec000)
    libresolv.so.2 => /lib/arm-linux-gnueabihf/libresolv.so.2 (0x766c7000)
    libsasl2.so.2 => /usr/lib/arm-linux-gnueabihf/libsasl2.so.2 (0x766a0000)
    libp11-kit.so.0 => /usr/lib/arm-linux-gnueabihf/libp11-kit.so.0 (0x7665e000)
    libtasn1.so.6 => /usr/lib/arm-linux-gnueabihf/libtasn1.so.6 (0x7663e000)
    libgpg-error.so.0 => /lib/arm-linux-gnueabihf/libgpg-error.so.0 (0x76620000)
    libffi.so.6 => /usr/lib/arm-linux-gnueabihf/libffi.so.6 (0x76610000)
    libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x765e2000)

/usr/lib/arm-linux-gnueabihf/libcurl.so.4を参照しているのでこれを置き換える。

$ cd /usr/lib/arm-linux-gnueabihf/
$ libcurl.so.4 libcurl.so.4.bak
$ cp /usr/local/lib/libcurl.so.4 .
$ cp /usr/local/lib/libcurl.so.4.4.0 .
$ curl -V
curl 7.52.1 (armv7l-unknown-linux-gnueabihf) libcurl/7.52.1 OpenSSL/1.0.1t zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy 

あたらしいものに置き換わっていることを確認。

再度、curlの確認

正常に動くか確認。

$ curl http://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.co.jp/?gfe_rd=cr&amp;ei=QgBxWN3nIJHR8gewgLqIDw">here</A>.
</BODY></HTML>

問題なさそう。

参考

 http://juniway.blogspot.jp/2015/12/curl-48-unknown-option-was-passed-in-to.html

5
6
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
6