Git 2.4.8 built from kernel.org sources and missin

2020-02-16 05:49发布

问题:

This is similar to git clone: fatal: Unable to find remote helper for 'https'. This is a little different than other similar questions. The other similar question was on Ubuntu and had a package manager that provided up to date componentes.

This setup is basically an abandoned OS. There is no existing Git, and there are no package managers available (like Yum, Apt-Get, Homebrew or Macports). Everything Git and cURL needs was built from scratch and installed in /usr/local, and it includes:

  • libz (Zlib library)
  • libssl and libcrypto (OpenSSL libraries)
  • libidn (IDN library)
  • libiconv (iConvert library)
  • libpcre (PERL RE library)
  • libcurl (cURL library)

I'm using the recipe below for cURL. cURL has both HTTP and HTTPS support. cURL configures, builds, tests and installs fine.

I'm using the following recipe for Git. Git configures and builds fine. According to configure --help I only need to call out cURL to get HTTP and HTTPS support:

$ ./configure --help | egrep -i "(http|openssl)"
  --with-openssl          use OpenSSL library (default is YES)
                          ARG can be prefix for openssl library and headers
  --with-curl             support http(s):// transports (default is YES)

However, Git fails when attempting to perform a clone over both HTTP and HTTPS. I've built from scratch twice, so whatever I am doing wrong, I've done it twice now.

Why is Git failing to build the helpers it needs?


Git Recipe

curl -k https://www.kernel.org/pub/software/scm/git/git-2.4.8.tar.gz -o git-2.4.8.tar.gz
tar zf git-2.4.8.tar.gz
cd git-2.4.8
make configure
sed -i "" 's|-lcrypto|/usr/local/lib/libcrypto.a|g' configure.ac configure Makefile
sed -i "" 's|-lssl|/usr/local/lib/libssl.a|g' configure.ac configure Makefile
sed -i "" 's|-lcurl|/usr/local/lib/libcurl.a|g' configure.ac configure Makefile
sed -i "" 's|-lpcre|/usr/local/lib/libpcre2-posix.a|g' configure.ac configure Makefile
./configure --with-openssl=/usr/local --with-libpcre=/usr/local --with-curl=/usr/local \
--with-zlib=/usr/local --with-iconv=/usr/local --prefix=/usr/local

cURL Recipe

curl -k http://curl.haxx.se/download/curl-7.44.0.tar.gz -o curl-7.44.0.tar.gz
tar zf curl-7.44.0.tar.gz
cd curl-7.44.0
sed -i "" 's|-lidn|/usr/local/lib/libidn.a|g' configure.ac configure lib/Makefile.m32 src/Makefile.m32
./configure --enable-optimize --disable-ldap --disable-ldaps --disable-rtsp --disable-dict \
--disable-ntlm-wb --disable-tls-srp --enable-http --enable-file --enable-proxy \
--enable-telnet --enable-tftp --enable-pop3 --enable-imap --enable-ftp --enable-smb \
--enable-smtp --enable-gopher --enable-manual --enable-ipv6 --enable-unix-sockets \
--enable-cookies --without-darwinssl --without-libssh2 --without-winidn --with-gnu-ld \
--with-libidn=/usr/local --with-glib=/usr/local --with-ssl=/usr/local \
--with-ca-path=/usr/share/curl --prefix=/usr/local

The calls to sed in the recipes ensures I am using static linking. Its needed on OS X, because Apple always uses *.dylibs if they are available (even with options like -Bstatic). To make matters a little worse, this is an older PowerMac running OS X 10.5 on a PowerPC. Its used to test software on the processor.

回答1:

Why is Git failing to build the helpers it needs?

There appears to be at least two problems. First, Git's configure does not report errors. Rather, it silently swallows them. It silently swallowed an error with the PCRE library, too.

Second, the cURL architecture -arch ppc is being changes to -arch ppc7400. So the eight or so dependent libraries look like:

$ file /usr/local/lib/libcrypto.a
/usr/local/lib/libcrypto.a: Mach-O universal binary with 2 architectures
/usr/local/lib/libcrypto.a (for architecture ppc):    current ar
archive random library
/usr/local/lib/libcrypto.a (for architecture ppc64):    current ar
archive random library

But cURL looks like:

$ file /usr/local/lib/libcurl.a
/usr/local/lib/libcurl.a: Mach-O universal binary with 2 architectures
/usr/local/lib/libcurl.a (for architecture ppc7400):    current ar
archive random library
/usr/local/lib/libcurl.a (for architecture ppc64):    current ar
archive random library

I verified its not my setting:

export CFLAGS="-arch ppc"
./configure ...
make

Then:

$ find . -name libcurl.a
./lib/.libs/libcurl.a
$ lipo -info ./lib/.libs/libcurl.a
...
Non-fat file: ./lib/.libs/libcurl.a is architecture: ppc7400

export LDFLAGS="-arch ppc" had no effect on the issue.

There's a related, follow up question that is tracking down the behavior at Cause of change from -arch ppc to -arch ppc7400?