Skip to content
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

--lto=on build fails on Linux with GCC #4699

Open
lokok8 opened this issue Dec 2, 2022 · 6 comments · May be fixed by #4707
Open

--lto=on build fails on Linux with GCC #4699

lokok8 opened this issue Dec 2, 2022 · 6 comments · May be fixed by #4707
Labels

Comments

@lokok8
Copy link

lokok8 commented Dec 2, 2022

Problem Description

Hi,
building current master with --lto=on fails for me on two different systems. Hopefully its not either an issue or misuse on my end.
In the pastebin below you will find the end part of my compilation logs.

I tested GCC 12.2.0 and GCC 11.3.0 on Ryzen 3900x and Ryzen 5900x, building inside gcc:*-bullseye docker images.

Thanks!

./configure --lto=on --launch

Activity Log, Crash Log or any other details

https://pastebin.com/anp1Mtes

What Operating System are you running?

gcc:12.2.0-bullseye (docker)

What version of HandBrake are you running?

Nightly e41f232

Where did you download HandBrake from?

No response

@Nomis101
Copy link
Contributor

Nomis101 commented Dec 2, 2022

No idea what caused your error, but I found this, which looks similar:
http://ffmpeg.org/pipermail/ffmpeg-user/2015-September/028415.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91298

Can you build FFmpeg on its own, with --enable-lto or will this fail with the same error?

@lokok8
Copy link
Author

lokok8 commented Dec 2, 2022

I tried building ffmpeg by replicating this guide, and it seems that I have the exact same error there.

I copied --enable-lto --enable-shared --ar=gcc-ar --ranlib=true from the ffmpeg mailing list and it fixes the build.
Without investigating, I don't know how to apply these flags to the handbrake build.


Below some more information on my build setup. Note that I am no expert in building C/C++ projects.

Handbrake --lto=on build

ffmpeg --enable-lto build

ffmpeg --enable-lto --enable-shared --ar=gcc-ar --ranlib=true build

@lokok8
Copy link
Author

lokok8 commented Dec 2, 2022

I confirmed locally that only --enable-shared fixes my standalone ffmpeg build.

ffmpeg --enable-lto --enable-shared build

@Nomis101
Copy link
Contributor

Nomis101 commented Dec 3, 2022

This seems more like a ffmpeg bug to me then. It would be good to report this to ffmpeg, so they can fix this.

As a workaround you can try to edit the file HandBrake/contrib/ffmpeg/module.defs
and replace

ifeq (on,$(GCC.lto))
    FFMPEG.CONFIGURE.extra += --enable-lto
endif

with

ifeq (on,$(GCC.lto))
    FFMPEG.CONFIGURE.extra += --enable-lto --enable-shared
endif

This should fix your issue, until there is a proper fix for this.

@lokok8
Copy link
Author

lokok8 commented Dec 3, 2022

Thank you for your help!

  • I will try to create a working Handbrake build with your suggestions and actually test it in the coming days
  • This topic is completely over my head, so if anyone else can actually replicate my issue and is interested in bringing it up with upstream ffmpeg, please do! Maybe I'll get into it at some point, but no promises.

Meanwhile I also got a successful build of ffmpeg with --enable-lto --enable-pic

I have absolutely no clue what I am doing or what all this means. I just tried it out, because something like that was mentioned in the same ffmpeg mail and I also found mentions of it from skimming this Clear Linux forum post and this gentooLTO GitHub issue from 2019.

@Nomis101
Copy link
Contributor

Nomis101 commented Dec 3, 2022

Thanks for your test. I also found the --enable-pic information here.
http://ffmpeg.org/pipermail/ffmpeg-user/2017-August/036977.html

Could you then try, if

ifeq (on,$(GCC.lto))
    FFMPEG.CONFIGURE.extra += --enable-lto --enable-pic
endif

in the file HandBrake/contrib/ffmpeg/module.defs works for you? If yes, I could make a patch for this to at least make it possible to build HandBrake. And, if it builds with the above, please also test, that the resulting HandBrake build works as expected. This would be very helpful.

@lokok8 lokok8 linked a pull request Dec 3, 2022 that will close this issue
3 tasks
@sr55 sr55 added the Bug label Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants