InBetweenNames / gentooLTO

A Gentoo Portage configuration for building with -O3, Graphite, and LTO optimizations
GNU General Public License v2.0
569 stars 96 forks source link

webkit-gtk, unrecognized command-line option ‘-stdlib=libstdc++’ #844

Open StefanSalewski opened 2 years ago

StefanSalewski commented 2 years ago

I got this error already on a fresh install one week ago, and now again.

It was reported already long time ago, https://github.com/InBetweenNames/gentooLTO/issues/808

I have no idea why the clang option is enabled for gcc. And what makes it really ugly is, that we have to touch the original files to fix it,

/etc/portage/package.cflags # cat clang.conf

# BEGIN: Packages which require libstdc++
media-libs/exempi CXXFLAGS+=-stdlib=libstdc++ # fatal error: 'tr1/memory' file not found
#net-libs/webkit-gtk CXXFLAGS+=-stdlib=libstdc++ # error: use of undeclared identifier 'LC_ALL'
# END: Packages which require libstdc++

which then makes it difficult to update the original package.

TheMBL09898 commented 2 years ago

I have the same error, this fixes it

StefanSalewski commented 1 year ago

And again, when installing emerge -pv webkit-gtk, net-libs/webkit-gtk-2.38.2:4/37::gentoo

  The C++ compiler

    "/usr/bin/x86_64-pc-linux-gnu-g++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /var/tmp/portage/net-libs/webkit-gtk-2.38.2/work/webkitgtk-2.38.2_build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/ninja cmTC_61634 && [1/2] Building CXX object CMakeFiles/cmTC_61634.dir/testCXXCompiler.cxx.o
    FAILED: CMakeFiles/cmTC_61634.dir/testCXXCompiler.cxx.o 
    /usr/bin/x86_64-pc-linux-gnu-g++    -DNDEBUG -march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -fomit-frame-pointer -pipe -stdlib=libstdc++ -Wl,-O1 -Wl,--as-needed -fuse-ld=mold -o CMakeFiles/cmTC_61634.dir/testCXXCompiler.cxx.o -c /var/tmp/portage/net-libs/webkit-gtk-2.38.2/work/webkitgtk-2.38.2_build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    x86_64-pc-linux-gnu-g++: error: unrecognized command-line option ‘-stdlib=libstdc++’
    ninja: build stopped: subcommand failed.

Something has updated clang.conf in

ls -lt /var/db/repos/lto-overlay/sys-config/ltoize/files/package.cflags/
total 76
-rw-r--r-- 1 root root  1239 Dec 11 09:24 clang.conf
-rw-r--r-- 1 root root   321 May 31  2022 cmake-makefile.conf
-rw-r--r-- 1 root root   174 May 31  2022 devirtualize-at-ltrans.conf
-rw-r--r-- 1 root root  1826 May 31  2022 flag-o-matic.conf
-rw-r--r-- 1 root root   270 May 31  2022 graphite.conf
-rw-r--r-- 1 root root  2005 May 31  2022 ipa-pta.conf
-rw-r--r-- 1 root root 13196 May 31  2022 lto.conf
-rw-r--r-- 1 root root  4302 May 31  2022 no-common.conf
-rw-r--r-- 1 root root  2528 May 31  2022 no-common-libtool.conf
-rw-r--r-- 1 root root   510 May 31  2022 no-plt.conf
-rw-r--r-- 1 root root  1182 May 31  2022 no-semantic-interposition.conf
-rw-r--r-- 1 root root  3703 May 31  2022 optimizations.conf
-rw-r--r-- 1 root root   181 May 31  2022 portage-bashrc-mv.conf
-rw-r--r-- 1 root root   672 May 31  2022 tls-dialect.conf
-rw-r--r-- 1 root root   286 May 31  2022 use-ld.conf

back to

# BEGIN: Workarounds for LTO with Clang
dev-lang/python *FLAGS-=-flto* # https://bugs.gentoo.org/700012 : No -ffat-lto-objects on clang
dev-libs/libffi *FLAGS-=-flto* # error: changed section flags for .eh_frame https://github.com/libffi/libffi/issues/626 (abi_x86_32)
dev-util/colm *FLAGS-=-flto* # ld: libcolm.a: error adding symbols: file format not recognized
media-libs/dav1d *FLAGS-=-flto* # general protection fault https://code.videolan.org/videolan/dav1d/-/issues/362
>=app-office/libreoffice-7.1.2.2 "has clang ${IUSE//+} && use clang && NOLDADD=1" "has clang ${IUSE//+} && use clang && has custom-cflags ${IUSE//+} && use custom-cflags && FlagSubAllFlags ${GRAPHITE} ${DEVIRTLTO} ${IPAPTA} ${FLTO} -fuse-linker-plugin" # fails to configure, see issue #734
# END: Workarounds for LTO with Clang

# BEGIN: Packages which require Full LTO
media-libs/libglvnd LTO_FULL=1 # ld.lld: error: undefined symbol: entrypointFunctions
# END: Packages which require Full LTO

# BEGIN: Packages which require libstdc++
media-libs/exempi CXXFLAGS+=-stdlib=libstdc++ # fatal error: 'tr1/memory' file not found
net-libs/webkit-gtk CXXFLAGS+=-stdlib=libstdc++ # error: use of undeclared identifier 'LC_ALL'
# END: Packages which require libstdc++
MCPO-Spartan-117 commented 1 year ago

You can make a file named like zz-clang.conf in /etc/portage/package.cflags and put net-libs/webkit-gtk CXXFLAGS-=-stdlib=libstdc++ in it to revert this, but it's probably best to remove the use flag clang from sys-config/ltoize.

Just to mention the other issue and pull request, not sure of a better way to do this.

808

836

StefanSalewski commented 1 year ago

best to remove the use flag clang from sys-config/ltoize.

Good idea, thanks.