Re: Possible bug in Makefile when executing curl-config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[+cc the author of that patch]

On Mon, Jul 22, 2019 at 07:46:37PM +0000, Raitanen, Adam wrote:

> I believe there may be a bug in the Makefile introduced by the following commit:
> 
> https://github.com/git/git/commit/23c4bbe28e61974577164db09cbd1d1c7e568ca4
> 
> The commit was merged in 2.20.0:
> 
> * The way -lcurl library gets linked has been simplified by taking
>    advantage of the fact that we can just ask curl-config command how.
> 
> Unfortunately it assumes that curl-config is in the path which is not
> always the case. When using "--with-curl=/path/to/curl" in the
> configure command, the path to the actual curl-config executable is
> ignored and the build fails around here:
> 
>     CC http-fetch.o
> make: curl-config: Command not found
>     LINK git-http-fetch
> http.o: In function `fill_active_slots':
> /tmp/git-2.21.0/http.c:1385: undefined reference to `curl_easy_cleanup'
> .
> 
> We were able to workaround this by forcing the correct path into the make env:
> 
> make CURL_LDFLAGS="$(/path/to/curl/curl-config --libs)".
> 
> I reproduced the problem in the latest version 2.22.0.

For the case without autoconf, I think using CURL_LDFLAGS is the
intended safety valve. Though perhaps we should be falling back more
gracefully to the old behavior, like:

diff --git a/Makefile b/Makefile
index 11ccea4071..27e546bbfc 100644
--- a/Makefile
+++ b/Makefile
@@ -1343,7 +1343,7 @@ else
 ifdef CURL_LDFLAGS
 	CURL_LIBCURL += $(CURL_LDFLAGS)
 else
-	CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs)
+	CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs || echo -lcurl)
 endif
 
 	REMOTE_CURL_PRIMARY = git-remote-http$X

which should work on most systems.

For your specific case, where you _do_ have curl-config but it's just
not in the PATH, then I think:

  make CURL_CONFIG=/path/to/curl-config

would be a slightly cleaner solution.

But it sounds like you _did_ use the autoconf script, but it did not
correctly set CURL_CONFIG. Do you have a config.mak.autogen file after
running ./configure, and if so, does it have an entry for CURL_CONFIG?

I'm not too familiar with our configure.ac, but it looks like
--with-curl might just point some paths for header/include files, and
not actually update the curl-config path.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux