Opened 3 years ago
Closed 3 years ago
#13653 closed Patch - Feature (Duplicate)
Initial support for enabling the building of MythTV with LTO
Reported by: | Gary Buhrmaster | Owned by: | Mark Kendall |
---|---|---|---|
Priority: | minor | Milestone: | 32.0 |
Component: | MythTV - General | Version: | Master Head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
Initial support for enabling the building of MythTV with LTO.
LTO may be (or may not be, your experience will vary) beneficial to systems which are on the low end of performance.
While FFmpeg itself has support for LTO builds in the latest version(s) using the --enable-lto configure option, the MythTV build process did not support the necessary options and code requirements.
These patches are intended to get the compile to properly work if one wishes to test a LTO build, although I have been running a LTO build on my "production" system. It seems to operationally work for my use cases.
The patches are provided in smaller sections so that a developer can more easily review them.
The first set of four patches are to address the requirement for an LTO build to have consistent definitions of all names and structures for a compilation unit. The next set of two patches (also required for the consistent definitions) remove the local videodev2.h include, as the original requirement was for an older kernel which is no longer supported by the project (2.6.something). The last patch updates configure to properly pass along the necessary options to QMAKE and FFmpeg that can be set during configure.
Note: The resulting set has been compile tested on Fedora, EL, Debian and FreeBSD 11/12 using a standard configure to verify nothing breaks with these patches on those platforms.
For individual LTO testing purposes, and depending on whether your disto has changed the default ar/ranlib/nm commands to be the gcc enabled variants, you make need explicitly specify those in your configure, as in:
make distclean ./configure --cc=gcc --cxx=g++ --enable-lto --ar=gcc-ar --ranlib=gcc-ranlib --nm="gcc-nm -g" make
or for the equivalent for clang of the form (alternative is to use gold rather than lld, but the gold linker seems to be mostly dead upstream, so we use the llvm linker):
make distclean ./configure --cc=clang --cxx=clang --enable-lto --ar=llvm-ar --ranlib=llvm-ranlib --nm="llvm-nm -g" --extra-ldflags="-fuse-ld=lld" make
Note: lld creates 8 byte build-ids by default, and some post processing/debugging utilities were/are known to have challenges with those build-ids, so you may need to include -Wl,--build-id=sha1 in the extra-ldflags.
Note: If you are using --extra-cflags, you may need to add --extra-ldflags (with equivalent flags) to avoid certain flag merging artifacts during the link stage compilation as the linker will use the flags in the first object files, which might not be ideal for your use case.
Patches will be attached.
Attachments (7)
Change History (11)
Changed 3 years ago by
Attachment: | 0001-use-FFmpeg-definitions-of-av_malloc-and-av_free.patch added |
---|
Changed 3 years ago by
Attachment: | 0002-Rename-the-RecordingType-stream-selection-UI-element.patch added |
---|
Rename the RecordingType? stream selection UI element in recordingprofile.cpp - Renamed to avoid (global) name conflict with RecordingType? enum in libs/libmyth/recordingtypes.h
Changed 3 years ago by
Attachment: | 0003-Rename-the-ScanFrequency-starting-scan-frequency-UI-.patch added |
---|
Rename the ScanFrequency? starting scan frequency UI element in videosource.cpp - Renamed to avoid (global) name conflict with ScanFrequency? class in libs/libmythtv/channelscan/channelscanmiscsettings.h
Changed 3 years ago by
Attachment: | 0004-remove-unneeded-definitions.patch added |
---|
remove unneeded definitions - commit 50310355 removed the member variable that required the QMap, and the definition that the QMap required.
Changed 3 years ago by
Attachment: | 0005-use-system-videodev2.h-include-rather-than-a-local-s.patch added |
---|
use system videodev2.h include rather than a local (sometimes different) copy - The project no longer supports distributions with the older kernels that required having a local copy of videodev2.h.
Changed 3 years ago by
Attachment: | 0006-remove-local-videodev2.h.patch added |
---|
remove local videodev2.h
Changed 3 years ago by
Attachment: | 0007-update-config-to-pass-enable-lto-to-ffmpeg-and-expor.patch added |
---|
update config to pass enable-lto to ffmpeg and export appropriate QMAKE vars
comment:1 Changed 3 years ago by
Milestone: | needs_triage → 32.0 |
---|---|
Owner: | set to Mark Kendall |
Status: | new → accepted |
comment:4 Changed 3 years ago by
Resolution: | → Duplicate |
---|---|
Status: | accepted → closed |
Migrated to github issues for remaining patches: https://github.com/MythTV/mythtv/issues/224
use FFmpeg definitions of av_malloc and av_free