简体   繁体   English

Xcode 12:如何链接为独立构建的目标文件

[英]Xcode 12: how to link against object files built for free standing

The issue is about linking x86_64 macOS executables statically against libavcodec, libavdevice, etc, which have some object files built against freestanding as they use YASM which isn't able to embed the macOS "tag" in the binary (see Building for macOS, but linking in object file built for free standing for detailed information on that issue).问题是关于将 x86_64 macOS 可执行文件静态链接到 libavcodec、libavdevice 等,这些文件有一些针对独立构建的目标文件,因为它们使用 YASM 无法在二进制文件中嵌入 macOS“标签”(请参阅为 macOS 构建,但是链接为独立构建的目标文件,以获取有关该问题的详细信息)。

Everything works fine under Xcode 11.6 - the following messages are here, but they are warnings.在 Xcode 11.6 下一切正常——这里有以下消息,但它们是警告。 With the Xcode 12 update they become an error.随着 Xcode 12 更新,它们变成了一个错误。 How to make them warnings again ?如何让他们再次警告? I could not find anything relevant in the ld man page.我在 ld 手册页中找不到任何相关内容。

ld: in ffmpeg/lib/libavcodec.a(aacencdsp.o), building for macOS, but linking in object file built for free standing, for architecture x86_64 ld:在 ffmpeg/lib/libavcodec.a(aacncdsp.o) 中,为 macOS 构建,但链接为独立构建的目标文件,用于体系结构 x86_64

There is no option I have found to revert the error to a warning.我发现没有任何选项可以将错误恢复为警告。 Apple has been warning us about this issue for a few releases of XCode now and the warning has become an error. Apple 现在已经针对 XCode 的几个版本就这个问题向我们发出警告,并且警告已经变成了一个错误。

Until NASM is modified, or we can use some other assembler, the only option that allows me to build and link against the libav libraries in my application is to disable assembly when compiling ffmpeg.在修改 NASM 或者我们可以使用其他一些汇编程序之前,允许我在我的应用程序中构建和链接 libav 库的唯一选项是在编译 ffmpeg 时禁用汇编。

./configure --disable-asm

This works my my case, as the performance of the non-assembly code path is acceptable in my desktop authoring tool.这适用于我的情况,因为非汇编代码路径的性能在我的桌面创作工具中是可以接受的。 The server-based renderer still uses the assembly code path as it is linux based.基于服务器的渲染器仍然使用汇编代码路径,因为它是基于 linux 的。

You may have to configure any libaries that you are including in your ffmpeg build to also disable assembly.您可能必须配置包含在 ffmpeg 构建中的任何库以禁用程序集。

Once again, this is an acceptable solution for my case, as the non-assembly code paths are fast enough for my use case.再一次,这对于我的案例来说是一个可以接受的解决方案,因为非汇编代码路径对于我的用例来说足够快。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM