如何运行 MacRuby 补丁

发布于 2024-10-30 09:25:21 字数 425 浏览 3 评论 0原文

我在尝试安装与 llvm 相关的 MacRuby 时遇到错误,并找到了针对特定问题的补丁,但不知道如何应用该补丁。

错误是

    In file included from main.cpp:8:
llvm.h:21:38: error: llvm/Analysis/DIBuilder.h: No such file or directory
In file included from vm.h:594,
                 from main.cpp:17:

我找到的补丁是 无法在 r5276 中使用 LLVM 2.8 进行编译。

现在我有了补丁文件,该怎么办我跑去申请吗?

I ran into an error trying to install MacRuby related to llvm and found a patch for the specific problem but have no idea how to apply the patch.

The error is

    In file included from main.cpp:8:
llvm.h:21:38: error: llvm/Analysis/DIBuilder.h: No such file or directory
In file included from vm.h:594,
                 from main.cpp:17:

And the patch I found was
Could not compile with LLVM 2.8 in r5276.

Now that I have the patch file, what do I run to apply it?

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

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

发布评论

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

评论(1

蓝天 2024-11-06 09:25:21

该补丁看起来很简单,您可以简单地手动应用它 - 删除以 - 开头的行并添加以 + - 开头的行- 但只有当有足够多的更改导致补丁无法完全应用时才需要这样做。

由于补丁文件可以通过不同的方式生成,因此也可以通过不同的方式应用:

diff -u a a.fixed > fix_compile.diff
patch < fix_compile.diff

diff -u dir1/a dir2/a > fix_compile.diff
patch -p1 < fix_compile.diff

diff -u dir1 dir2 > fix_compile.diff
patch -p1 < fix_compile.diff

如果修复文件位于层次结构中向下的六个目录中,则您需要尝试向上六个目录应用补丁,或者使用 -p6 或类似的选项来删除无关的前导目录。

这可能听起来很复杂,但如果您将目录更改为包含要修补的文件的目录,通常只需运行 patch fix_compile.diffpatch -p1 fix_compile.diff。我喜欢首先尝试应用补丁,以防万一某些补丁应用干净,而有些则不能:

patch --dry-run < fix_compile.diff

patch --dry-run -p1 < fix_compile.diff

等等。一旦找到有效的补丁,请将其删除--dry-run 并应用、编译,看看是否可以开始。

That patch looks simple enough that you could simply apply it by hand -- remove the lines starting with - and add the lines starting with + -- but that's only necessary if there are enough changes that the patch won't apply cleanly.

Because a patch file can be generated in different ways, it can also be applied in different ways:

diff -u a a.fixed > fix_compile.diff
patch < fix_compile.diff

diff -u dir1/a dir2/a > fix_compile.diff
patch -p1 < fix_compile.diff

diff -u dir1 dir2 > fix_compile.diff
patch -p1 < fix_compile.diff

If the fixed file is six directories down in the hierarchy, you either need to try applying the patch six directories up, or use a -p6 or similar option to strip off extraneous leading directories.

It might sound complicated, but if you change directory to whichever directory contains the files to be patched, you can usually just run patch < fix_compile.diff or patch -p1 fix_compile.diff. I like to try applying the patches first, just in case some of the patch applies cleanly, and some doesn't:

patch --dry-run < fix_compile.diff

or

patch --dry-run -p1 < fix_compile.diff

etc. Once you find one that works, remove the --dry-run and apply, compile, and see if you're good to go.

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