kewlbear/FFmpeg-iOS-build-script

Not able to run on iOS simulator (x86)

alex-chou9 opened this issue · 2 comments

Host Environment: MacOS 14.0 (Intel x86_64), Xcode 15.0.1

./build-ffmpeg.sh arm64 x86_64

it runs great on real iOS devices, but on Xcode simulator there are link errors.

Multiple errors: unknown platform in '/Users/Test/FFmpeg/libavutil.a[87](pixelutils.o)' in '/Users/Test/FFmpeg/libavutil.a[87](pixelutils.o)';
unknown platform in '/Users/Test/FFmpeg/libavutil.a[85](lls.o)' in '/Users/Test/FFmpeg/libavutil.a[85](lls.o)'; 
unknown platform in '/Users/Test/FFmpeg/libavutil.a[83](imgutils.o)' in '/Users/Test/FFmpeg/libavutil.a[83](imgutils.o)'; 
unknown platform in '/Users/Test/FFmpeg/libavutil.a[81](float_dsp.o)' in '/Users/Test/FFmpeg/libavutil.a[81](float_dsp.o)'; 
unknown platform in '/Users/Test/FFmpeg/libavutil.a[79](fixed_dsp.o)' in '/Users/Test/FFmpeg/libavutil.a[79](fixed_dsp.o)'; 
unknown platform in '/Users/Test/FFmpeg/libavutil.a[78](cpuid.o)' in '/Users/Test/FFmpeg/libavutil.a[78](cpuid.o)'; 
unknown platform in '/Users/Test/FFmpeg/libswresample.a[14](resample.o)' in '/Users/Test/FFmpeg/libswresample.a[14](resample.o)'; 
....omitted (too many)


Linker command failed with exit code 1 (use -v to see invocation)

I guess it has something to do with x86 assembler, because all of these problematic files are located in the ffmpeg/libxxxx/x86 folders.

Furthermore,
(1)

there are a lot of these warning:
src/libavfilter/x86/vf_blend.asm:416: warning: dropping trailing empty parameter in call to multi-line macro `BLEND_INIT' [-w+macro-params-legacy]
src/libavfilter/x86/vf_blend.asm:70: ... from macro `BLEND_SIMPLE' defined here
src/libavfilter/x86/vf_blend.asm:417: warning: dropping trailing empty parameter in call to multi-line macro `BLEND_INIT' [-w+macro-params-legacy]
src/libavfilter/x86/vf_blend.asm:70: ... from macro `BLEND_SIMPLE' defined here
src/libavfilter/x86/vf_blend.asm:418: warning: dropping trailing empty parameter in call to multi-line macro `BLEND_INIT' [-w+macro-params-legacy]
src/libavfilter/x86/vf_blend.asm:70: ... from macro `BLEND_SIMPLE' defined here
src/libavfilter/x86/vf_blend.asm:419: warning: dropping trailing empty parameter in call to multi-line macro `BLEND_INIT' [-w+macro-params-legacy]
src/libavfilter/x86/vf_blend.asm:70: ... from macro `BLEND_SIMPLE' defined here
src/libavfilter/x86/vf_blend.asm:420: warning: dropping trailing empty parameter in call to multi-line macro `BLEND_INIT' [-w+macro-params-legacy]

(2)
the static library files generated in the folder FFmpeg-iOS-build-script-master/thin/x86_64 is significantly smaller than in FFmpeg-iOS-build-script-master/thin/arm64
libavcodec.a is 41.5MB(arm64)/ 18.7MB(x86_64)
libavdevice.a is 159KB(arm64)/ 55KB(x86_64)
libavfilter.a is 11.4MB(arm64)/ 4.8MB(x86_64)
libavformat.a is 11.1MB(arm64)/ 3.5MB(x86_64)

But I don't know how to solve it...

(1) Tried upgrade nasm from 2.15.05 to 2.16.01. Same. Still not able to run on simulator.

(2) Tried adding "--disable-asm" to CONFIGURE_FLAGS in build-ffmpeg.sh, then it will work on the simulator.
But this is not ideal, as adding this flag will have negative performance impact on real iOS device and simulator.

I managed to get a MacOS 11.6 with Xcode 13.1, and got the .a static libraries that can run on both real iPhone & simulator.