Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 838115

Summary: =app-office/libreoffice-7.3.4.2[custom-cflags,lto]: cc1plus: error: unrecognized argument to ‘-flto=’ option: ‘thin’
Product: Gentoo Linux Reporter: David Kredba <kredba>
Component: Current packagesAssignee: Gentoo Office Team <office>
Status: RESOLVED FIXED    
Severity: normal CC: answer2019, faber, sam
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: The build.log file - gzipped

Description David Kredba 2022-04-12 19:51:31 UTC
I can't build LibreOffice of this version with [lto], skia fails as never before.

S=/var/tmp/portage/app-office/libreoffice-7.3.2.2/work/libreoffice-7.3.2.2 && I=$S/instdir && W=$S/workdir &&  mkdir -p $W/GenCxxObject/UnpackedTarball/skia/src/codec/ $W/Dep/GenCxxObject/UnpackedTarball/skia/src/codec/ && cd /var/tmp/portage/app-office/libreoffice-7.3.2.2/work/libreoffice-7.3.2.2 &&      x86_64-pc-linux-gnu-g++ -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DCPPU_ENV=gcc3 -DLINUX -DNDEBUG -DOSL_DEBUG_LEVEL=0 -DUNIX -DUNX -DX86_64 -D_PTHREADS -D_REENTRANT  -DSKIA_IMPLEMENTATION=1 -DSKIA_DLL -DSK_USER_CONFIG_HEADER="<$S/config_host/config_skia.h>"  -DSYSTEM_ZLIB -DZLIB_CONST  -flto=thin -fvisibility=hidden    -Wall -Wno-missing-braces -Wnon-virtual-dtor -Wendif-labels -Wextra -Wundef -Wunreachable-code -Wshadow -Wunused-macros  -finput-charset=UTF-8 -fmessage-length=0 -fno-common -pipe -fstack-protector-strong -fdiagnostics-color=always  -Wdeprecated-copy-dtor -Wduplicated-cond -Wlogical-op -Wshift-overflow=2 -Wunused-const-variable=1 -Wno-cast-function-type -fvisibility-inlines-hidden -fPIC -Wshadow -Woverloaded-virtual -std=c++17 -pthread  -O2 -pipe -march=znver2 -flto=16  -DEXCEPTIONS_ON -fexceptions -fno-enforce-eh-specs -O2   -w -DLIBO_INTERNAL_ONLY  -c $W/UnpackedTarball/skia/src/codec/SkCodecImageGenerator.cpp -o $W/GenCxxObject/UnpackedTarball/skia/src/codec/SkCodecImageGenerator.o  -I$S/include  -I/opt/openjdk-bin-11/include -I/opt/openjdk-bin-11/include/linux -I$S/config_host     -isystem /usr/include/freetype2 -isystem /usr/include/harfbuzz -isystem /usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include      -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include           -isystem /usr/include/libpng16   -I$W/UnpackedTarball/skia -I$W/UnpackedTarball/skia/include/third_party/skcms/ -I$W/UnpackedTarball/skia/third_party/vulkanmemoryallocator/ -I$W/UnpackedTarball/skia/include/third_party/vulkan/ -I$S/external/skia/inc/    
S=/var/tmp/portage/app-office/libreoffice-7.3.2.2/work/libreoffice-7.3.2.2 && I=$S/instdir && W=$S/workdir &&  mkdir -p $W/GenCxxObject/UnpackedTarball/skia/src/codec/ $W/Dep/GenCxxObject/UnpackedTarball/skia/src/codec/ && cd /var/tmp/portage/app-office/libreoffice-7.3.2.2/work/libreoffice-7.3.2.2 &&      x86_64-pc-linux-gnu-g++ -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED -DCPPU_ENV=gcc3 -DLINUX -DNDEBUG -DOSL_DEBUG_LEVEL=0 -DUNIX -DUNX -DX86_64 -D_PTHREADS -D_REENTRANT  -DSKIA_IMPLEMENTATION=1 -DSKIA_DLL -DSK_USER_CONFIG_HEADER="<$S/config_host/config_skia.h>"  -DSYSTEM_ZLIB -DZLIB_CONST  -flto=thin -fvisibility=hidden    -Wall -Wno-missing-braces -Wnon-virtual-dtor -Wendif-labels -Wextra -Wundef -Wunreachable-code -Wshadow -Wunused-macros  -finput-charset=UTF-8 -fmessage-length=0 -fno-common -pipe -fstack-protector-strong -fdiagnostics-color=always  -Wdeprecated-copy-dtor -Wduplicated-cond -Wlogical-op -Wshift-overflow=2 -Wunused-const-variable=1 -Wno-cast-function-type -fvisibility-inlines-hidden -fPIC -Wshadow -Woverloaded-virtual -std=c++17 -pthread  -O2 -pipe -march=znver2 -flto=16  -DEXCEPTIONS_ON -fexceptions -fno-enforce-eh-specs -O2   -w -DLIBO_INTERNAL_ONLY  -c $W/UnpackedTarball/skia/src/codec/SkColorTable.cpp -o $W/GenCxxObject/UnpackedTarball/skia/src/codec/SkColorTable.o  -I$S/include  -I/opt/openjdk-bin-11/include -I/opt/openjdk-bin-11/include/linux -I$S/config_host     -isystem /usr/include/freetype2 -isystem /usr/include/harfbuzz -isystem /usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include      -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include           -isystem /usr/include/libpng16   -I$W/UnpackedTarball/skia -I$W/UnpackedTarball/skia/include/third_party/skcms/ -I$W/UnpackedTarball/skia/third_party/vulkanmemoryallocator/ -I$W/UnpackedTarball/skia/include/third_party/vulkan/ -I$S/external/skia/inc/    
TEMPFILE=/var/tmp/portage/app-office/libreoffice-7.3.2.2/temp/gbuild.E4Zdk0 && mv ${TEMPFILE} /var/tmp/portage/app-office/libreoffice-7.3.2.2/work/libreoffice-7.3.2.2/workdir/LinkTarget/Library/libuno_salhelpergcc3.so.3.objectlist
cc1plus: error: unrecognized argument to ‘-flto=’ option: ‘thin’

Reproducible: Always

Steps to Reproduce:
1. Use gcc to compile =app-office/libreoffice-7.3.2.2[lto,custom-cflags]
2.
3.
Actual Results:  
Fails due to ‘-flto=’ option: ‘thin’.

Expected Results:  
Compiles fine using GCC with LTO.

emerge --info libreoffice
Portage 3.0.30 (python 3.9.12-final-0, default/linux/amd64/17.1/no-multilib, gcc-11.2.1, glibc-2.35-r2, 5.17.1-gentoo-r1-1d x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.17.1-gentoo-r1-1d-x86_64-AMD_Ryzen_7_3800X_8-Core_Processor-with-glibc2.35
KiB Mem:    65820536 total,  29433240 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 12 Apr 2022 08:30:01 +0000
Head commit of repository gentoo: d122c59aaf2cc232f0cc828f36e48789629462f6
sh bash 5.1_p16
ld GNU ld (Gentoo 2.38 p3) 2.38
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-java/java-config:      2.3.1::gentoo
dev-lang/perl:             5.34.1::gentoo
dev-lang/python:           2.7.18_p15::gentoo, 3.9.12::gentoo
dev-lang/rust-bin:         1.60.0::gentoo
dev-util/cmake:            3.23.0::gentoo
dev-util/meson:            0.61.4-r2::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/openrc:           0.44.10::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.13-r1::gentoo, 2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r1::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/clang:           13.0.1::gentoo, 14.0.0-r1::gentoo
sys-devel/gcc:             11.2.1_p20220115::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/llvm:            13.0.1::gentoo, 14.0.0::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.17::gentoo (virtual/os-headers)
sys-libs/glibc:            2.35-r2::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.cz.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-max-age: 24

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=znver2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=znver2"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe -march=znver2"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=znver2"
GENTOO_MIRRORS="http://tux.rainside.sk/gentoo/ ftp://gentoo.mirror.web4u.cz/ https://mirror.leaseweb.com/gentoo/"
LANG="cs_CZ.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="cs en"
MAKEOPTS="-j16"
PKGDIR="/var/cache/binpkgs"
PORTAGE_COMPRESS=""
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl alsa amd64 blas bluetooth branding bzip2 cairo caps cdda cddb cdparanoia cdr cli colord crypt cups dbus declarative djvu dri dts dv dvb dvd dvdr elogind encode exif ffmpeg fftw flac fontconfig fortran gdbm geoip gif gmp gnuplot graphviz gsl gsm hdf5 heif iconv idn ieee1394 imagemagick imlib ipv6 ithreads jbig jpeg jpeg2k kde ladspa lame lapack latex lcms libass libglvnd libsamplerate libtirpc lzma lzo mad matroska mms mng modplug mp3 mp4 mpeg mtp musepack musicbrainz ncurses nls nptl ogg opencl openexr opengl openmp pam pcre pdf plotutils png postscript pulseaudio qt5 quicktime rdp readline seccomp semantic-desktop slang smp sndfile sox speex spell split-usr ssl svg szip taglib theora threads tiff truetype udev unicode usb v4l vaapi vdpau vorbis wavpack webp x264 xattr xcb xft xinerama xml xosd xpm xscreensaver xv xvid xvmc zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words stage" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev libinput" KERNEL="linux" L10N="cs en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="scripting-beanshell scripting-javascript nlpsolver" LLVM_TARGETS="AMDGPU BPF X86" LUA_SINGLE_TARGET="lua5-3" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby30" SANE_BACKENDS="lexmark net" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

app-office/libreoffice-7.2.6.2::gentoo was built with the following:
USE="base bluetooth branding coinmp cups custom-cflags dbus firebird gstreamer java kde mariadb pdfimport vulkan -accessibility -clang -debug -eds -googledrive -gtk -ldap -odk -postgres -test" LIBREOFFICE_EXTENSIONS="nlpsolver scripting-beanshell scripting-javascript -wiki-publisher" PYTHON_SINGLE_TARGET="python3_9 -python3_10 -python3_8"
CFLAGS="-O2 -pipe -march=znver2 -flto=16"
CXXFLAGS="-O2 -pipe -march=znver2 -flto=16"
FEATURES="ebuild-locks binpkg-docompress parallel-fetch strict config-protect-if-modified distlocks unmerge-orphans buildpkg-live binpkg-dostrip binpkg-multi-instance unmerge-logs assume-digests binpkg-logs merge-sync unknown-features-warn qa-unresolved-soname-deps userfetch fixlafiles sfperms usersync usersandbox network-sandbox ipc-sandbox pid-sandbox protect-owned news multilib-strict sandbox preserve-libs userpriv xattr"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-linker-plugin"

app-office/libreoffice-7.2.6.2::gentoo was built with the following:
USE="base bluetooth branding coinmp cups custom-cflags dbus firebird gstreamer java kde mariadb pdfimport vulkan -accessibility -clang -debug -eds -googledrive -gtk -ldap -odk -postgres -test" LIBREOFFICE_EXTENSIONS="nlpsolver scripting-beanshell scripting-javascript -wiki-publisher" PYTHON_SINGLE_TARGET="python3_9 -python3_10 -python3_8"
CFLAGS="-O2 -pipe -march=znver2 -flto=16"
CXXFLAGS="-O2 -pipe -march=znver2 -flto=16"
FEATURES="ebuild-locks binpkg-docompress parallel-fetch strict config-protect-if-modified distlocks unmerge-orphans buildpkg-live binpkg-dostrip binpkg-multi-instance unmerge-logs assume-digests binpkg-logs merge-sync unknown-features-warn qa-unresolved-soname-deps userfetch fixlafiles sfperms usersync usersandbox network-sandbox ipc-sandbox pid-sandbox protect-owned news multilib-strict sandbox preserve-libs userpriv xattr"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-linker-plugin"
Comment 1 David Kredba 2022-04-12 19:53:42 UTC
Created attachment 770456 [details]
The build.log file - gzipped
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-04-13 02:29:12 UTC
Yeah, thin is for Clang only. It's an upstream bug but tbh the huge RAM usage from gcc + full blown LTO might not be sustainable anyway.
Comment 3 Joonas Niilola gentoo-dev 2022-04-13 05:43:19 UTC
Would
  append-ldflags -Wl,--no-keep-memory
help with gcc+bfd? (or gcc+gold)

the RAM usage will still be 2x higher than with thinlto, but in theory it should bring it a bit down.
Comment 4 Florian Faber 2022-05-29 10:27:02 UTC
After waiting six weeks for this bug to get at least CONFIRMED, i looked into it myself since it buggered me on two different machines. I was building libreoffice with disabled lto via package.env and it still fails with this issue.

-custom-cflags fixes the issue for the moment.
Comment 5 Andreas Sturmlechner gentoo-dev 2022-05-29 10:56:15 UTC
(In reply to Florian Faber from comment #4)
> After waiting six weeks for this bug to get at least CONFIRMED
FYI:

> * USE flags for app-office/libreoffice:
> ...
> custom-cflags: Build with user-specified CFLAGS (**unsupported**)

- Your own investigation in this case is pretty much required
- Don't read anything into confirmed/unconfirmed bug status in general
Comment 6 Florian Faber 2022-05-30 18:52:36 UTC
Sure, that's why I didn't complain :) 

But why-o-why does it build with LTO when I explicitely disable LTO (and have custom-cflags set)?

# cat /etc/portage/env/no-lto.conf 
CFLAGS="${CFLAGS} -fno-lto -fno-use-linker-plugin"
CXXFLAGS="${CXXFLAGS} -fno-lto -fno-use-linker-plugin"
LDFLAGS="${LDFLAGS} -fno-lto -fno-use-linker-plugin"

# grep libreoffice /etc/portage/package.env/no-lto
app-office/libreoffice no-lto.conf

Anyway, -custom-cflags should help the original poster and anybody else who is looking for this issue.
Comment 7 David Kredba 2022-06-11 06:58:18 UTC
The version 7.3.4.2 fails the same way, Summary updated.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-11 07:02:43 UTC
(In reply to Florian Faber from comment #6)
> Sure, that's why I didn't complain :) 
> 
> But why-o-why does it build with LTO when I explicitely disable LTO (and
> have custom-cflags set)?
> 
> # cat /etc/portage/env/no-lto.conf 
> CFLAGS="${CFLAGS} -fno-lto -fno-use-linker-plugin"
> CXXFLAGS="${CXXFLAGS} -fno-lto -fno-use-linker-plugin"
> LDFLAGS="${LDFLAGS} -fno-lto -fno-use-linker-plugin"
> 
> # grep libreoffice /etc/portage/package.env/no-lto
> app-office/libreoffice no-lto.conf
> 
> Anyway, -custom-cflags should help the original poster and anybody else who
> is looking for this issue.

It's because of:
>is-flagq "-flto*" && myeconfargs+=( --enable-lto )

-fno-lto matches that.
Comment 9 Larry the Git Cow gentoo-dev 2022-06-11 07:14:26 UTC
The bug has been closed via the following commit(s):

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

commit 927204470935f67016aeea6f3c285794def9f0a9
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-06-11 07:13:38 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-11 07:14:16 +0000

    app-office/libreoffice: fix gcc LTO
    
    Closes: https://bugs.gentoo.org/838115
    Signed-off-by: Sam James <sam@gentoo.org>

 app-office/libreoffice/libreoffice-7.3.4.2.ebuild  | 4 ++++
 app-office/libreoffice/libreoffice-7.3.9999.ebuild | 4 ++++
 app-office/libreoffice/libreoffice-9999.ebuild     | 4 ++++
 3 files changed, 12 insertions(+)
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-11 07:26:12 UTC
(In reply to Florian Faber from comment #6)
> Sure, that's why I didn't complain :) 
> 
> But why-o-why does it build with LTO when I explicitely disable LTO (and
> have custom-cflags set)?
> 
> # cat /etc/portage/env/no-lto.conf 
> CFLAGS="${CFLAGS} -fno-lto -fno-use-linker-plugin"
> CXXFLAGS="${CXXFLAGS} -fno-lto -fno-use-linker-plugin"
> LDFLAGS="${LDFLAGS} -fno-lto -fno-use-linker-plugin"
> 
> # grep libreoffice /etc/portage/package.env/no-lto
> app-office/libreoffice no-lto.conf
> 
> Anyway, -custom-cflags should help the original poster and anybody else who
> is looking for this issue.

Could you file a bug for this issue? We'll probably need to just add USE=lto, I guess.