threads / discuss / 43676

static linking lib order problem

Subject: static linking lib order problem

## tl;dr

One message between Nov 20, 2006 and Nov 20, 2006.

replies: 0people: 1as markdown or json

Bennett Todd· Nov 20, 2006, 17:32 UTC · lore
I build git for Bent Linux, with
	make prefix=/usr NEEDS_LIBICONV=YesPlease
It develops compile and link lines that look like:
gcc -g -O2 -Wall  -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY -o git-http-fetch   fetch.o http.o http-fetch.o \
                libgit.a xdiff/lib.a -lz  -liconv  -lcrypto -lcurl -lexpat
which produce vast numbers of errors, which look like

/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libcurl.a(ssluse.o)(.text.rand_enough+0x4): In function `rand_enough': : undefined reference to `RAND_status' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libcurl.a(ssluse.o)(.text.ossl_seed+0x2b): In function `ossl_seed': : undefined reference to `RAND_load_file' [...] /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libcurl.a(http_ntlm.o)(.text.Curl_output_ntlm+0x370): In function `Curl_output_ntlm': : undefined reference to `MD5_Update' /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/../../../libcurl.a(http_ntlm.o)(.text.Curl_output_ntlm+0x37d): In function `Curl_output_ntlm': : undefined reference to `MD5_Final' collect2: ld returned 1 exit status make: *** [git-http-fetch] Error 1

I've been kludging around it with this patch:

diff -ru git-1.4.4.orig/Makefile git-1.4.4/Makefile --- git-1.4.4.orig/Makefile 2006-11-15 07:22:27.000000000 +0000 +++ git-1.4.4/Makefile 2006-11-15 20:49:26.000000000 +0000

@@ -439,7 +439,7 @@
 		BASIC_CFLAGS += -I$(CURLDIR)/include
 		CURL_LIBCURL = -L$(CURLDIR)/lib -R$(CURLDIR)/lib -lcurl
 	else
-		CURL_LIBCURL = -lcurl
+		CURL_LIBCURL = -lcurl -lssl -lcrypto
 	endif
 	PROGRAMS += git-http-fetch$X
 	curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)

just because I didn't take the time to understand the git build
process's library conf system.

-Bennett

← back to recent threads