threads / discuss / 37043

Compile Error on Git 2.0.1 on Redhat 5.9 with Fix

Subject: Compile Error on Git 2.0.1 on Redhat 5.9 with Fix

## tl;dr

4 messages between Jul 2, 2014 and Jul 3, 2014.

replies: 3people: 3as markdown or json

Eldon Nelson· Jul 2, 2014, 15:56 UTC · lore

When compiling Git 2.0.1 on RedHat 5.9 as a non-root user I get the following error:

BUILD ERROR
```
make prefix=/home/eldon/local all doc info
...
    CC zlib.o
    CC unix-socket.o
    CC thread-utils.o
    CC compat/strlcpy.o
    AR libgit.a
/bin/sh: gar: command not found
make: *** [libgit.a] Error 127
```
My fix was to make a symlink below:
SYMLINK

``` gar -> /usr/bin/ar ```

LINUX VERSION
```
> lsb_release -i -r
Distributor ID: RedHatEnterpriseClient
Release:        5.9
```

I think the fix is to allow the use of "ar" if "gar" does not exist. I don't know if this exists for every Redhat install but "gar" is not available in /usr/bin but "ar" does.

```
> /usr/bin/ar --version

GNU ar 2.17.50.0.6-20.el5_8.3 20061020 Copyright 2005 Free Software Foundation, Inc. ```

It could just be my corporate install of RedHat that is weird, but thought this might be at least a point to describe a fix.

``` gcc --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54) Copyright (C) 2006 Free Software Foundation, Inc. ```

~~~~~~~~~~~~
Eldon Nelson
eldon_nelson@ieee.org
Cell: 952-393-3481
Matthieu Moy· Jul 2, 2014, 16:25 UTC · re: Eldon Nelson · lore

Re: Compile Error on Git 2.0.1 on Redhat 5.9 with Fix

Eldon Nelson <eldon_nelson@ieee.org> writes:
Show 8 quoted lines
> make prefix=/home/eldon/local all doc info
> ...
>     CC zlib.o
>     CC unix-socket.o
>     CC thread-utils.o
>     CC compat/strlcpy.o
>     AR libgit.a
> /bin/sh: gar: command not found
[...]
> I think the fix is to allow the use of "ar" if "gar" does not exist.

It is already the case. The Makefile defaults to "ar" and does not even contain any mention of "gar". The configure script checks for both:

configure.ac:AC_CHECK_TOOLS(AR, [gar ar], :)

My guess is that you ran the configure script on a machine where gar is present, and then used the result on a machine where it isn't.

Normally, at configure time you should see this:
checking for ar... ar

You actually don't need to run the configure script, the Makefile runs fine without it. Delete config.mak.autogen to cancel the effect of ./configure.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Jeff King· Jul 2, 2014, 16:29 UTC · re: Eldon Nelson · lore

Re: Compile Error on Git 2.0.1 on Redhat 5.9 with Fix

On Wed, Jul 02, 2014 at 10:56:25AM -0500, Eldon Nelson wrote:
Show 16 quoted lines
> When compiling Git 2.0.1 on RedHat 5.9 as a non-root user I get the
> following error:
> 
> BUILD ERROR
> 
> ```
> make prefix=/home/eldon/local all doc info
> ...
>     CC zlib.o
>     CC unix-socket.o
>     CC thread-utils.o
>     CC compat/strlcpy.o
>     AR libgit.a
> /bin/sh: gar: command not found
> make: *** [libgit.a] Error 127
> ```
The Makefile defines AR as:
  $ git grep ^AR Makefile
  Makefile:AR = ar

so it should already do what you want by default. But that make variable can be overridden. Can you show us the contents of your config.mak and config.mak.autogen files (if either exists)?

It's also possible that you have AR set in your environment (show us "echo $AR"), but that would usually not override the Makefile unless "make -e" is used (and that is not in your command-line above, but it's possible that make is a shell alias or something).

Show 7 quoted lines
> My fix was to make a symlink below:
> 
> SYMLINK
> 
> ```
> gar -> /usr/bin/ar
> ```
A simpler workaround is probably:
  make AR=ar ...

but probably the "right" solution is to eliminate whatever is providing the bogus override in the first place.

-Peff
Eldon Nelson· Jul 3, 2014, 20:13 UTC · re: Eldon Nelson · lore

Re: Compile Error on Git 2.0.1 on Redhat 5.9 with Fix

Thanks for the tip Jeff. "config.mak.autogen" is created in the git compile only when you do a "./configure". Mine had the bad reference to "gar" in it due to the following.

It was caused because my path had a reference to a non-related "gar" executable (some internal command). I saw the compile trying to execute it and removed it from my path. Doing a "make clean" afterwards didn't remove the "config.mak.autogen" which had mistakenly thought that I was using "gar" and not "ar".

When I fixed my path to not include the company specific "gar" and started with a fresh untar it worked perfectly. It also didn't make a "config.mak.autogen" since that isn't what is recommended to do in the git docs for install.

This is closed due to my own user error.
config.mak.autogen

# git Makefile configuration, included in main Makefile # config.mak.autogen. Generated from config.mak.in by configure.

CC = cc CFLAGS = -g -O2 CPPFLAGS = LDFLAGS = AR = gar TAR = gtar

~~~~~~~~~~~~ Eldon Nelson eldon_nelson@ieee.org

← back to recent threads