二进制似乎找不到链接的 .dylib 库

发布于 2025-01-12 07:14:28 字数 1103 浏览 0 评论 0原文

我有一个适用于 macos 的 github 操作,需要下载 dmg 存档、提取二进制文件 并重新配置二进制文件,以便它们可以运行并链接到下载的 .dylib 库。下面是我正在使用的脚本。 不幸的是,当我运行二进制文件(kdu_expand)时,出现错误

/Users/runner/work/_temp/92b88adb-5bec-4d13-a51d-85fdf4e84e8d.sh: line 16:  1603 Killed: 9               ./kdu_expand -version
Error: Process completed with exit code 137.

这是重新配置二进制文件以链接到动态库的正确方法吗?

wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
mkdir kdu && mv KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip kdu && cd kdu
7z e KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
7z e KDU805_Demo_Apps_for_MacOS_200602.dmg 2>/dev/null || true
7z e Payload~ 2>/dev/null || true
chmod +x kdu_expand
chmod +x kdu_compress
install_name_tool -id ${PWD}/libkdu_v80R.dylib libkdu_v80R.dylib
install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_compress
install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_expand
echo "${{ github.workspace }}/kdu" >> $GITHUB_PATH
./kdu_expand -version

I have a github action for macos that needs to download a dmg archive, extract binaries
and re-configure binaries so that they can run and link to the downloaded .dylib library. Below is the script I am using.
Unfortunately, when I run the binary (kdu_expand) I get an error

/Users/runner/work/_temp/92b88adb-5bec-4d13-a51d-85fdf4e84e8d.sh: line 16:  1603 Killed: 9               ./kdu_expand -version
Error: Process completed with exit code 137.

Is this the correct way of re-configuring the binary to link to the dynamic library ?

wget -q http://kakadusoftware.com/wp-content/uploads/KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
mkdir kdu && mv KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip kdu && cd kdu
7z e KDU805_Demo_Apps_for_MacOS_200602.dmg_.zip
7z e KDU805_Demo_Apps_for_MacOS_200602.dmg 2>/dev/null || true
7z e Payload~ 2>/dev/null || true
chmod +x kdu_expand
chmod +x kdu_compress
install_name_tool -id ${PWD}/libkdu_v80R.dylib libkdu_v80R.dylib
install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_compress
install_name_tool -change /usr/local/lib/libkdu_v80R.dylib ${PWD}/libkdu_v80R.dylib kdu_expand
echo "${{ github.workspace }}/kdu" >> $GITHUB_PATH
./kdu_expand -version

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2025-01-19 07:14:29

Killed: 9 通常会提示代码设计错误。
也就是说,通过更改安装名称,您修改了二进制文件,从而使它们的代码签名无效(在我的例子中,install_name_tool 警告我这一点)。

要修复此问题,请对您修改的每个二进制文件运行以下命令:

codesign -s - -f path/to/binary

Killed: 9 more often than not hints at a codesigning error.
That is, by changing install names you modified the binaries, thus invalidating their code signatures (and in my case, install_name_tool warns me about this).

To fix it, run the following command against each binary you modified:

codesign -s - -f path/to/binary
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文