I'm trying to build a universal binary of ffmpeg on MacOS, by compiling it twice (for arm64 and x86_64) and then using the lipo tool to combine the resulting binaries. I'm on an M1 Mac, so uname -m returns arm64 on my machine.

When running the configure script like so:

./configure --arch=x86_64 

It outputs:

install prefix /usr/local source path . C compiler gcc C library ARCH c (generic) ... 

And after running make, inspecting the built binaries with lipo -archs reveals that it's building them for arm64.

The result is the same if I add --enable-crosscompile to the configure call.

Based on this post, I also tried --arch=x86, but that had the exact same result, configure script displayed arch as c (generic) and inspecting artefacts with lipo shows they are built for arm64 architecture.

Does anyone have any ideas? Why is the configure script just refusing to build for x86_64?

1

1 Answer

You can speify -cc to make clang compile x86_64 binary. Try:

./configure --enable-cross-compile --prefix=./install_x86_64 --arch=x86_64 --cc='clang -arch x86_64' 

Note: don't forget to clear the outdated files by

make distclean 

By the way, I have successfully built universal binrary of FFmpeg, you can refer to my build scripts. make_compile.py compile both x86_64 and arm64 binraries, and make_universal.py use lipo to generate universal binrary.

Reference

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.