threads / discuss / 60622

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

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

## tl;dr

4 messages between Dec 17, 2023 and Dec 21, 2023.

replies: 3people: 2as markdown or json

Jonathan Abrams· Dec 17, 2023, 22:54 UTC · lore
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· Dec 18, 2023, 01:02 UTC · re: Jonathan Abrams · lore

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

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· Dec 19, 2023, 07:55 UTC · lore

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

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· Dec 21, 2023, 19:40 UTC · re: Eric Sunshine · lore

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

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

← back to recent threads