在 macOS 上从源代码构建并安装 git:“ld:多个错误:存档成员 '/' 不是 mach-o 文件”

问题描述 投票:0回答:1

我正在尝试通过使用 bash 作为 git 别名中的默认 shell 从源代码(

https://github.com/git/git.git
)构建 git,因此我不必为输出识别
echo -e
echo

但是,我在执行时遇到了问题

make all
:

...
    LINK t/helper/test-tool
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [git-daemon] Error 1
make: *** Waiting for unfinished jobs....
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'
make: *** [git-http-backend] Error 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'
make: *** [git-imap-send] Error 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'
make: *** [git-sh-i18n--envsubst] Error 1
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a', 'reftable/libreftable.a', 'xdiff/lib.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [git-http-push] Error 1
make: *** [git-remote-http] Error 1
make: *** [git-http-fetch] Error 1
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a'
ld: warning: ignoring duplicate libraries: '-liconv', 'libgit.a', 'reftable/libreftable.a', 'xdiff/lib.a'
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable_test.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [t/helper/test-fake-ssh] Error 1
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'
make: *** [git] Error 1
make: *** [scalar] Error 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [git-shell] Error 1
ld: multiple errors: archive member '/' not a mach-o file in '/Users/marslo/tools/git/libgit.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/xdiff/lib.a'; archive member '/' not a mach-o file in '/Users/marslo/tools/git/reftable/libreftable_test.a'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [t/helper/test-tool] Error 1

详情如下:

  • 完整步骤:

    $ mkdir -p $HOME/tools/git
    $ git clone https://github.com/git/git.git $HOME/tools/git
    $ cd $HOME/tools/git
    
    # status
    $ git show -s HEAD
    commit 564d0252ca632e0264ed670534a51d18a689ef5d (HEAD -> master, tag: v2.43.0, origin/master, origin/HEAD)
    Author: Junio C Hamano <[email protected]>
    Date:   Mon Nov 20 08:47:38 2023 +0900
    
        Git 2.43
    
        Signed-off-by: Junio C Hamano <[email protected]>
    
    # build
    $ make configure
    $ ./configure --prefix=/usr/local --with-shell=/usr/local/bin/bash
    $ make -j all
    
  • 日志:

  • 环境

    $ sw_vers
    ProductName:          macOS
    ProductVersion:       14.1.2
    BuildVersion:         23B92
    
    $ brew install gcc autoconf automake openssl@3 expat gettext zlib libtool libiconv ncurses
    $ brew install asciidoc xmlto docbook2x docbook-xsl hunspell
    $ ln -sf /usr/local/bin/docbook2texi /usr/local/bin/docbook2x-texi
    $ brew install gnu-getopt libao
    
    $ echo $CFLAGS
    -I/usr/local/include -I/usr/local/opt/tcl-tk/include
    $ echo $PKG_CONFIG_PATH
    /usr/local/opt/curl/lib/pkgconfig:/usr/local/opt/tcl-tk/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/11.1:/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/[email protected]/lib/pkgconfig:/usr/local/opt/ruby/lib/pkgconfig:/usr/local/opt/libressl/lib/pkgconfig:/usr/local/Cellar/[email protected]/71.1/lib/pkgconfig:/usr/local/opt/expat/lib/pkgconfig:/usr/local/opt/ncurses/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig
    $ echo $CPPFLAGS
    -I/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home/include -I/usr/local/opt/openldap/include -I/usr/local/opt/curl/include -I/usr/local/opt/binutils/include -I/usr/local/opt/sqlite/include -I/usr/local/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/Cellar/node/21.1.0/include -I/usr/local/opt/libressl/include -I/usr/local/opt/expat/include -I/usr/local/opt/ncurses/include -I/usr/local/opt/libiconv/include -I/usr/local/opt/zlib/include -I/usr/local/opt/tcl-tk/include -I/usr/local/opt/ruby/include -I/usr/local/Cellar/[email protected]/71.1/include -I/usr/local/opt/llvm/include
    $ echo $LDFLAGS
    -L/usr/local/opt/openldap/lib -L/usr/local/opt/curl/lib -L/usr/local/opt/binutils/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/ruby/lib -L/usr/local/opt/tcl-tk/lib -L/usr/local/opt/sqlite/lib -L/usr/local/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/Cellar/node/21.1.0/libexec/lib -L/usr/local/opt/libressl/lib -L/usr/local/Cellar/[email protected]/71.1/lib -L/usr/local/opt/expat/lib -L/usr/local/opt/ncurses/lib -L/usr/local/opt/libiconv/lib -L/usr/local/opt/zlib/lib -L/usr/local/opt/llvm/lib -L/usr/local/opt/llvm/lib/c++ -Wl,-rpath,/usr/local/opt/llvm/lib/c++
    
    $ gcc --version
    Apple clang version 15.0.0 (clang-1500.0.40.1)
    Target: x86_64-apple-darwin23.1.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    
    $ g++ --version
    Apple clang version 15.0.0 (clang-1500.0.40.1)
    Target: x86_64-apple-darwin23.1.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    
    $ clang --version
    Apple clang version 15.0.0 (clang-1500.0.40.1)
    Target: x86_64-apple-darwin23.1.0
    Thread model: posix
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    
    $ gettext --version
    gettext (GNU gettext-runtime) 0.22.4
    Copyright (C) 1995-2023 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Written by Ulrich Drepper.
    
    $ autoconf --version
    autoconf (GNU Autoconf) 2.71
    Copyright (C) 2021 Free Software Foundation, Inc.
    License GPLv3+/Autoconf: GNU GPL version 3 or later
    <https://gnu.org/licenses/gpl.html>, <https://gnu.org/licenses/exceptions.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    
    Written by David J. MacKenzie and Akim Demaille.
    
git macos
1个回答
0
投票

我从 Clang 存档或链接问题中得到线索。 Xcode 15.0.1,看起来问题来自 xCode15。

我将继续跟进该问题,任何更新或解决方案都会发布。

© www.soinside.com 2019 - 2024. All rights reserved.