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

[BUILD] GCC 11 build error with -O2 -g #1590

Closed
elsandosgrande opened this issue Apr 26, 2021 · 13 comments
Closed

[BUILD] GCC 11 build error with -O2 -g #1590

elsandosgrande opened this issue Apr 26, 2021 · 13 comments
Labels
Building/Packaging Compile or install issues (excluding CI) Help Wanted Assistance from community would be helpful Low Priority Not Our Fault™ A bug caused by a dependency. We may implement a workaround or just wait until they fix it.

Comments

@elsandosgrande
Copy link
Collaborator

elsandosgrande commented Apr 26, 2021

Commit Hash
542e5f4

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 at app/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:
image

Additional Information / Output

[23/326] /usr/lib/ccache/g++-11 -DAPPVERSION=\"0.2.0\" -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DUSE_OTIO -Iapp -I/home/sandy/Projects/Olive/source/app -Iapp/libolive-editor_autogen/include -I/home/sandy/Projects/OpenColorIO/builds/master/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include/opentimelineio/deps -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtMultimedia -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtConcurrent -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 -Werror -Wuninitialized -pedantic-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -fPIC -std=c++11 -MD -MT app/CMakeFiles/libolive-editor.dir/codec/ffmpeg/ffmpegdecoder.cpp.o -MF app/CMakeFiles/libolive-editor.dir/codec/ffmpeg/ffmpegdecoder.cpp.o.d -o app/CMakeFiles/libolive-editor.dir/codec/ffmpeg/ffmpegdecoder.cpp.o -c /home/sandy/Projects/Olive/source/app/codec/ffmpeg/ffmpegdecoder.cpp
FAILED: app/CMakeFiles/libolive-editor.dir/codec/ffmpeg/ffmpegdecoder.cpp.o 
/usr/lib/ccache/g++-11 -DAPPVERSION=\"0.2.0\" -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DUSE_OTIO -Iapp -I/home/sandy/Projects/Olive/source/app -Iapp/libolive-editor_autogen/include -I/home/sandy/Projects/OpenColorIO/builds/master/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include/opentimelineio/deps -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtMultimedia -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtConcurrent -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 -Werror -Wuninitialized -pedantic-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -fPIC -std=c++11 -MD -MT app/CMakeFiles/libolive-editor.dir/codec/ffmpeg/ffmpegdecoder.cpp.o -MF app/CMakeFiles/libolive-editor.dir/codec/ffmpeg/ffmpegdecoder.cpp.o.d -o app/CMakeFiles/libolive-editor.dir/codec/ffmpeg/ffmpegdecoder.cpp.o -c /home/sandy/Projects/Olive/source/app/codec/ffmpeg/ffmpegdecoder.cpp
In member function ‘void QVector<T>::append(const T&) [with T = olive::AudioParams]’:
cc1plus: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
In file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qbytearray.h:46,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:50,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qobject.h:47,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qtimer.h:48,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QTimer:1,
                 from /home/sandy/Projects/Olive/source/app/codec/ffmpeg/ffmpegdecoder.h:31,
                 from /home/sandy/Projects/Olive/source/app/codec/ffmpeg/ffmpegdecoder.cpp:21:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:129:8: note: at offset 24 into destination object ‘QTypedArrayData<olive::AudioParams>::<anonymous>’ of size 24
  129 | struct QTypedArrayData
      |        ^~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
[24/326] /usr/lib/ccache/g++-11 -DAPPVERSION=\"0.2.0\" -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DUSE_OTIO -Iapp -I/home/sandy/Projects/Olive/source/app -Iapp/libolive-editor_autogen/include -I/home/sandy/Projects/OpenColorIO/builds/master/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include/opentimelineio/deps -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtMultimedia -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtConcurrent -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 -Werror -Wuninitialized -pedantic-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -fPIC -std=c++11 -MD -MT app/CMakeFiles/libolive-editor.dir/core.cpp.o -MF app/CMakeFiles/libolive-editor.dir/core.cpp.o.d -o app/CMakeFiles/libolive-editor.dir/core.cpp.o -c /home/sandy/Projects/Olive/source/app/core.cpp
[25/326] /usr/lib/ccache/g++-11 -DAPPVERSION=\"0.2.0\" -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DUSE_OTIO -Iapp -I/home/sandy/Projects/Olive/source/app -Iapp/libolive-editor_autogen/include -I/home/sandy/Projects/OpenColorIO/builds/master/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include/opentimelineio/deps -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtMultimedia -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtConcurrent -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 -Werror -Wuninitialized -pedantic-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -fPIC -std=c++11 -MD -MT app/CMakeFiles/libolive-editor.dir/audio/audiomanager.cpp.o -MF app/CMakeFiles/libolive-editor.dir/audio/audiomanager.cpp.o.d -o app/CMakeFiles/libolive-editor.dir/audio/audiomanager.cpp.o -c /home/sandy/Projects/Olive/source/app/audio/audiomanager.cpp
[26/326] /usr/lib/ccache/g++-11 -DAPPVERSION=\"0.2.0\" -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DUSE_OTIO -Iapp -I/home/sandy/Projects/Olive/source/app -Iapp/libolive-editor_autogen/include -I/home/sandy/Projects/OpenColorIO/builds/master/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include -I/home/sandy/Projects/OpenTimelineIO/builds/g++-11/O3/install_dir/include/opentimelineio/deps -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtMultimedia -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtConcurrent -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 -Werror -Wuninitialized -pedantic-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -fPIC -std=c++11 -MD -MT app/CMakeFiles/libolive-editor.dir/libolive-editor_autogen/mocs_compilation.cpp.o -MF app/CMakeFiles/libolive-editor.dir/libolive-editor_autogen/mocs_compilation.cpp.o.d -o app/CMakeFiles/libolive-editor.dir/libolive-editor_autogen/mocs_compilation.cpp.o -c app/libolive-editor_autogen/mocs_compilation.cpp
ninja: build stopped: subcommand failed.
@elsandosgrande elsandosgrande added Building/Packaging Compile or install issues (excluding CI) Triage This issue is yet to be triaged labels Apr 26, 2021
@itsmattkc itsmattkc added Help Wanted Assistance from community would be helpful Low Priority and removed Triage This issue is yet to be triaged labels Apr 26, 2021
@itsmattkc
Copy link
Contributor

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.

@elsandosgrande
Copy link
Collaborator Author

@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.

@elsandosgrande
Copy link
Collaborator Author

So, this seems to somehow be caused by 8373579.

@parona-source
Copy link
Contributor

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.

@elsandosgrande
Copy link
Collaborator Author

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).

@elsandosgrande elsandosgrande changed the title [BUILD] Build error with -O3 [BUILD] Build error with -O2 -g Apr 26, 2021
@parona-source
Copy link
Contributor

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.

@elsandosgrande
Copy link
Collaborator Author

elsandosgrande commented Apr 27, 2021

Note: This does not happen with Clang 12.
Also note: Setting -fno-optimize-strlen allows all of the build subtypes to build.


Edit
image

@elsandosgrande elsandosgrande changed the title [BUILD] Build error with -O2 -g [BUILD] GCC 11 build error with -O2 -g Apr 27, 2021
@parona-source
Copy link
Contributor

Undoing changes made in 7ee6d52 and 8373579 fixes the warning. I've yet to look further into what with these changes could be the exact culprit.

@ThomasWilshaw
Copy link
Collaborator

ThomasWilshaw commented May 3, 2021

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 (ClickHouse/ClickHouse#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

@parona-source
Copy link
Contributor

parona-source commented May 3, 2021

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.

@itsmattkc
Copy link
Contributor

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.

@elsandosgrande
Copy link
Collaborator Author

elsandosgrande commented Jun 6, 2021

@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.

@elsandosgrande elsandosgrande pinned this issue Nov 3, 2021
@Simran-B Simran-B added the Not Our Fault™ A bug caused by a dependency. We may implement a workaround or just wait until they fix it. label Dec 3, 2021
@itsmattkc
Copy link
Contributor

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 437f74c. While this is definitely a bug (either GCC's or Qt's), at least it shouldn't affect us anymore.

@itsmattkc itsmattkc unpinned this issue Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Building/Packaging Compile or install issues (excluding CI) Help Wanted Assistance from community would be helpful Low Priority Not Our Fault™ A bug caused by a dependency. We may implement a workaround or just wait until they fix it.
Projects
None yet
Development

No branches or pull requests

5 participants