-
Notifications
You must be signed in to change notification settings - Fork 97
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
Build ffmpeg with -ffat-lto-objects #354
Comments
I've "personally" never had trouble using LTO on ffmpeg as long as I use |
I can confirm that it works currently [ it didn't just few weeks ago, same setup ] via EXTRA_FFMPEG_CONF="--enable-lto", with ffmpeg-4.1.3 |
https://bugs.gentoo.org/566282 I use |
^ Oh was it only the x86 version that's acting up? Been a while since I've seen anything wrong so don't really remember. Reminder can append to |
I don't remember what exactly wrong with Just tried Error (x86)
|
Figured it could be my USE flags so I tried around a bit and seems I get the same error only if I remove my |
And yeah, |
if -flto is passed to the cflags --enable-lto is automatically passed to the ./configure |
i successfully built with : media-video/ffmpeg-4.1.3::gentoo was built with the following: |
After retrying a bit, seems the whole thing about not having I'd personally argue the best way to build this with LTO isn't to use |
^ Although, if don't want to force USE flags, adding fat-lto would be simpler for GentooLTO workarounds |
I just tested out @ionenwks , previously we used @pchome It seems that we should make this workaround apply only for x86, and for amd64 leave it as default -- does this sound reasonable? |
Also, @barolo , does this work for you even with |
Proposed modification to
The |
I simplified workaround to just
... |
I'm not sure, maybe |
Ah yes, you're right -- I'll check. Currently I have it built with |
Indeed, the |
Reference #103 too |
@InBetweenNames do you have clarity on why fat lto objects fixes things? From the docs it seems like the only thing it should do is include regular object code in addition to the IR, so it would only matter if the link step is not using LTO. |
Indeed -- it's actually due to incorrect linker setup usually. It's rare that it happens, but when the linker is invoked in such a way that LTO is inhibited, it can't "see" the LTO symbols and will instead claim there are undefined symbols instead. |
Wouldn’t it be completely non-lto in that case though? ie you might as well just turn off lto? |
In the worst case -- absolutely. But there are cases where some object files can be linked with LTO and others can't (for example, shared object dependencies built as part of the same package). That's where |
According to a post on Clear Linux's community forum (just 4 days ago), FFmpeg can be built safely with LTO so long as -ffat-lto-objects is enabled.
Quote: "FFMPEG does build nicely with the link-time optimizer, but putting -flto in the flags or configuring with --enable-lto tends to cause the build to fail with lots of undefined symbols. Instead, put -ffat-lto-objects in the flags (already there if you use the default CFLAGS that comes with Clear) so that the linker has a fallback. Do be sure to include --extra-ldflags='-flto -fuse-linker-plugin' --ar=gcc-ar."
Source: https://community.clearlinux.org/t/tips-and-techniques-for-building-ffmpeg/795
The text was updated successfully, but these errors were encountered: