FFMpeg - macOS build 报错 : xcrun -sdk iphoneos clang ...

发布于:2024-05-02 ⋅ 阅读:(19) ⋅ 点赞:(0)


在 macOS 上使用 https://github.com/kewlbear/FFmpeg-iOS-build-script 脚本,运行 ./build-ffmpeg.sh 运行报错。
遇到问题,搜索结果不太准,看 issues 比较有用:
https://github.com/kewlbear/FFmpeg-iOS-build-script/issues


报错1:xcrun -sdk iphoneos clang is unable to create an executable file

building arm64...
xcrun -sdk iphoneos clang is unable to create an executable file.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

检查了 GCC、make 都是正确安装的

FFMpeg 也替换过新老版本:https://ffmpeg.org//releases/

搜索答案雷同,直到看到这个 issue,解决了我的问题
https://github.com/kewlbear/FFmpeg-iOS-build-script/issues/119


运行命令:

sudo xcode-select --switch /Applications/Xcode.app

前提是你在 /Applications/Xcode.app 安装了 Xcode


查看 xcode-select 所指

 % xcode-select -p
/Applications/Xcode.app/Contents/Developer

xcode-select 更详细的说明可参考:https://blog.csdn.net/lovechris00/article/details/114602610


报错 2 : error: unknown type name ‘AudioDeviceID’;

error: unknown type name ‘AudioDeviceID’;

参考:https://github.com/kewlbear/FFmpeg-iOS-build-script/issues/158

在脚本的 CONFIGURE_FLAGS 添加 --disable-audiotoolbox,变为:

...
CONFIGURE_FLAGS="--enable-cross-compile --disable-debug --disable-programs \
                 --disable-doc --enable-pic --disable-audiotoolbox  "            
...

伊织 2024-04-27(六)