InBetweenNames / gentooLTO

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

webkit-gtk x86_64-pc-linux-gnu-g++: error: unrecognized command-line option ‘-stdlib=libstdc++’ #808

Open Jacekalex opened 2 years ago

Jacekalex commented 2 years ago

My OS: Linux version 5.10.83-g1 (root@localhost) (gcc (Gentoo Hardened 11.2.0 p1) 11.2.0, GNU ld (Gentoo 2.37_p1 p0) 2.37) #1 SMP PREEMPT Wed Dec 1 23:08:57 CET 2021

clang.conf options: * /etc/portage/package.cflags/clang.conf -> net-libs/webkit-gtk: CXXFLAGS+=-stdlib=libstdc++ # error: use of undeclared identifier 'LC_ALL'

is incompatible with GCC-11.2.0.

Error:

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

    Run Build Command(s):/usr/bin/ninja cmTC_b0d8e && [1/2] Building CXX object CMakeFiles/cmTC_b0d8e.dir/testCXXCompiler.cxx.o
    FAILED: CMakeFiles/cmTC_b0d8e.dir/testCXXCompiler.cxx.o 
    /usr/bin/x86_64-pc-linux-gnu-g++   -march=native -O2 -pipe -DNDEBUG -march=native -O2 -pipe -stdlib=libstdc++ -Wl,-O1 -Wl,--as-needed -o CMakeFiles/cmTC_b0d8e.dir/testCXXCompiler.cxx.o -c testCXXCompiler.cxx
    x86_64-pc-linux-gnu-g++: error: unrecognized command-line option ‘-stdlib=libstdc++’
    ninja: build stopped: subcommand failed.

Cheers

Skyblueborb commented 2 years ago

net-libs/webkit-gtk: CXXFLAGS+=-stdlib=libstdc++ commenting this line fixes it for me here's my pull request

StefanSalewski commented 2 years ago

I have a very similar issue while installing gnome-light on a new AMD Ryzen notebook. Most packages built sucessfully, but now webkitgtk fails. Note, I have set clang use flag globally, but have not installed clang packages manually. Issue report is:

cat /var/tmp/portage/net-libs/webkit-gtk-2.36.1/temp/build.log 
 * Package:    net-libs/webkit-gtk-2.36.1
 * Repository: gentoo
 * Maintainer: gnome@gentoo.org
 * USE:        X abi_x86_64 amd64 egl elibc_glibc geolocation gstreamer introspection jpeg2k jumbo-build kernel_linux seccomp systemd userland_GNU wayland
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
 * /etc/portage/package.cflags/clang.conf -> net-libs/webkit-gtk: CXXFLAGS+=-stdlib=libstdc++ # error: use of undeclared identifier 'LC_ALL'
 * /etc/portage/package.cflags/lto.conf -> net-libs/webkit-gtk:4: *FLAGS-=-flto*
 * FEATURES='news config-protect-if-modified merge-sync unknown-features-warn unmerge-orphans distlocks network-sandbox buildpkg-live binpkg-docompress usersandbox strict protect-owned userpriv binpkg-dostrip multilib-strict qa-unresolved-soname-deps binpkg-multi-instance sandbox parallel-fetch ipc-sandbox binpkg-logs pid-sandbox fixlafiles usersync sfperms unmerge-logs ebuild-locks userfetch assume-digests xattr preserve-libs'
 * CFLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * CXXFLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -stdlib=libstdc++ -Wl,-O1 -Wl,--as-needed'
 * FFLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * FCFLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * F77FLAGS='-march=native -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed'
 * LDFLAGS='-Wl,-O1 -Wl,--as-needed'
 * MAKEOPTS='-j8'
 * gcc (Gentoo 11.3.0 p4) 11.3.0
 * g++ (Gentoo 11.3.0 p4) 11.3.0
 * GNU ld (Gentoo 2.37_p1 p2) 2.37
 * Linux hp17 5.17.9-x86_64 #4 SMP PREEMPT Mon May 23 12:51:30 CEST 2022 x86_64 AMD Ryzen 7 5700U with Radeon Graphics AuthenticAMD GNU/Linux
 * Checking whether python3_10 is suitable ...
 *   >=dev-lang/python-3.10.0_p1-r1:3.10[xml(+)] ...                                                                     [ ok ]
 * Using python3.10 to build (via PYTHON_COMPAT iteration)
>>> Unpacking source...
>>> Unpacking webkitgtk-2.36.1.tar.xz to /var/tmp/portage/net-libs/webkit-gtk-2.36.1/work
>>> Source unpacked in /var/tmp/portage/net-libs/webkit-gtk-2.36.1/work
>>> Preparing source in /var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkitgtk-2.36.1 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkitgtk-2.36.1"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build"
 * Disabling deprecation warnings ...                                                                                    [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkitgtk-2.36.1 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkitgtk-2.36.1"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build"
cmake -C /var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DRUBY_EXECUTABLE=/usr/bin/ruby27 -DCMAKE_DISABLE_FIND_PACKAGE_OpenGLES2=ON -DCMAKE_DISABLE_FIND_PACKAGE_EGL=OFF -DCMAKE_DISABLE_FIND_PACKAGE_OpenGL=OFF -DBWRAP_EXECUTABLE:FILEPATH=/usr/bin/bwrap -DDBUS_PROXY_EXECUTABLE:FILEPATH=/usr/bin/xdg-dbus-proxy -DPORT=GTK -DENABLE_API_TESTS=no -DENABLE_BUBBLEWRAP_SANDBOX=yes -DENABLE_GAMEPAD=no -DENABLE_GEOLOCATION=yes -DENABLE_MINIBROWSER=no -DENABLE_SPELLCHECK=no -DENABLE_UNIFIED_BUILDS=yes -DENABLE_VIDEO=yes -DENABLE_WEBGL=ON -DENABLE_WEBGL2=OFF -DENABLE_WEB_AUDIO=yes -DENABLE_GLES2=no -DENABLE_GTKDOC=no -DENABLE_INTROSPECTION=yes -DENABLE_JOURNALD_LOG=yes -DENABLE_QUARTZ_TARGET=no -DENABLE_WAYLAND_TARGET=yes -DENABLE_X11_TARGET=yes -DUSE_ANGLE_WEBGL=OFF -DUSE_AVIF=no -DUSE_GTK4=OFF -DUSE_JPEGXL=OFF -DUSE_LCMS=no -DUSE_LIBHYPHEN=ON -DUSE_LIBNOTIFY=no -DUSE_LIBSECRET=no -DUSE_OPENGL_OR_ES=ON -DUSE_OPENJPEG=yes -DUSE_SOUP2=ON -DUSE_WOFF2=ON -DUSE_WPE_RENDERER=yes -DCMAKE_BUILD_TYPE=Gentoo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build/gentoo_toolchain.cmake /var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkitgtk-2.36.1
loading initial cache file /var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build/gentoo_common_config.cmake
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  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.36.1/work/webkit-gtk-2.36.1_build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/ninja cmTC_9f51e && [1/2] Building CXX object CMakeFiles/cmTC_9f51e.dir/testCXXCompiler.cxx.o
    FAILED: CMakeFiles/cmTC_9f51e.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 -pipe -stdlib=libstdc++ -Wl,-O1 -Wl,--as-needed -o CMakeFiles/cmTC_9f51e.dir/testCXXCompiler.cxx.o -c /var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    x86_64-pc-linux-gnu-g++: error: unrecognized command-line option ‘-stdlib=libstdc++’
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:14 (project)

-- Configuring incomplete, errors occurred!
See also "/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build/CMakeFiles/CMakeOutput.log".
See also "/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build/CMakeFiles/CMakeError.log".
 * ERROR: net-libs/webkit-gtk-2.36.1::gentoo failed (configure phase):
 *   cmake failed
 * 
 * Call stack:
 *     ebuild.sh, line  127:  Called src_configure
 *   environment, line 5225:  Called cmake_src_configure
 *   environment, line 3122:  Called die
 * The specific snippet of code:
 *       "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed";
 * 
 * If you need support, post the output of `emerge --info '=net-libs/webkit-gtk-2.36.1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=net-libs/webkit-gtk-2.36.1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/net-libs/webkit-gtk-2.36.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/net-libs/webkit-gtk-2.36.1/temp/environment'.
 * Working directory: '/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkit-gtk-2.36.1_build'
 * S: '/var/tmp/portage/net-libs/webkit-gtk-2.36.1/work/webkitgtk-2.36.1'

Google tells us, that ‘-stdlib=libstdc++’ is a clang option, but we are using gcc 11.3.

StefanSalewski commented 2 years ago

As Skyblueborb said, commenting out that option fixed it. But modifying the original file is ugly, and I have no idea why that option exists so that gcc can pick 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++