Mac OS 上的 git 命令行错误“dyld:找不到符号:___strlcpy_chk”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23015152/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:57:15  来源:igfitidea点击:

git command-line on Mac OS error "dyld: Symbol not found: ___strlcpy_chk"

gitmacososx-snow-leoparddylibversions

提问by Nabil Lemsieh

I installed git on Mac os, when i try to create a new repository with git init, i get this error :

我在 Mac os 上安装了 git,当我尝试使用创建新的存储库时git init,出现此错误:

 dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk
 Referenced from: /usr/local/git/bin/git
 Expected in: /usr/lib/libSystem.B.dylib

 dyld: Symbol not found: ___strlcpy_chk
 Referenced from: /usr/local/git/bin/git
 Expected in: /usr/lib/libSystem.B.dylib

 Trace/BPT trap: 5

NB: I don't have Xcode installed.

注意:我没有安装 Xcode。

回答by Jason Lee

you can consider my solution: Open XCode(Install one if you didn't install it.), and press "COMMAND + ,". Click "Download". Find "command line tool", download and install it.Then restart your mac,done!

您可以考虑我的解决方案:打开XCode(如果您没有安装,请安装一个。),然后按“COMMAND + ,”。点击“下载”。找到“命令行工具”,下载安装,然后重启你的mac,大功告成!

Hope you can solve it with the same way.

希望你能用同样的方法解决。

回答by trojanfoe

Looks like /usr/local/git/bin/githas been compiled with the wrong -mmacosx-version-minvalue. You don't mention how it got there, so I cannot help further along that path.

看起来/usr/local/git/bin/git已经用错误的-mmacosx-version-min值编译了。你没有提到它是如何到达那里的,所以我无法沿着这条路走得更远。

I would recommend installing macportsand simply doing:

我建议安装macports并简单地执行以下操作:

$ sudo port install git-core git-extras

回答by Cronk

I was also having troubles with the same error after running this command:

运行此命令后,我也遇到了同样的错误:

$ git clone https://bitbucket.org/name/testproject.git

I tried the PATH trick (didn't help). I wasn't really interested in installing Xcode and then the 'Command Line Tools' as others had suggested. But I did stumble upon half an answer.

我尝试了 PATH 技巧(没有帮助)。我对安装 Xcode 和其他人建议的“命令行工具”并不真正感兴趣。但我确实偶然发现了一半的答案。

First, I uninstalled my current version of Git (1.9.2). I then found that it is possible to install the Command Line Tools by themselves, without installing Xcode:

首先,我卸载了当前版本的 Git (1.9.2)。然后我发现可以自己安装命令行工具,而无需安装Xcode:

Xcode page:  https://developer.apple.com/xcode/
Downloads near the top
Scroll down to 'Additional Tools'->'View Downloads'
Command Line Tools (OS X Mountain Lion)

With those installed, doing 'git --version' returned this:

安装后,执行 'git --version' 返回:

git version 1.8.5.2 (Apple Git-48)

The file "/usr/lib/libSystem.B.dylib" was untouched during this process. Or at least, the file size and date did not change. Since that library didn't change, I would surmise that it isn't Xcode that is fixing things, but the version of Git that is installed.

在此过程中,文件“/usr/lib/libSystem.B.dylib”未受影响。或者至少,文件大小和日期没有改变。由于该库没有改变,我推测修复问题的不是 Xcode,而是安装的 Git 版本。

I thought about testing that theory and found the older source code for various versions of Git, but didn't have time to spend compiling/installing/testing each one to see if this theory is correct. And I didn't see a simple method of uninstalling the 'command line tools'. Maybe someone else is more intrepid. :)

我想测试这个理论并找到了各种版本的 Git 的旧源代码,但没有时间花时间编译/安装/测试每个版本来看看这个理论是否正确。而且我没有看到卸载“命令行工具”的简单方法。也许别人更勇敢。:)

-- J

——J