[mythtv-commits] Ticket #13653: Initial support for enabling the building of MythTV with LTO

MythTV noreply at mythtv.org
Sat Jul 25 16:09:33 UTC 2020


#13653: Initial support for enabling the building of MythTV with LTO
----------------------------------+--------------------------
     Reporter:  Gary Buhrmaster   |      Owner:  (none)
         Type:  Patch - Feature   |     Status:  new
     Priority:  minor             |  Milestone:  needs_triage
    Component:  MythTV - General  |    Version:  Master Head
     Severity:  medium            |   Keywords:
Ticket locked:  0                 |
----------------------------------+--------------------------
 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.

-- 
Ticket URL: <https://code.mythtv.org/trac/ticket/13653>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list