这是一个令人费解的问题,人们似乎以不同的方式偶然发现,所以这是我发现自己所处的环境,以及我知道对其他人有效的不同解决方案,应该在我发现的解决方案之前尝试。
背景:
我第一次安装luarocks,使用
luarocks install luacheck
,然后遇到了一个问题:
sh: line 1: 42931 Abort trap: 6 wget --no-check-certificate --no-cache --user-agent="LuaRocks/3.9.2 macosx-x86_64 via wget" --quiet --timeout=30 --tries=1 --timestamping 'https://luarocks.org/manifest-5.4.zip' > /dev/null 2> /dev/null
...
Warning: Failed searching manifest: Failed downloading https://raw.githubusercontent.com/rocks-moonscript-org/moonrocks-mirror/master/manifest-5.4
...
Error: No results matching query were found for Lua 5.4.
To check if it is available for other Lua versions, use --check-lua-versions.
事实上,包裹已经可用。我知道这一点是因为单击控制台输出中的链接会返回一个文件。 (您可以通过查看控制台输出中链接的 https://raw.githubusercontent.com/... url 是否返回文件来验证这一点。)
问题:
从我在网上找到的建议,我知道我有问题
wget
。当我运行命令 wget --version
时,我会得到以下输出:
dyld[42978]: Library not loaded: /usr/local/opt/libunistring/lib/libunistring.2.dylib
由于我使用的是 MacOS,因此我使用brew 重新安装了以下软件包:
wget
:brew reinstall wget
gettext
:brew reinstall gettext
这似乎对很多人都有效。但对我来说,这个问题仍然存在。
具体问题:
一篇文章建议使用命令
brew linkage wget
检查包依赖关系。我可以看到:
System libraries:
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
/usr/lib/libSystem.B.dylib
/usr/lib/libiconv.2.dylib
/usr/lib/libz.1.dylib
Homebrew libraries:
/usr/local/opt/gettext/lib/libintl.8.dylib (gettext)
/usr/local/opt/libidn2/lib/libidn2.0.dylib (libidn2)
> /usr/local/opt/libunistring/lib/libunistring.5.dylib (libunistring) <<< installed
/usr/local/opt/openssl@3/lib/libcrypto.3.dylib (openssl@3)
/usr/local/opt/openssl@3/lib/libssl.3.dylib (openssl@3)
Indirect dependencies with linkage:
gettext
libunistring
如上所述,从
wget
命令报告“丢失”的软件包已明确安装并标记为依赖项。这意味着 wget
找不到正确版本的 libunistring
,因为它正在寻找 libunistring.2.dylib
并且 libunistring.5.dylib
已安装并链接。
解决方案:
根据另一篇文章,我决定为版本 2 到版本 5 创建一个符号链接。我运行了以下命令:
ln -s /usr/local/opt/libunistring/lib/libunistring.5.dylib /usr/local/opt/libunistring/lib/libunistring.2.dylib
从那里,
wget --version
返回了正常的输出。
然后我就可以毫无问题地运行原始版本
luarocks install luacheck
。