“openssl/ssl.h: No such file or directory” during Installation of Git

前端 未结 6 1887
心在旅途
心在旅途 2020-12-30 23:31

Trying to install git on the Unix and Linux machines based on the instructions on Installing Git blog, and it is failing with the below error

make prefix=/u         


        
相关标签:
6条回答
  • 2020-12-31 00:02

    If you do not have access to prebuilt packages for the required libraries, you have to resort to the age-old practice from before there were package managers: Build the libraries locally, and the libraries they depend on, and the libraries they depend on, and so on.

    In other words, you are in for a potentially large and complex maze of dependency chasing, which might include fixing portability bugs for your platform if the source does not compile out of the box.

    The Debian PTS has links to upstream projects for many packages, so you might not need to guess which result to pick out of Google results for "openssl source". See e.g. http://packages.qa.debian.org/o/openssl.html (the "Browse source code" link is a good start; the Debian Copyright file for each package should also contain an upstream URL, although it may be historical).

    Also:

    • http://packages.qa.debian.org/c/curl.html
    • http://packages.qa.debian.org/e/expat.html
    • http://packages.qa.debian.org/g/gettext.html
    • http://packages.qa.debian.org/z/zlib.html

    If you have a package manager locally (on Debian, that would be the basic dpkg) then you can avoid the finding and compiling morass, and just copy the required hierarchy of depended packages from an Internet-connected host; but again, make sure you get the full set of recursive dependencies (anything that a package you depend on in turn depends on, recursively). E.g. https://packages.debian.org/stable/openssl shows you which packages the openssl Debian package depends on; some of those will have a similar list of dependencies of their own, in turn.

    0 讨论(0)
  • 2020-12-31 00:05

    For RHEL and RHEL-derivatives like CentOS systems, installing will solve this problem.

    $ yum install -y openssl-devel
    
    0 讨论(0)
  • 2020-12-31 00:09

    this answer worked just fine for me

    https://stackoverflow.com/a/3016986/5837509

    just do sudo apt-get install libssl-dev

    0 讨论(0)
  • 2020-12-31 00:15

    For ubuntu i installed openssl and libssl-dev

    sudo apt install openssl libssl-dev

    After checking configure file code, i found it is searching for "include/openssl/ssl.h" in predefined paths

    You can find it on your system and can run configure with --with-openssl

    E.g. if you found ssl.h in /usr/include/openssl/ssl.h then you can run below command

    ./configure --with-openssl=/usr/

    0 讨论(0)
  • 2020-12-31 00:24

    The following fixed compiling python 3.8.1 with ssl

       locate ssl.h
        /usr/include/openssl/ssl.h
    
       $ pwd
        /var/opt/python381/Python-3.8.1
        $ ln -s /usr/include/openssl
    

    Result

    ./configure
    
    ~~
    
    checking whether compiling and linking against OpenSSL works... yes
    checking for X509_VERIFY_PARAM_set1_host in libssl... yes
    
    0 讨论(0)
  • 2020-12-31 00:25

    If you can't access yum, apt-get etc (such as being on a cluster machine with no sudo access), install a new version of openssl locally and manually as follows:

    Get the source code, unpack it, enter the directory and make a build directory (very important):

    wget https://www.openssl.org/source/openssl-1.0.2r.tar.gz
    tar -xvzf openssl-1.0.2r.tar.gz
    cd openssl-1.0.2r
    mkdir builddir
    

    Configure to your local build destination (make sure its different to your source directory, don't use just /home/yourdir/openssl-1.0.2r/), make and install:

    ./config --prefix=/home/yourdir/openssl-1.0.2r/builddir --openssldir=/home/yourdir/openssl-1.0.2r/builddir
    make
    make install
    

    Add the bin and library paths from the build directory to the appropriate variables in your your shell config file (i.e. ~/.bashrc), and source it:

    export PATH=/home/yourdir/openssl-1.0.2r/builddir/bin:$PATH
    LD_LIBRARY_PATH="/your/other/dirs/libs:/home/yourdir/openssl-1.0.2r/builddir/lib:"
    source ~/.bashrc
    

    OpenSSL should now be in your new directory by default:

    which openssl
    > /home/yourdir/openssl-1.0.2r/builddir/bin/openssl
    

    Now try and reinstall git, perhaps with make distclean.

    0 讨论(0)
提交回复
热议问题