git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Be nice with compilers that do not support runtime paths at all.

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 3, 2007, 23:18 UTC
Message-ID
<7vejgbdbyn.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1191450052-23619-1-git-send-email-tsuna@lrde.epita.fr>
Benoit Sigoure <tsuna@lrde.epita.fr> writes:
Show 14 quoted lines
> diff --git a/Makefile b/Makefile
> index a1fe443..7c6c453 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -100,6 +100,9 @@ all::
>  # that tells runtime paths to dynamic libraries;
>  # "-Wl,-rpath=/path/lib" is used instead.
>  #
> +# Define NO_RPATH if your dynamic loader doesn't support runtime paths at
> +# all.
> +#
>  # Define USE_NSEC below if you want git to care about sub-second file mtimes
>  # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
>  # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
Thanks for this part;
Show 6 quoted lines
> @@ -507,6 +510,7 @@ ifeq ($(uname_S),Darwin)
>  			BASIC_LDFLAGS += -L/opt/local/lib
>  		endif
>  	endif
> +        NO_RPATH = YesPlease
>  endif
I'll let Darwin users to fight the defaults for this part out.
Show 12 quoted lines
> @@ -521,7 +525,10 @@ ifndef NO_CURL
>  	ifdef CURLDIR
>  		# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
>  		BASIC_CFLAGS += -I$(CURLDIR)/include
> -		CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
> +		CURL_LIBCURL = -L$(CURLDIR)/$(lib) -lcurl
> +ifndef NO_RPATH
> +		CURL_LIBCURL += $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
> +endif
>  	else
>  		CURL_LIBCURL = -lcurl
>  	endif
Show 12 quoted lines
> @@ -539,7 +546,10 @@ endif
>  
>  ifdef ZLIB_PATH
>  	BASIC_CFLAGS += -I$(ZLIB_PATH)/include
> -	EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
> +	EXTLIBS += -L$(ZLIB_PATH)/$(lib)
> +ifndef NO_RPATH
> +	EXTLIBS += $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
> +endif
>  endif
>  EXTLIBS += -lz
>  
While these parts are ugly but correct, I think...
Show 12 quoted lines
> @@ -547,7 +557,10 @@ ifndef NO_OPENSSL
>  	OPENSSL_LIBSSL = -lssl
>  	ifdef OPENSSLDIR
>  		BASIC_CFLAGS += -I$(OPENSSLDIR)/include
> -		OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
> +		OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib)
> +ifndef NO_RPATH
> +		OPENSSL_LINK = $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
> +endif
>  	else
>  		OPENSSL_LINK =
>  	endif
this and the ICONV one are missing s/=/+=/.

If we do not care about supporting too old GNU make, we can do this by first adding this near the top:

        ifndef NO_RPATH
        LINKER_PATH = -L$(1) $(CC_LD_DYNPATH)$(1)
        else
        LINKER_PATH = -L$(1)
        endif
and then doing something like:
	CURL_LIBCURL = $(call LINKER_PATH,$(CURLDIR)/$(lib))
	OPENSSL_LINK = $(call LINKER_PATH,$(OPENSSLDIR)/$(lib))
to make it easier to read and less error prone.
Previous: Brian GernhardtNext: Brian Gernhardt
Message 6 of 14 in “Linking with -R (rpath) not supported on Darwin”
  1. Benoit SIGOUREOct 3, 2007
  2. Junio C HamanoOct 3, 2007
  3. Be nice with compilers that do not support runtime paths at all.Benoit Sigoure, Oct 3, 2007
  4. Steven GrimmOct 3, 2007
  5. Brian GernhardtOct 4, 2007
  6. Junio C HamanoOct 3, 2007
  7. Brian GernhardtOct 4, 2007
  8. Benoit SIGOUREOct 4, 2007
  9. Benoit SIGOUREOct 21, 2007
  10. Shawn O. PearceOct 22, 2007
  11. Brian DessentOct 22, 2007
  12. Johannes SchindelinOct 22, 2007
  13. Brian GernhardtOct 3, 2007
  14. Benoit SIGOUREOct 3, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.