Last active
July 4, 2021 23:35
-
-
Save mishudark/3080857 to your computer and use it in GitHub Desktop.
compile static git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make configure | |
./configure --prefix=/var/www/ CFLAGS="${CFLAGS} `pkg-config –static –libs libcurl`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone stumbling upon this (like I did), this does not actually result in the final binary being static, at least on my system (ubuntu 20.04). You can verify it by running
file /var/www/bin/git
(assuming your prefix is/var/www
like it is in this gist) and it will print "dynamically linked".Try adding the
-static
flag toCFLAGS
, which tells GCC to only use static libraries, i.e.CFLAGS="${CFLAGS} -static $(pkg-config –static –libs libcurl)"
. It will result in a lot of errors, likely because Git has a whole bunch of dependencies which do not provide static libraries.