Closed elsandosgrande closed 3 years ago
This genuinely means nothing to me and appears pretty esoteric. Maybe someone more interested in compiler options and the eccentricities of GCC can solve this one.
@itsmattkc Yeah, when trying to see where the thread of files leads, I ended up hitting a brick wall at a Qt header. Since this seems like a Qt bug of some sorts, I'll try seeing which commit broke it and go from there. If the new commits somehow fix this, then I'll just close the issue and add which commit caused this later.
So, this seems to somehow be caused by 83735790.
Tested with the stated flags in GCC10 and couldn't reproduce. I'd assume this issue is related to GCC11 and its yet unfinished state.
So, after some testing, I have concluded that even just putting -O2 -g
, nothing more, leads to a build failure. Also, it seems like GCC 11 is slated for release very soon, so this seems to be a valid bug on GCC's end (-O2 -g
is what CMake sets for the RelWithDebInfo
type, so this is quite relevant to Olive, though maybe not necessarily right now, seeing as GCC 11 is the latest version of GCC).
I've been able to reproduce this with GCC11 (11.0.1 20210426 (prerelease)). After trial and error i've been able to reproduce the error also with -O1 -foptimize-strlen
.
Note: This does not happen with Clang 12.
Also note: Setting -fno-optimize-strlen
allows all of the build subtypes to build.
Edit
Undoing changes made in https://github.com/olive-editor/olive/commit/7ee6d52651ba5b633574b8378e69e0dec096c310 and https://github.com/olive-editor/olive/commit/8373579009c2033eccf062d9ec36a26ebbce3415 fixes the warning. I've yet to look further into what with these changes could be the exact culprit.
Those two commits should introduce any problems I don't think, they just cache the result of calling av_get_channel_layout_nb_channels
. Do youget any issues compiling ffmpeg with GCC11? It looks simialr to this (https://github.com/ClickHouse/ClickHouse/issues/10508) so Iwonder if it's a compiler bug in GCC11 as @parona-source says.
I could be totally wrong though, I'm not a compiler person
Ffmpeg compiles fine with GCC11 (minus TEXTREL and -Warray-bounds QA notice from package manager).
The particular warning here is weird in that it points to QTypedArrayData struct, while stringop-overflow should "warn for calls to string manipulation functions such as memcpy and strcpy that are determined to overflow the destination buffer".
I should mention that from my tweaking i've gotten to the point where the error occurs when just int channel_count_;
is declared in audioparams.h.
Otherwise it compiles and completes tests fine if you just ignore the warning -Wno-stringop-overflow
/-Wno-error
and from quick glance haven't noticed any runtime issues either that could be from this.
Yeah I really don't see anything in that PR that would cause a problem. I'm pretty sure this is a bug with GCC11, particularly because no other compiler exhibits this issue. As such, I'm going to close this on our end and I suggest bring it up with GCC's developers.
@itsmattkc Thankfully, CMake setting -Wall -Wextra
after -Wno-stringop-overflow
is set does not override it, so I can successfully build everything without a hitch! I'll try making a GCC bug report next month, likely with some help from Parona if he has the time and energy to help me out, since the mathematics entrance exam is still looming over me 😅.
Note As GCC 11 has already officially been released, Canonical has, of course, updated the package so that it's no longer a pre-release version. As this still occurs on my laptop, it's not just that it was a pre-release version at the time of me opening this ticket.
Considering this issue was continuing to cause issues (apparently even breaking the olive-git
AUR on Arch), I finally bit the bullet and implemented a workaround on our end in 437f74c6b465f6a39a5448f8efe807841682a6de. While this is definitely a bug (either GCC's or Qt's), at least it shouldn't affect us anymore.
Commit Hash 542e5f4f
Platform Ubuntu Hirsute Hippo (21.04), GCC 11
g++ (Ubuntu 11-20210417-1ubuntu1) 11.0.1 20210417 (experimental) [master revision c1c86ab96c2:b6fb0ccbb48:8ae884c09fbba91e9cec391290ee4a2859e7ff41]
Summary When building Olive with
-march=native -pipe -pthread -fuse-ld=bfd -O3 -ggdb3 -fdebug-types-section -fasynchronous-unwind-tables -fstack-clash-protection -fstack-protector-strong -fno-plt -Wall -Wextra -fno-omit-frame-pointer
, the compilation fails atapp/CMakeFiles/libolive-editor.dir/codec/ffmpeg/ffmpegdecoder.cpp.o
. When building with-march=native -pipe -pthread -fuse-ld=bfd -Og -ggdb3 -fdebug-types-section -fasynchronous-unwind-tables -fstack-clash-protection -fstack-protector-strong -fno-plt -Wall -Wextra -fno-omit-frame-pointer
, the error does not occur.This has started after pulling these new commits:
Additional Information / Output