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

Previous thread: size_t vs "unsigned long" by Junio C Hamano on Wednesday, October 3, 2007 - 4:30 pm. (8 messages)

Next thread: none
To: git list <git@...>
Date: Wednesday, October 3, 2007 - 5:34 pm

Hello,
I've just compiled HEAD (1.5.3.4.209.g9e417) and saw a:
LINK git-http-fetch
i686-apple-darwin8-gcc-4.0.1: unrecognized option '-R/opt/local/lib'

It didn't harm but the build process should be more careful to not
use options that are not supported by the compiler. And it's not a
matter of using -Wl,-rpath instead.

Cheers,

--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory

To: Benoit SIGOURE <tsuna@...>
Cc: git list <git@...>
Date: Wednesday, October 3, 2007 - 6:39 pm

I compile git very regularly on my MacBook Pro and have never seen
this error. Do you have the most recent copy of Xcode? I've seen
odd errors on one of the not very old versions of the developer's
tools. For me, `gcc -v` reports "gcc version 4.0.1 (Apple Computer,
Inc. build 5367)".

~~ Brian
-

To: Brian Gernhardt <benji@...>
Cc: git list <git@...>
Date: Wednesday, October 3, 2007 - 6:58 pm

$ gcc -v
[...]
gcc version 4.0.1 (Apple Computer, Inc. build 5367)

I've seen this message for the 1st time when compiling Git after my
nightly git pull today. Anyways, this should be done because there
is no point in trying to use a feature that doesn't exist, even
though GCC is being nice by simply issuing a warning instead of an
error.

See:
http://developer.apple.com/releasenotes/DeveloperTools/RN-dyld/
index.html

In the section "Known Issues" it clearly states "No rpath support".

Cheers,

--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory

To: Benoit SIGOURE <tsuna@...>
Cc: git list <git@...>
Date: Wednesday, October 3, 2007 - 5:41 pm

As I do not have an access to a Darwin box (nor anybody sent me
a free Mac yet), I do not have any interest in fixing it myself
nor more importantly any means to verify the result. That makes
it _your_ build process that should be more careful ;-).

You know where -R is coming from and can find out what options
_your_ platform wants, so why not send in a patch _before_
complaining?

-

To: <git@...>
Cc: Benoit Sigoure <tsuna@...>
Date: Wednesday, October 3, 2007 - 6:20 pm

On Darwin for instance, there is no -R or -Wl,-rpath thing to fiddle with,
it's simply not supported by the dynamic loader. This patch introduces a
NO_RPATH define which is enabled by default for Darwin.
---
Makefile | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)

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
@@ -507,6 +510,7 @@ ifeq ($(uname_S),Darwin)
BASIC_LDFLAGS += -L/opt/local/lib
endif
endif
+ NO_RPATH = YesPlease
endif

ifdef NO_R_TO_GCC_LINKER
@@ -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
@@ -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

@@ -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)$(OPENSS...

To: Benoit Sigoure <tsuna@...>
Cc: <git@...>
Date: Wednesday, October 3, 2007 - 7:18 pm

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.

-

To: Junio C Hamano <gitster@...>
Cc: <git@...>
Date: Thursday, October 4, 2007 - 11:59 am

No more replies on this thread, and the Apple documentation confirms
that there is no rpath support in the dynamic loader of OSX 10.4 and

Yes. I can rework the patch, but the question is: do you care about
old GNU make? Can I rewrite the patch with this feature?

Thanks.

Cheers,

--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory

To: git list <git@...>
Date: Sunday, October 21, 2007 - 5:56 pm

I know Junio is still offline but maybe someone else has an objection
against this?

--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory

To: Benoit SIGOURE <tsuna@...>
Cc: git list <git@...>
Date: Monday, October 22, 2007 - 2:44 am

How old of a GNU make are talking about here? The above is certainly
a lot nicer to read, but I'd hate to suddenly ship a new Git that
someone cannot compile because their GNU make is too old.

GNU make is fortunately pretty easy to compile, so it shouldn't be
that difficult for someone to build a newer version if they had to,
but why make them go through all that extra work just to install
a new Git?

What about using a small helper shell script and using $(shell)
instead of $(call)?

So I guess in short I think I was in agreement with Junio a while
ago on this, which was that I don't want to require a newer GNU
make than we already require our users to have.

--
Shawn.
-

To: Shawn O. Pearce <spearce@...>
Cc: Benoit SIGOURE <tsuna@...>, git list <git@...>
Date: Monday, October 22, 2007 - 6:52 am

Hi,

I seem to remember remember that we had some shell quoting in the
Makefile, and it was "call"ed. That broke some setups, so we got rid of
it.

*starting "git log -Scall Makefile"*: yep. It even was me fixing it, in
39c015c556f285106931e0500f301de462b0e46e.

Ciao,
Dscho

-

To: Junio C Hamano <gitster@...>
Cc: Benoit Sigoure <tsuna@...>, <git@...>
Date: Wednesday, October 3, 2007 - 9:10 pm

It makes sense, since Apple's gcc/ld/dyld doesn't use rpath.

~~ Brian
-

To: Benoit Sigoure <tsuna@...>
Cc: <git@...>
Date: Wednesday, October 3, 2007 - 6:49 pm

I compile git on a MacBook Pro (OS X 10.4, gcc 4.0.1 build 5367 from the
normal Xcode install that comes on the OS install DVD) on a regular
basis. The makefile works fine for me. I suspect there's something else
going on here.

-Steve
-

To: Steven Grimm <koreth@...>
Cc: Benoit Sigoure <tsuna@...>, <git@...>
Date: Wednesday, October 3, 2007 - 9:08 pm

The rpath code is only used if you define one of the following options:

CURLDIR
ZLIB_PATH
OPENSSLDIR
ICONVDIR

The default Darwin options don't define any of these, it just relies
on finding those libraries in the library path (including /sw or /opt/
local if you have them installed).

~~ Brian G.
-

Previous thread: size_t vs "unsigned long" by Junio C Hamano on Wednesday, October 3, 2007 - 4:30 pm. (8 messages)

Next thread: none