# Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10

4 messages from 2023-12-17 to 2023-12-21. Participants: Jonathan Abrams, Eric Sunshine.
Thread: https://gitlist.dev/t/60622

## Jonathan Abrams, 2023-12-17 22:54

Subject: Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10
Message-ID: <IA1PR12MB604488A775E3390E9B7E56BEB891A@IA1PR12MB6044.namprd12.prod.outlook.com>
URL: https://gitlist.dev/e/IA1PR12MB604488A775E3390E9B7E56BEB891A%40IA1PR12MB6044.namprd12.prod.outlook.com

```
Hello,

I am trying to install git-2.43.0 from source on macOS Big Sur 11.7.10.  I have Xcode 13.2.1 installed.  I have read https://github.com/git/git/blob/master/INSTALL.

The command that will not complete successfully is sudo make all doc.  The Terminal output before the error is as follows.
--
    AR libgit.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libgit.a(zlib-uncompress2.o) has no symbols
    CC xdiff/xdiffi.o
    CC xdiff/xemit.o
    CC xdiff/xhistogram.o
    CC xdiff/xmerge.o
    CC xdiff/xpatience.o
    CC xdiff/xprepare.o
    CC xdiff/xutils.o
    AR xdiff/lib.a
    CC reftable/basics.o
    CC reftable/error.o
    CC reftable/block.o
    CC reftable/blocksource.o
    CC reftable/iter.o
    CC reftable/publicbasics.o
    CC reftable/merged.o
    CC reftable/pq.o
    CC reftable/reader.o
    CC reftable/record.o
    CC reftable/refname.o
    CC reftable/generic.o
    CC reftable/stack.o
    CC reftable/tree.o
    CC reftable/writer.o
    AR reftable/libreftable.a
    LINK git-daemon
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _precompose_utf8_readdir in libgit.a(precompose_utf8.o)
      _reencode_string_iconv in libgit.a(utf8.o)
  "_libiconv_close", referenced from:
      _precompose_string_if_needed in libgit.a(precompose_utf8.o)
      _precompose_utf8_closedir in libgit.a(precompose_utf8.o)
      _reencode_string_len in libgit.a(utf8.o)
  "_libiconv_open", referenced from:
      _precompose_string_if_needed in libgit.a(precompose_utf8.o)
      _precompose_utf8_opendir in libgit.a(precompose_utf8.o)
      _reencode_string_len in libgit.a(utf8.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [git-daemon] Error 1
--
Does anyone reading this know how to resolve this error?

Thank you,

Jonathan S. Abrams
```

## Eric Sunshine, 2023-12-18 01:02

Subject: Re: Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10
Message-ID: <CAPig+cTEmiQzD7D7qEKDsyGf+08AtNQzy=GfPZDrRtM2ytKnUw@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcTEmiQzD7D7qEKDsyGf%2B08AtNQzy%3DGfPZDrRtM2ytKnUw%40mail.gmail.com
In-Reply-To: <IA1PR12MB604488A775E3390E9B7E56BEB891A@IA1PR12MB6044.namprd12.prod.outlook.com>

```
On Sun, Dec 17, 2023 at 5:54 PM Jonathan Abrams
<jonathansabrams@outlook.com> wrote:
> I am trying to install git-2.43.0 from source on macOS Big Sur 11.7.10.  I have Xcode 13.2.1 installed.  I have read https://github.com/git/git/blob/master/INSTALL.
>
> The command that will not complete successfully is sudo make all doc.  The Terminal output before the error is as follows.

What steps did you take to build the project? Did you simply use `make
all` alone, or did you run `configure` first? Generally speaking,
running `configure` should be unnecessary on most platforms.

> Undefined symbols for architecture x86_64:
>   "_libiconv", referenced from:
>       _precompose_utf8_readdir in libgit.a(precompose_utf8.o)
>       _reencode_string_iconv in libgit.a(utf8.o)

It looks like it's not linking against `libiconv`. Aside from
answering the above question (and reporting the contents of
"config.mak.autogen" if you did run `configure`), you can also run
make as:

    make V=1 all

to see the actual command it's running at the point of failure. If you
paste that command, then we can find out whether or not it's trying to
link against `libiconv`.

```

## Eric Sunshine, 2023-12-19 07:55

Subject: Re: Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10
Message-ID: <CAPig+cQgTNq8rKiXm_dDha+Rz-=Z9O4_gvWLWdcPJe1yp=hQ8Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcQgTNq8rKiXm_dDha%2BRz-%3DZ9O4_gvWLWdcPJe1yp%3DhQ8Q%40mail.gmail.com
In-Reply-To: <IA1PR12MB60445F50DD0F844B2B779BA8B890A@IA1PR12MB6044.namprd12.prod.outlook.com>

```
On Mon, Dec 18, 2023 at 7:03 AM Jonathan Abrams
<jonathansabrams@outlook.com> wrote:
> The contents of "config.mak.autogen" are as follows:
> --
> CURL_LDFLAGS=-L/Users/jonathana/opt/anaconda3/lib -lcurl
> CHARSET_LIB=-liconv

So, 'configure' found a "libiconv". Okay.

> The last output of make V=1 all is as follows.
> --
> gcc   -g -O2 -I. -o git-daemon daemon.o common-main.o libgit.a xdiff/lib.a reftable/libreftable.a libgit.a -lz  -liconv  -liconv

And it's linking against "libiconv" (the "-iconv" part). Good.

> Undefined symbols for architecture x86_64:
>   "_libiconv", referenced from:
>       _precompose_utf8_readdir in libgit.a(precompose_utf8.o)
>       _reencode_string_iconv in libgit.a(utf8.o)

But it doesn't seem to like your "libiconv" for some reason.

I notice that you seem to have an Anaconda environment active. Do you
know if this "libiconv" happens to reside within the Anaconda
environment? If so, what version is it and from where was it installed
("conda-forge", "anaconda", some other)?

Have you tried deactivating the Anaconda environment ("conda
deactivate") before building Git? Also, I would suggest trying without
even running the configure script at all. So, for instance:

  % cd git
  % conda deactivate
  % make distclean
  % make all

```

## Jonathan Abrams, 2023-12-21 19:40

Subject: Re: Unable to install git-2.43.0 from source on macOS Big Sur 11.7.10
Message-ID: <IA1PR12MB6044112A08508ED982F743E2B895A@IA1PR12MB6044.namprd12.prod.outlook.com>
URL: https://gitlist.dev/e/IA1PR12MB6044112A08508ED982F743E2B895A%40IA1PR12MB6044.namprd12.prod.outlook.com
In-Reply-To: <CAPig+cQgTNq8rKiXm_dDha+Rz-=Z9O4_gvWLWdcPJe1yp=hQ8Q@mail.gmail.com>

```
After deactivating the conda environment, I get a different error.  The commands I entered are:

conda deactivate
make configure
./configure --prefix=/usr
make V=1 all doc

This ends with the following error.
/usr/bin/perl ./build-docdep.perl >doc.dep
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../  GIT-VERSION-FILE
make[2]: `GIT-VERSION-FILE' is up to date.
fatal: not a git repository (or any of the parent directories): .git
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../  GIT-VERSION-FILE
make[2]: `GIT-VERSION-FILE' is up to date.
    * new asciidoc flags
asciidoc  -f asciidoc.conf -amanmanual='Git Manual' -amansource='Git 2.43.0' -arevdate='' -b xhtml11 -d manpage -o git-add.html git-add.txt
make[1]: asciidoc: No such file or directory
make[1]: *** [git-add.html] Error 1
make: *** [doc] Error 2

Your suggestion to run the following commands results in a different error.  The suggested commands were:
cd git-2.43.0
conda deactivate
make distclean
make all

This ends with the following error.
GIT_VERSION = 2.43.0
    * new build flags
    CC oss-fuzz/fuzz-commit-graph.o
    CC oss-fuzz/fuzz-pack-headers.o
    CC oss-fuzz/fuzz-pack-idx.o
    CC daemon.o
    * new link flags
    CC common-main.o
In file included from common-main.c:3:
./gettext.h:17:11: fatal error: 'libintl.h' file not found
#       include <libintl.h>
                ^~~~~~~~~~~
1 error generated.
make: *** [common-main.o] Error 1

Looking around line 17 in ./gettext.h, I see this.
#ifndef NO_GETTEXT
#	include <libintl.h>

Executing gettext --version returned nothing.  I then downloaded gettext and installed it using the following commands.
./configure
make
make check
sudo make install

I then executed your suggested commands again.
conda deactivate
make distclean
make all
sudo make install

This installed GIT.  Thank you for your guidance!

Jonathan S. Abrams
```
