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

Re: [PATCH v2] Makefile: remove the NO_R_TO_GCC_LINKER flag

From
Junio C Hamano <gitster@pobox.com>
Date
May 19, 2019, 00:56 UTC
Message-ID
<xmqqa7fj2ren.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190517215847.28179-1-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 16 quoted lines
> It's not needed to simply link to libraries like say libpcre,
> but *only* for those cases where we're linking to such a library not
> present in the OS's library directories. See e.g. ldconfig(8) on Linux
> for more details.
>
> I use this to compile my git with a LIBPCREDIR=$HOME/g/pcre2/inst as
> I'm building that from source, but someone maintaining an OS package
> is almost certainly not going to use this. They're just going to set
> USE_LIBPCRE=YesPlease after installing the libpcre dependency,
> which'll point to OS libraries which ld(1) will find without the help
> of CC_LD_DYNPATH.
> ...
> Our use of "-R" dates back to 455a7f3275 ("More portability.",
> 2005-09-30). Soon after that in bbfc63dd78 ("gcc does not necessarily
> pass runtime libpath with -R", 2006-12-27) the NO_R_TO_GCC flag was
> added, allowing optional use of "-Wl,-rpath=".

Yeah, I recall I had to add -R back when I was with my previous employer, where I had Sun with GNU toolchain as the primary environment and many libraries were custom built outside the system path.

Show 12 quoted lines
> diff --git a/Makefile b/Makefile
> index f965509b3c..ce7a489d64 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -265,10 +265,6 @@ all::
>  #
>  # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
>  #
> -# Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
> -# that tells runtime paths to dynamic libraries;
> -# "-Wl,-rpath=/path/lib" is used instead.
> -#

I am not sure if -R was a GCC-only thing; we might want to, instead of removing this seciton, replace it with something like

    # Use "CC_LD_DYNPATH = -R" if your compiler uses "-R/path/to/lib"
    # to specify the runtime paths to dynamic libraries.  These days,
    # GCC uses -Wl,-rpath=/path/to/lib and that is used by default
    # instead.
to help those whose build suddenly starts breaking.
   >  # Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
Show 6 quoted lines
>  # as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
>  #
> @@ -1160,6 +1156,7 @@ endif
>  # which'll override these defaults.
>  CFLAGS = -g -O2 -Wall
>  LDFLAGS =
Or it could be a single liner at this point in the file, perhaps
    # Really old GCC used "CC_LD_DYNPATH = -R" for the runtime dynlib path
> +CC_LD_DYNPATH = -Wl,-rpath,
Previous: Ævar Arnfjörð BjarmasonNext: Jeff King
Message 16 of 19 in “Improving HP-UX support”
  1. Improving HP-UX supportOsipov, Michael, May 8, 2019
  2. Ævar Arnfjörð BjarmasonMay 9, 2019
  3. Osipov, MichaelMay 9, 2019
  4. sha1dc: update from upstreamÆvar Arnfjörð Bjarmason, May 13, 2019
  5. Osipov, MichaelMay 14, 2019
  6. Ævar Arnfjörð BjarmasonMay 15, 2019
  7. Osipov, MichaelMay 16, 2019
  8. Ævar Arnfjörð BjarmasonMay 16, 2019
  9. Osipov, MichaelMay 16, 2019
  10. configure: Detect linking style for HP aCC on HP-UXÆvar Arnfjörð Bjarmason, May 16, 2019
  11. Makefile: remove the NO_R_TO_GCC_LINKER flagÆvar Arnfjörð Bjarmason, May 16, 2019
  12. Jeff KingMay 16, 2019
  13. Junio C HamanoMay 16, 2019
  14. Jeff KingMay 17, 2019
  15. Makefile: remove the NO_R_TO_GCC_LINKER flagÆvar Arnfjörð Bjarmason, May 17, 2019
  16. Junio C HamanoMay 19, 2019
  17. Jeff KingMay 19, 2019
  18. Osipov, MichaelJun 7, 2019
  19. Junio C HamanoJun 7, 2019

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.