{"thread":{"id":"53325","subject":"Git configure with static curl is failing","startedAt":"2020-04-26T19:22:05Z","lastAt":"2020-04-29T02:33:45Z","messageCount":4,"participants":["Paul Smith","brian m. carlson","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"396296","messageId":"9d9fe8376e47a9f5330cd644c76d96987fc67c57.camel@mad-scientist.net","threadId":"53325","inReplyTo":null,"subject":"Git configure with static curl is failing","fromName":"Paul Smith","fromEmail":"paul@mad-scientist.net","sentAt":"2020-04-26T19:01:54Z","receivedAt":"2020-04-26T19:22:05Z","isPatch":false,"sender":{"key":"paul@mad-scientist.net","avatar":"https://avatars.githubusercontent.com/u/109636?v=4"},"body":"Hi all;\n\nI'm trying to build Git with my own static curl, not the system curl,\nand this isn't working due to an issue in configure.ac's curl locating\ncode.\n\nI invoke configure with --with-curl=/other/curl where\n/other/curl/include/curl and /other/curl/lib/libcurl.a and\n/other/curl/bin/curl-config all exist and work correctly.\n\nWhen configure.ac attempts to local curl, it fails; config.log shows:\n\n  configure:5387: my-gcc -o conftest -O2 \\\n   -I/other/curl/include -L/other/curl/lib conftest.c -lcurl >&5\n  /other/curl/lib/libcurl.a(libcurl_la-content_encoding.o):content_encoding.c:function gzip_init_writer: error: undefined reference to 'zlibVersion'\n\nand many other errors, because the link line is missing needed\nlibraries.  If curl as a .so this wouldn't matter since libcurl.so\nwould contain references to the libraries it needs and ld.so would\nhandle this, but a static library obviously doesn't have that.\n\nThe problem appears to be that configure.ac is not using curl-config to\nobtain the correct options to link with curl.  If I run\n/other/curl/bin/curl-config --lib I get the proper flags:\n\n  $ /other/curl/bin/curl-config --libs\n  -L/other/curl/lib -lcurl -lssl -lz -lcrypto -ldl -lpthread\n\nIf configure.ac tried to use $CURLDIR/bin/curl-config --libs to obtain\nthe right linker options, then the link test for curl would work.\n\n"},{"id":"396299","messageId":"20200426194729.GD6421@camp.crustytoothpaste.net","threadId":"53325","inReplyTo":"9d9fe8376e47a9f5330cd644c76d96987fc67c57.camel@mad-scientist.net","subject":"Re: Git configure with static curl is failing","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-04-26T19:47:29Z","receivedAt":"2020-04-26T19:48:08Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-04-26 at 19:01:54, Paul Smith wrote:\n> The problem appears to be that configure.ac is not using curl-config to\n> obtain the correct options to link with curl.  If I run\n> /other/curl/bin/curl-config --lib I get the proper flags:\n> \n>   $ /other/curl/bin/curl-config --libs\n>   -L/other/curl/lib -lcurl -lssl -lz -lcrypto -ldl -lpthread\n> \n> If configure.ac tried to use $CURLDIR/bin/curl-config --libs to obtain\n> the right linker options, then the link test for curl would work.\n\nIt doesn't surprise me that configure.ac doesn't use curl-config.  The\nconfigure script is generally not used by the main developers in favor\nof just using the makefile itself.\n\nWhile we should fix that, the makefile does use curl-config, so if you\njust use it with any appropriate options without running configure, it\nwill probably work for you.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"396307","messageId":"20200426231410.GA1702090@coredump.intra.peff.net","threadId":"53325","inReplyTo":"20200426194729.GD6421@camp.crustytoothpaste.net","subject":"Re: Git configure with static curl is failing","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-04-26T23:14:10Z","receivedAt":"2020-04-26T23:14:30Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Apr 26, 2020 at 07:47:29PM +0000, brian m. carlson wrote:\n\n> On 2020-04-26 at 19:01:54, Paul Smith wrote:\n> > The problem appears to be that configure.ac is not using curl-config to\n> > obtain the correct options to link with curl.  If I run\n> > /other/curl/bin/curl-config --lib I get the proper flags:\n> > \n> >   $ /other/curl/bin/curl-config --libs\n> >   -L/other/curl/lib -lcurl -lssl -lz -lcrypto -ldl -lpthread\n> > \n> > If configure.ac tried to use $CURLDIR/bin/curl-config --libs to obtain\n> > the right linker options, then the link test for curl would work.\n> \n> It doesn't surprise me that configure.ac doesn't use curl-config.  The\n> configure script is generally not used by the main developers in favor\n> of just using the makefile itself.\n> \n> While we should fix that, the makefile does use curl-config, so if you\n> just use it with any appropriate options without running configure, it\n> will probably work for you.\n\nUsually, yes, though it doesn't use `curl-config --cflags` properly. See\nthe series at [1]. What's there now, though might be enough for Paul's\ncase (if it's just a link-time issue).\n\nI do think the autoconf code could do a better job of using curl-config,\nalong with a few other improvements. I left some thoughts in that\nthread.\n\n-Peff\n\n[1] https://lore.kernel.org/git/20200326080540.GA2200522@coredump.intra.peff.net/\n"},{"id":"396522","messageId":"16bdb22d9085876f30735a25c1edc2302e008e60.camel@mad-scientist.net","threadId":"53325","inReplyTo":"20200426231410.GA1702090@coredump.intra.peff.net","subject":"Re: Git configure with static curl is failing","fromName":"Paul Smith","fromEmail":"paul@mad-scientist.net","sentAt":"2020-04-29T01:47:00Z","receivedAt":"2020-04-29T02:33:45Z","isPatch":false,"sender":{"key":"paul@mad-scientist.net","avatar":"https://avatars.githubusercontent.com/u/109636?v=4"},"body":"On Sun, 2020-04-26 at 19:14 -0400, Jeff King wrote:\n> Usually, yes, though it doesn't use `curl-config --cflags` properly.\n> See the series at [1].\n\nHeh.  Some aspects of that thread look familiar :).\n\nYes, adding 'NO_CURL= CURLDIR=/path/to/curl' to the make line to force\nit did fix the problem in my environment.\n\n\nFWIW, not only is the version of GNU make shipped with MacOS very old\nand apparently never to be updated, but it has been reported that there\nare bugs in it that don't appear even in the vanilla version of GNU\nmake 3.81.  There may come a point where continuing to support that\nolder version won't be worth it...\n\n"}]}