我正在尝试安装旧版本的 CMake 来编译需要它的软件(https://github.com/horosproject/horos https://github.com/horosproject/horos)
如果你使用brew install cmake
它将安装 3.20 版本,但我需要安装 3.19.2 才能使编译工作。
你可能认为这很容易,但我一直在挣扎。以下是我尝试过的一些事情:
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/481056b12a782e11b43670f406b1674b05990d0d/Formula/cmake.rb && brew install ./cmake.rb
该命令下载原始公式,然后尝试根据我自发布以来看到的一些答案进行安装brew versions
命令已弃用。
尝试运行上面的命令会出现以下错误:
Warning: Calling `cellar` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256` with a `cellar:` argument instead.
Warning: Calling `sha256 "digest" => :tag` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256 tag: "digest"` instead.
Warning: Calling `sha256 "digest" => :tag` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256 tag: "digest"` instead.
Warning: Calling `sha256 "digest" => :tag` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256 tag: "digest"` instead.
Warning: Calling `sha256 "digest" => :tag` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256 tag: "digest"` instead.
Error: Failed to load cask: ./cmake.rb
Cask 'cmake' is unreadable: wrong constant name #<Class:0x00007fe8f24621b0>
Warning: Treating ./cmake.rb as a formula.
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/manifests/3.19.2
##O#- #
curl: (22) The requested URL returned error: 404
Error: Failed to download resource "cmake_bottle_manifest"
Download failed: https://ghcr.io/v2/homebrew/core/cmake/manifests/3.19.2
我认为它不起作用,因为我需要对清单下载进行身份验证,但这之前应该可以工作,没有任何问题或类似的要求,让我相信我可能做错了什么。
任何帮助表示赞赏!成功的结果将导致cmake --version
说是版本3.19.2。另外我想确认我知道 cmake 是 100% 的问题,因为我在我的另一台机器上编译了 Horos。
这留下了我从那里复制 cmake 的另一种可能性,但我不确定如何正确地做到这一点,或者这有多难? (如果这甚至是正确的程序,更不用说这对这个问题的未来读者没有帮助)。
额外信息:
https://github.com/Homebrew/homebrew-core/blob/2be111d6b85b6a72565b4883cafb4f171c6e6b8f/Formula/cmake.rb https://github.com/Homebrew/homebrew-core/blob/2be111d6b85b6a72565b4883cafb4f171c6e6b8f/Formula/cmake.rb
这是我为旧版本的 cmake 找到的公式示例。
https://github.com/Homebrew/homebrew-core/commits/master/Formula/cmake.rb https://github.com/Homebrew/homebrew-core/commits/master/Formula/cmake.rb
上面是所有不同版本的列表
奇怪的是...如果你使用这个方法与最新的瓶子 3.20 它的工作原理!
UPDATE::
所以我正在阅读另一个答案,看来这个错误是由 cURL 过期引起的。因此,我更新到最新的 cURL(确认它仍然适用于最新版本),然后返回到旧版本,现在我收到了不同的错误。
https://superuser.com/questions/1647213/brew-install-fails-downloading-from-ghcr-io-macos-mojave https://superuser.com/questions/1647213/brew-install-fails-downloading-from-ghcr-io-macos-mojave
上面是我了解到cURL版本修复的地方。
现在我的错误是这样的:
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/d1a6d9cec03e43ae276ab6423fba0b91b69a1945/Formula/cmake.rb && brew install ./cmake.rb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1961 100 1961 0 0 46229 0 --:--:-- --:--:-- --:--:-- 50282
/usr/local/Homebrew/Library/Homebrew/formulary.rb:84:in `rescue in block in load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:77:in `block in load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:90:in `load_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:110:in `load_formula_from_path'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:195:in `load_file'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:185:in `klass'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:180:in `get_formula'
/usr/local/Homebrew/Library/Homebrew/formulary.rb:404:in `factory'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:98:in `load_formula_or_cask'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:57:in `block in to_formulae_and_casks'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:56:in `each'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:56:in `flat_map'
/usr/local/Homebrew/Library/Homebrew/cli/named_args.rb:56:in `to_formulae_and_casks'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:158:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:122:in `<main>'
Error: cmake: Calling `cellar` in a bottle block is deprecated! Use `brew style --fix` on the formula to update the style or use `sha256` with a `cellar:` argument instead
运行 brew style --fix ./cmake.rb 将修复上面的错误,但随后我再次收到完全相同的错误!
brew install ./cmake.rb
Error: Failed to load cask: ./cmake.rb
Cask 'cmake' is unreadable: wrong constant name #<Class:0x00007fc2138b7f90>
Warning: Treating ./cmake.rb as a formula.
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/manifests/3.19.2
curl: (22) The requested URL returned error: 404
Error: Failed to download resource "cmake_bottle_manifest"
Download failed: https://ghcr.io/v2/homebrew/core/cmake/manifests/3.19.2
我沮丧得束手无策,似乎在原地踏步。任何帮助是极大的赞赏!