使用 Homebrew 安装 Cmake 3.19.2

2023-12-19

我正在尝试安装旧版本的 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

我沮丧得束手无策,似乎在原地踏步。任何帮助是极大的赞赏!


brew install ./cmake.rb会尝试安装一个瓶子,但显然它已经不存在了。尝试从源安装brew install -s ./cmake.rb.

❯ cmake --version
zsh: command not found: cmake

❯ curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/481056b12a782e11b43670f406b1674b05990d0d/Formula/cmake.rb
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2006  100  2006    0     0  26394      0 --:--:-- --:--:-- --:--:-- 26394

❯ brew install -s ./cmake.rb
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:0x00007ffab488a5c0>
Warning: Treating ./cmake.rb as a formula.
==> Downloading https://ghcr.io/v2/homebrew/core/sphinx-doc/manifests/4.0.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/sphinx-doc/blobs/sha256:df254b910ef155cbf68f614a903a7601c583b108252dd2d3a21d304577ceec42
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:df254b910ef155cbf68f614a903a7601c583b108252dd2d3a21d304577ceec42?se=2021-06-07T01%3A15%3A00Z&sig=qO3%2Be9wjDZFGb8G0TMkWRdx%2FsSzXGGmIoQoVXBSKTLc%3D&sp=
######################################################################## 100.0%
==> Downloading https://github.com/Kitware/CMake/releases/download/v3.19.2/cmake-3.19.2.tar.gz
==> Downloading from https://github-releases.githubusercontent.com/537699/e5e69f80-3f8c-11eb-8f66-b847f2092348?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210607%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=
######################################################################## 100.0%
Warning: cmake 3.20.3 is available and more recent than version 3.19.2.
==> Installing dependencies for cmake: sphinx-doc
==> Installing cmake dependency: sphinx-doc
==> Pouring sphinx-doc--4.0.2.big_sur.bottle.tar.gz
????  /usr/local/Cellar/sphinx-doc/4.0.2: 3,885 files, 55.9MB
==> Installing cmake
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.
==> ./bootstrap --prefix=/usr/local/Cellar/cmake/3.19.2 --no-system-libs --parallel=12 --datadir=/share/cmake --docdir=/share/doc/cmake --mandir=/share/man --sphinx-build=/usr/local/opt/sphinx-doc/bin/sphinx-build --sphinx-html --sphinx
==> make
==> make install
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.
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cmake
==> Summary
????  /usr/local/Cellar/cmake/3.19.2: 6,376 files, 63.9MB, built in 4 minutes 22 seconds
Removing: /Users/nega/Library/Caches/Homebrew/cmake--3.19.2.tar.gz... (8.8MB)
==> Caveats
==> cmake
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cmake

❯ cmake --version
cmake version 3.19.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

❯

当然,接下来brew upgrade你这样做可能会消除它。

您可以安装 KitWare 提供的 macOS 应用程序包:

❯ curl -O https://cmake.org/files/v3.19/cmake-3.19.2-macos-universal.dmg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 61.6M  100 61.6M    0     0  6340k      0  0:00:09  0:00:09 --:--:-- 13.3M

❯ open cmake-3.19.2-macos-universal.dmg

或者正如 @the-swine 在他们的评论中建议的那样,通过源代码安装 CMake。

❯ curl -O https://cmake.org/files/v3.19/cmake-3.19.2.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9047k  100 9047k    0     0  1301k      0  0:00:06  0:00:06 --:--:-- 2035k

❯ tar xf cmake-3.19.2.tar.gz

❯ cd cmake-3.19.2

~/cmake-3.19.2 ❯ less README.rst

~/cmake-3.19.2 ❯ ./bootstrap --prefix=/opt/cmake && make && sudo make install
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Homebrew 安装 Cmake 3.19.2 的相关文章

随机推荐

  • 混合移动应用程序的 HTML 树

    寻找适用于混合移动应用程序并具有以下属性的树 或嵌套列表 UI 组件 拖放 用于插入 删除 更新 展开 折叠和拖动 悬停 放置的动画 视觉反馈 在移动设备上表现良好 开源 我接受付费开源 双重许可等 现代 干净的外观 现代 实现 例如与 A
  • MongoDB RangeError:尝试写入缓冲区边界之外

    除了特定数组之外 我不会一直收到此错误 我正在尝试使用 node js mongodb 本机驱动程序将 JSON 对象插入到 mongodb 集合中 这个 JSON 对象有几个字符串属性和一个大字符串数组属性 数组可以有数千个字符串项 我的
  • 根据背景更改导航字体颜色

    我的问题是这样的 我有一个固定的左侧导航栏 我必须根据其下方部分的背景更改列表字体颜色 代码是这样的fiddle http jsfiddle net 76kMN 2 因此 如果该部分为黑色且位于链接下方 则看不到文本 我必须根据每个列表下面
  • Python获取具有特定扩展名的目录中的最新文件

    我正在尝试使用 upload 目录中带有 log 扩展名的最新文件来由 Python 处理 我用一个UbuntuWeb 服务器和文件上传是通过 html 脚本完成的 上传的文件由Python脚本处理 并将结果写入MySQL数据库 我用了th
  • 为什么 TF2.0 中梯度带的分类交叉熵损失相对于 logits 的梯度为 0?

    我正在学习 Tensorflow 2 0 我正在尝试弄清楚渐变胶带是如何工作的 我有一个简单的示例 其中我评估了 logits 和标签之间的交叉熵损失 我想知道为什么相对于 logits 的梯度为零 请看下面的代码 TF的版本是tensor
  • 如何更改百里香中变量的值?

    我是百里香新手 我现在有点困惑 请查看下面的代码
  • java中如何模拟键盘按下

    我想模拟在 JTextField 中输入字符串 可以包含任何字符 我正在为此使用 new KeyEventData 但我无法确定如何处理 等字符 以及如何将新字符附加到已输入的字符中 您可以使用Robot http docs oracle
  • 头文件中声明的变量是否为包含该头的每个 .c 文件提供变量的单独副本?

    假设有两个源文件 file 1 c and file 2 c 其中包含相同的头文件file h file h has a variable int var Once file 1 c and file 2 c包括file h do file
  • 是否可以在 Windows 7 上使用 PhoneGap 开发 iOS 应用程序?

    我将开发一个在 iPad 上运行的 iOS 应用程序 我将使用 PhoneGap 来完成它 可以在Windows 7上开发吗 我一直在阅读 PhoneGap 文档 它并没有说这是不可能的 但我想我应该在这里提出要求 以避免启动和陷入困境 谁
  • Heroku Cedar 上的静态网站

    我尝试按照说明进行操作here http devcenter heroku com articles static sites on heroku为了在 Heroku 的 Cedar 堆栈上创建一个静态网站 我已经把网站放上来了here h
  • 获取当前控制器

    在一个函数中我想到达当前控制器 front Zend Controller Front getInstance 这只给出了一个处理程序 但没有给出当前控制器 我将代码从函数更改为控制器内部 并询问它们的起源 包括我从 getInstance
  • Avalonia 中的 OpenFileDialog - ShowAsync 错误

    背景 我一直在使用 Avalonia 开发跨平台 UI 为了学习它 我正在尝试创建一个简单的程序 使用以下命令打开 txt 文件OpenFileDialog并将其内容显示在ComboBox在另一个窗口中 我正在尝试编写一个打开文件对话框并返
  • 如何将 LiveData> 转换为 LiveData>?

    假设我们有两个 LiveData 对象 LiveData
  • 在 nginx 生产服务器上找不到单个 laravel 路由 (404)

    In Laravel 5 4我有很多 api 路由 所有这些都工作正常 我添加了一条名为 schedules 的路线 该路线在我的开发站点上运行良好 在生产服务器上我收到404这条单一路线的错误 我用Nginx 我所有的测试都通过了 路线已
  • 为什么sklearn Imputer需要拟合?

    我对机器学习这件事真的很陌生 我正在学习关于这个主题的在线课程 在本课程中 讲师展示了以下代码 imputer Inputer missing values Nan strategy mean axis 0 imputer Imputer
  • 如何在mawk中启用区间正则表达式?

    当我在 Ubuntu 1604 上运行 mawk 时遇到一个问题 echo 123 456 mawk 0 0 9 3 print 0 尽管常规模式实际上匹配 但上面的命令没有输出任何内容 然后我尝试使用相同的常规模式运行egrep echo
  • 在 C# 中解析 JSON

    我从 RESTful API 收到 JSON 对象形式的响应 通常 当密钥已知时我可以很好地解析它 例如 我创建一个User像这样的类 DataContract public class User DataMember public str
  • 移动eclipse安装目录会出现问题

    我最近重新组织了我的 Eclipse 安装目录 以满足各种风格的 Eclipse Helios Indigo Juno 但这导致了一个问题 因为 eclipse 目录 位于我的主目录中 有子目录标识 Eclipse 版本但以我认为标识安装目
  • elasticsearch 得到太多结果,需要帮助过滤查询

    我在理解 ES 查询系统的底层方面遇到了很多问题 例如 我有以下查询 size 0 query bool must term referer www xx yy com range timestamp gte now lt now 1h
  • 使用 Homebrew 安装 Cmake 3.19.2

    我正在尝试安装旧版本的 CMake 来编译需要它的软件 https github com horosproject horos https github com horosproject horos 如果你使用brew install cm