Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 649666 - app-office/libreoffice-6.0.2.1 with --enable-lto - checking if gcc has a visibility bug with class-level attributes: configure: error: Your gcc is not -fvisibility=hidden safe. This is no longer supported.
Summary: app-office/libreoffice-6.0.2.1 with --enable-lto - checking if gcc has a visi...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Office Team
URL:
Whiteboard:
Keywords:
Depends on: 652638
Blocks:
  Show dependency tree
 
Reported: 2018-03-05 17:46 UTC by Joe Harvell
Modified: 2018-05-29 12:31 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
output of emerge --info (einfo.txt,6.68 KB, text/plain)
2018-03-05 17:47 UTC, Joe Harvell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Harvell 2018-03-05 17:46:34 UTC
output from configure --help in /var/tmp/portage

  --enable-lto            Enable link-time optimization. Suitable for
                          (optimised) product builds. Building might take
                          longer but libraries and executables are optimized
                          for speed. For GCC, best to use the 'gold' linker.
                          For MSVC, this option is broken at the moment. This
                          is experimental work in progress that shouldn't be
                          used unless you are working on it.)

output from ebuild /usr/portage/app-office/libreoffice/libreoffice-6.0.2.1.ebuild configure (I added set -x in the configure script in /var/tmp/portage to illustrate code path)

checking if gcc has a visibility bug with class-level attributes (GCC bug 26905)... + x86_64-pc-linux-gnu-g++ -O3 -pipe -march=native -ggdb -flto=10 -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize -fpic -S visibility.cxx
+ case "$host_cpu" in
+ test Linux = Darwin -o Linux = iOS
+ /bin/grep -E -q '@PLT|@GOT' visibility.s
+ test '' = TRUE
+ gccvisbroken=yes
+ rm -f visibility.s visibility.cxx
+ set +x
yes
configure: error: Your gcc is not -fvisibility=hidden safe. This is no longer supported.


Referring to the lines below that produced that output, it is clear that the shell variable ENABLE_LTO is either undefined or empty, which is causing the erroneous conclusion that gcc is not -fvisibility=hidden safe.

I don't know if there is any support in Gentoo for using LTO.  So I am not sure if this is failing because of intentional lack of support in Gentoo for LTO  or an oversight or programming error in the ebuild.  If the former, is there any way to file this as an enhancement request?


    set -x
    if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
        gccvisbroken=yes
    else
        case "$host_cpu" in
        i?86|x86_64)
            if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
                gccvisbroken=no
            else
                if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
                    gccvisbroken=no
                else
                    gccvisbroken=yes
                fi
            fi
            ;;
        *)
            gccvisbroken=no
            ;;
        esac
    fi
    rm -f visibility.s visibility.cxx
    set +x
Comment 1 Joe Harvell 2018-03-05 17:47:47 UTC
Created attachment 522454 [details]
output of emerge --info
Comment 2 Joe Harvell 2018-03-05 18:15:32 UTC
I manually created an overlay ebuild where I added an lto USE flag such that --enable-lto is specified in the configure script if and only if the lto USE flag is enabled.

I emerging it now with the lto USE flag enabled, and it has successfully passed the configure phase and is compiling.

Probably a better solution would be to have an eclass that allows a USE flag (like lto) that is by design disabled by the eclass if no LTO options are in effect for the build.  This would have to take into account not just make.conf, but also overrides in /etc/portage/package.env.  This would allow setting this USE flag globally, but if you are building a particular package without LTO the package does not break because you configugure it with LTO support.  This package could actually break if you configure with --enable-lto but don't build with -flto, and your compiler has the hidden visiblity bug.  The configure script won't detect the compiler bug because you say you are using LTO but are not.
Comment 3 Alexander Miller 2018-03-14 03:13:03 UTC
I got the same error for app-office/libreoffice-5.4.5.1. As a workaround I created the file /etc/portage/env/app-office/libreoffice with a single line:
EXTRA_ECONF='--enable-lto'

For a proper solution I don't think a USE flags makes much sense. The ebuild could scan CFLAGS/CXXFLAGS and pass --enable-lto to configure when required, but that's complicated to get right with all of -flto, -flto=*, -fno-lto and possibly several of those present. The cleanest solution would be to patch configure to remove the visibility check entirely; building gentoo with ancient gcc versions that would fail isn't supported anyway I guess.
Comment 4 Alexander Miller 2018-03-15 21:30:20 UTC
Adding the following line to src_configure should suffice:
    is-flagq "-flto*" && myeconfargs+=( --enable-lto )

While not perfect, several other ebuilds use similar solutions, so it's probably good enough.
Comment 5 Larry the Git Cow gentoo-dev 2018-05-29 12:31:41 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a00781792fbd23987196bc103187edd9b122cac9

commit a00781792fbd23987196bc103187edd9b122cac9
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2018-05-23 21:24:52 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2018-05-29 12:31:06 +0000

    app-office/libreoffice*: Drop 5.4.5.1
    
    Closes: https://bugs.gentoo.org/619918
    Closes: https://bugs.gentoo.org/638012
    Closes: https://bugs.gentoo.org/638520
    Closes: https://bugs.gentoo.org/649666
    Closes: https://bugs.gentoo.org/652354
    Package-Manager: Portage-2.3.38, Repoman-2.3.9

 app-office/libreoffice-bin-debug/Manifest          |  12 -
 .../libreoffice-bin-debug-5.4.5.1.ebuild           |  87 ----
 app-office/libreoffice-bin/Manifest                |  12 -
 .../libreoffice-bin/libreoffice-bin-5.4.5.1.ebuild | 255 ---------
 app-office/libreoffice-l10n/Manifest               | 168 ------
 .../libreoffice-l10n-5.4.5.1.ebuild                |  88 ----
 app-office/libreoffice/Manifest                    |   3 -
 .../files/libreoffice-5.4.5.1-pyuno-crash.patch    |  87 ----
 app-office/libreoffice/libreoffice-5.4.5.1.ebuild  | 578 ---------------------
 app-office/libreoffice/metadata.xml                |   3 -
 10 files changed, 1293 deletions(-)