The problem is with .asm files in the FFmpeg build.
Apple Clang embeds a special load command in the object files with the target platform, system version and SDK version which it takes from -target
or -mmacosx-version-min
or some similar command line argument.
Linker then checks such load commands in all object files being linked and warns if it couldn't find such command or if it detects incompatibility.
Most of other compilers don't know about that load command and give no way to output it in the object file. Problems were seen at least in YASM (it manifests in this issue), in D and Go compilers, in Crystal.
Unfortunately I couldn't find a workaround to build good objects for asm sources in FFmpeg or to disable that warnings. I've created an issue for YASM but this is a long shot - first you need this feature in YASM, then you need a way to pass the required argument to FFmpeg build for the asm sources.
UPDATE
Starting with Xcode 12 it became a problem, because this warning became an error and it seems there is no way to disable or ignore this. But it looks like I've managed to hackaround that using approach suggested by tmm1. Unfortunately at the current stage it requires a lot of manual work.
- I've forked
yasm
and added padding to the output object file for the missing load command. (for building call ./autogen.sh
and make
)
- I've forked
macho_edit
and added a way to append the required load command with a command line invocation. (for building call xcodebuild build -configuration Release -project macho_edit.xcodeproj -target macho_edit
)
- I've created a shell script that wraps invocation of the custom-built
yasm
and then custom built macho_edit
with required arguments (you can set which macos version and sdk version you want to manifest as supported in this script).
- To build
ffmpeg
with this wrapper I copy macos_yasm_wrap.sh
to the ffmpeg
directory and add --x86asmexe=`pwd`/macos_yasm_wrap.sh
argument to ./configure
call.
This seems to work. The proper way of doing that would be adding correct command line arguments to yasm
(like the ones Clang supports) and generating correct load commands in the first place. But I don't have time to do it this way right now :(