Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
2
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

【学習メモ】curl-7.59.0のインストール後はldconfigが必要

まとめ

curl(7.59.0)をソースインストールしたら、ldconfigが必要。

作業手順

環境

CentOS6.9 Basic Server + Development(Additional Development, Development tools, Server Platform Development)

Opensslのインストール

wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz ;\
tar xf openssl-1.0.2o.tar.gz ;\
chown -R root. openssl-1.0.2o ;\
cd openssl-1.0.2o ;\
./config --prefix=/usr/local/openssl-1.0.2o shared -fPIC ;\
make -j2 && make test && make install ;\
cd /usr/local ;\
ln -s openssl-1.0.2o openssl ;\
cd openssl ;\
ln -s lib lib64 ;\
echo -e "/usr/local/openssl-1.0.2o/lib64\n/usr/local/openssl-1.0.2o/lib\n/usr/local/lib64\n/usr/local/lib" >> /etc/ld.so.conf

curlのインストール

wget https://curl.mirror.anstey.ca/curl-7.59.0.tar.gz ;\
tar xf curl-7.59.0.tar.gz ;\
chown -R root. curl-7.59.0 ;\
cd curl-7.59.0 ;\
./configure --with-ssl=/usr/local/openssl-1.0.2o --enable-libcurl-option ;\
make -j2 && make install 
  • make testは失敗した。rootでやるのは良くないみたい?

curlで失敗する

# curl --version
curl 7.59.0 (x86_64-pc-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Release-Date: 2018-03-14
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp 
Features: IDN IPv6 Largefile NTLM SSL libz 
# curl yahoo.co.jp
curl: (2) Failed initialization

初期化って何?

確認したこと

共有ライブラリの依存関係の確認

特に問題なさそうな結果。

# which curl                                                                                 
/usr/local/bin/curl
# ldd /usr/local/bin/curl
        linux-vdso.so.1 =>  (0x00007ffdb05d9000)
        libcurl.so.4 => /usr/lib64/libcurl.so.4 (0x00007f457f328000)
        libssl.so.1.0.0 => /usr/local/openssl-1.0.2o/lib64/libssl.so.1.0.0 (0x00007f457f0b8000)
        libcrypto.so.1.0.0 => /usr/local/openssl-1.0.2o/lib64/libcrypto.so.1.0.0 (0x00007f457ec81000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f457ea6b000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f457e863000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f457e4cf000)
        libidn.so.11 => /lib64/libidn.so.11 (0x00007f457e29d000)
        libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x00007f457e04c000)
        libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f457de08000)
        libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f457db21000)
        libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f457d8f5000)
        libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f457d6f1000)
        libssl3.so => /usr/lib64/libssl3.so (0x00007f457d4a4000)
        libsmime3.so => /usr/lib64/libsmime3.so (0x00007f457d278000)
        libnss3.so => /usr/lib64/libnss3.so (0x00007f457cf35000)
        libnssutil3.so => /usr/lib64/libnssutil3.so (0x00007f457cd08000)
        libplds4.so => /lib64/libplds4.so (0x00007f457cb04000)
        libplc4.so => /lib64/libplc4.so (0x00007f457c8ff000)
        libnspr4.so => /lib64/libnspr4.so (0x00007f457c6c1000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f457c4a4000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f457c2a0000)
        libssh2.so.1 => /usr/lib64/libssh2.so.1 (0x00007f457c078000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f457f57d000)
        liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x00007f457be69000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f457bc4f000)
        libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x00007f457ba35000)
        libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f457b82a000)
        libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f457b627000)
        libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f457b3bb000)
        libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f457afd6000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f457ad9f000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f457ab80000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007f457a97d000)

コンパイラのバージョンと、サポートしているバージョンの確認。

# gcc --version ; g++ --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# grep gcc /usr/local/src/curl-7.59.0/*
(略)
# less /usr/local/src/curl-7.59.0/CHANGES
(略)
Marcel Raad (21 Jun 2017)
- lib1521: fix missing-variable-declarations clang warnings

  Declare TU-local variables static.

- travis: enable typecheck-gcc warnings

  - switch debug and release configurations so that we get an optimized
    build with GCC 4.3+ as required by typecheck-gcc
  - enable warnings-as-errors for release builds
    (which have warnings disabled)
(略)

gccでgrepしてみるとGCCのバージョンに関して書いてある。
4.3以上が必要みたいだけど、バージョン的には問題なさそう。

そして

なんとなくldconfigしたらcurlできるようになった。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
2
Help us understand the problem. What are the problem?