Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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=/usr/local all
GIT_VERSION = 1.8.3.4
    * new build flags
    CC credential-store.o
In file included from cache.h:4,
                 from credential-store.c:1:
git-compat-util.h:221:25: warning: openssl/ssl.h: No such file or directory
git-compat-util.h:222:25: warning: openssl/err.h: No such file or directory
In file included from credential-store.c:1:
cache.h:11:21: warning: openssl/sha.h: No such file or directory
cache.h:19:18: warning: zlib.h: No such file or directory
In file included from credential-store.c:1:
cache.h:21: syntax error before "z_stream"
cache.h:21: warning: no semicolon at end of struct or union
cache.h:28: syntax error before '}' token
cache.h:28: warning: type defaults to `int' in declaration of `git_zstream'
cache.h:28: warning: data definition has no type or storage class
cache.h:30: syntax error before '*' token
cache.h:31: syntax error before '*' token
cache.h:32: syntax error before '*' token
cache.h:33: syntax error before '*' token
cache.h:35: syntax error before '*' token
cache.h:36: syntax error before '*' token
cache.h:37: syntax error before '*' token
cache.h:38: syntax error before '*' token
cache.h:39: syntax error before '*' token
cache.h:40: syntax error before '*' token
cache.h:41: syntax error before '*' token
cache.h:42: syntax error before '*' token
cache.h:769: syntax error before '*' token
make: *** [credential-store.o] Error 1

I know this is because of the missing libraries for openssl, but I am unable to get these libraries.

I do not have yum/apt-get on my machines to run the below commands as suggested:

$ yum install curl-devel expat-devel gettext-devel \
  openssl-devel zlib-devel
$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \
  libz-dev libssl-dev

What do I do get these libraries on these machines. These machines do not have internet access, I can do a scp if required. Any suggestions.

Questions related to software install are more suited for Super User. Also you should give details about your OS, package management, etc... – CharlesB Jul 29, 2013 at 7:06 If you can tell us your OS, we might be able to point you to a canonical download location for Git, package managed or no. For popular packages on popular platforms, you should practically never need to compile anything yourself (exempting e.g. Gentoo, where compiling locally is part of the package management architecture). – tripleee Sep 21, 2017 at 3:30

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/

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 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.

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.

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.

    Since 2013 (year of the question on this page), make sure to use a recent enough version of curl.

    With Git 2.34 (Q4 2021), conditional compilation around versions of libcURL has been straightened out.

    See commit 32da6e6, commit e4ff3b6, commit 905a028, commit 2a7f646, commit 7ce3dcd, commit 2d4032c, commit 59a399e (13 Sep 2021), and commit e54e502, commit 5b95244 (11 Sep 2021) by Ævar Arnfjörð Bjarmason (avar).
    (Merged by Junio C Hamano -- gitster -- in commit 8f79fb6, 23 Sep 2021)

    http: don't hardcode the value of CURL_SOCKOPT_OK

    Signed-off-by: Ævar Arnfjörð Bjarmason

    Use the new git-curl-compat.h header to define CURL_SOCKOPT_OK to its known value if we're on an older curl version that doesn't have it.
    It was hardcoded in http.c in a15d069 ("http: enable keepalive on TCP sockets", 2013-10-12, Git v1.8.5-rc0 -- merge).

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.