Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > 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. > 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, > # 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,