-
Couldn't load subscription status.
- Fork 359
Random patches and tricks for building on M1 #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Needs newer code in some cases, and some conditionals to check platform. The external patches possibly should be brought in? Seems to work for now if anyone is in need. Learnings from https://github.com/ssut/ffmpeg-on-apple-silicon
@rtgoodwin, thank you for your work. I do not own an M1 Mac, so I'm currently unable to test the build process. But with some small improvements, I can merge the pull request into the main branch, as all other systems seem to build without any problems.
Things I would improve:
- Store, if it is Apple Silicon in a variable, so the check doesn't have to be repeated multiple times.
- Linie 363, execute ./Configure -> execute ./configure
- Line 393, Use the compressed archive download instead of the git command. I would recommend not downloading the master, but a working commit instead. https://code.videolan.org/videolan/x264/-/archive/0d754ec36013fee82978496cd56fbd48824910b3/x264-0d754ec36013fee82978496cd56fbd48824910b3.tar.gz. Also, this version can be used for all systems if it works.
Best,
Markus
* Define M1 variable once * Grab x264 archive vs git * configure vs Configure * bonus: output binary type. Feel free to take or leave :)
- How I love your CI/CD tests! 😄 Feel much better knowing that it in fact didn't horribly break elsewhere!
- All changes addressed except that right now my other Mac is out of commission so I can't be sure if that x264 commit works for non-M1 platforms. (The irony!) I will submit a PR separately just for that change to see if it passes your tests.
Tail of build with current script commit. (Kind of makes me want to add logging 🤔 😄 )
License: nonfree and unredistributable
$ make -j 8
$ make install
Successfully built Apple Silicon (M1) for darwin20.0: Mach-O 64-bit executable arm64
Building done. The following binaries can be found here:
- ffmpeg: /Users/richardgoodwin/ffmpeg-build-script/workspace/bin/ffmpeg
- ffprobe: /Users/richardgoodwin/ffmpeg-build-script/workspace/bin/ffprobe
- ffplay: /Users/richardgoodwin/ffmpeg-build-script/workspace/bin/ffplay
Install these binaries to your /usr/local/bin folder? Existing binaries will be replaced. [Y/n] Y
Done. FFmpeg is now installed to your system.
file /usr/local/bin/ffmpeg
/usr/local/bin/ffmpeg: Mach-O 64-bit executable arm64
otool -L /usr/local/bin/ffmpeg
/usr/local/bin/ffmpeg:
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1770.255.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292601)
/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)
/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
/System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1463年2月1日)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 100000)
/System/Library/Frameworks/CoreHaptics.framework/Versions/A/CoreHaptics (compatibility version 1.0.0, current version 1.0.0, weak)
/System/Library/Frameworks/GameController.framework/Versions/A/GameController (compatibility version 1.0.0, current version 1.0.0, weak)
/System/Library/Frameworks/ForceFeedback.framework/Versions/A/ForceFeedback (compatibility version 1.0.0, current version 1.0.2)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 164.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0, weak)
/System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 244.32.7, weak)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage (compatibility version 1.0.1, current version 5.0.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 202220117)
/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
/System/Library/Frameworks/VideoToolbox.framework/Versions/A/VideoToolbox (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.255.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1122110)
Hmm.. either tests are queued/borked (still haven't completed), or my addition of using "file" causes issues. Definitely optional if so.
Edit: All completed fine! Will do a separate PR for the x264 commit to see if it passes all platforms.
Looks like #71 (this branch plus using the tagged x264 commit) is fine on all platforms. Thanks as always! 😄
Preview only
I suspect several things in here are questionable, open to ideas/better ways. But it builds! (On Big Sur, on my machine, etc...)
Notes
Learnings from https://github.com/ssut/ffmpeg-on-apple-silicon
Output analysis