【问题标题】:Symlink make as gmake on Mac在 Mac 上将符号链接制作为 gmake
【发布时间】:2022-01-16 22:48:41
【问题描述】:

我正在运行一个程序 (OpenModelica OMEdit 1.18.0~dev-109-ged8ef0a),其中一项操作需要 gmakegmake 没有安装在我的 Mac (Big Sur 11.5.2) 上,但 make 是。我试图符号链接gmake 指向make,但它不起作用:

➜  where make         
/usr/bin/make
➜  make -v | HEAD -n 1
GNU Make 3.81
➜  pwd
/opt/openmodelica/bin
➜  sudo ln -s /usr/bin/make /opt/openmodelica/bin/gmake
➜  ls -lh gmake
lrwxr-xr-x  1 root  wheel    13B 13 Dec 09:15 gmake -> /usr/bin/make
➜  /opt/openmodelica/bin/gmake -v
gmake: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find gmake 2> /dev/null' failed with exit code 17664: (null) (errno=Invalid argument)
xcode-select: Failed to locate 'gmake', requesting installation of command line developer tools.

它每次都会提示安装我已经完成的 XCode 命令行开发工具。从错误消息看来,尽管指向了make 可执行文件,但它似乎正在尝试查找gmake? (为什么会出错?)有没有办法让它按我的预期工作,还是我必须使用 brew 安装 gmake 然后符号链接到那个?

命令行工具版本:

➜ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 12.5.1.0.1.1623191612
volume: /
location: /
install-time: 1639360537
groups: com.apple.FindSystemFiles.pkg-group

** 编辑 **

我使用的是 zsh 5.8 (x86_64-apple-darwin20.0),我不知道这是否是导致 gmake 符号链接到 make 无法正常工作的一个因素?

【问题讨论】:

  • 您可以使用 Homebrew 中的 brew install make 安装 gmake 作为 Apple 的 BSD 风格 make 的替代品。

标签: gnu-make symlink


【解决方案1】:

我不明白为什么会这样,但来自@Holger Just 的评论:

➜ brew install make

这将添加一个符号链接:

➜ ls -lh /usr/local/bin/gmake
/usr/local/bin/gmake@ -> ../Cellar/make/4.3/bin/gmake

然后用符号链接代替:

➜ sudo ln -s /usr/local/bin/gmake /opt/openmodelica/bin/gmake

...按预期工作:

➜ /opt/openmodelica/bin/gmake -v | head -n 1
GNU Make 4.3

【讨论】:

    猜你喜欢
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-07
    相关资源
    最近更新 更多