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

Bug 769986

Summary: dev-db/mongodb-4.4.{1,2}[lto] w/ sys-devel/lld installed: selected compiler does not honor -flto
Product: Gentoo Linux Reporter: Will Lepofsky <wilscarlet>
Component: Current packagesAssignee: Ultrabug <ultrabug>
Status: RESOLVED FIXED    
Severity: normal CC: ab4bd, flyser42, hydrapolic, ionen, sam
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: config.log
sconstruct-drop-linker-detection.patch

Description Will Lepofsky 2021-02-11 00:08:27 UTC
Attempting to install mongodb but fails with lto use flag:
>>> Emerging (1 of 6) dev-db/mongodb-4.4.2::gentoo
>>> Failed to emerge dev-db/mongodb-4.4.2, Log file:
>>>  '/var/tmp/portage/dev-db/mongodb-4.4.2/temp/build.log'
>>> Jobs: 0 of 6 complete, 1 failed                 Load avg: 1.50, 1.33, 1.28
 * Package:    dev-db/mongodb-4.4.2
 * Repository: gentoo
 * Maintainer: ultrabug@gentoo.org
 * USE:        abi_x86_64 amd64 elibc_glibc kernel_linux lto ssl tools userland_GNU
 * FEATURES:   network-sandbox preserve-libs sandbox userpriv usersandbox
 * Using python3.8 to build
>>> Unpacking source...
>>> Unpacking mongodb-src-r4.4.2.tar.gz to /var/tmp/portage/dev-db/mongodb-4.4.2/work
>>> Source unpacked in /var/tmp/portage/dev-db/mongodb-4.4.2/work
>>> Preparing source in /var/tmp/portage/dev-db/mongodb-4.4.2/work/mongodb-src-r4.4.2 ...
 * Applying mongodb-4.4.1-fix-scons.patch ...
 [ ok ]
 * Applying mongodb-4.4.1-no-compass.patch ...
 [ ok ]
 * Applying mongodb-4.4.1-boost.patch ...
 [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-db/mongodb-4.4.2/work/mongodb-src-r4.4.2 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-db/mongodb-4.4.2/work/mongodb-src-r4.4.2 ...
scons -j16 CC=x86_64-pc-linux-gnu-gcc CXX=x86_64-pc-linux-gnu-g++ --disable-warnings-as-errors --use-system-boost --use-system-pcre --use-system-snappy --use-system-stemmer --use-system-yaml --use-system-zlib --use-system-zstd --lto=on --ssl --nostrip install-core
scons: Reading SConscript files ...
scons: running with args /usr/bin/python3.8 /usr/lib/python-exec/python3.8/scons -j16 CC=x86_64-pc-linux-gnu-gcc CXX=x86_64-pc-linux-gnu-g++ --disable-warnings-as-errors --use-system-boost --use-system-pcre --use-system-snappy --use-system-stemmer --use-system-yaml --use-system-zlib --use-system-zstd --lto=on --ssl --nostrip install-core
Mkdir("build/scons")
scons version: 4.0.1
python version: 3 8 7 'final' 0
CC is x86_64-pc-linux-gnu-gcc
x86_64-pc-linux-gnu-gcc found in $PATH at /usr/bin/x86_64-pc-linux-gnu-gcc
/usr/bin/x86_64-pc-linux-gnu-gcc resolves to /usr/x86_64-pc-linux-gnu/gcc-bin/9.3.0/x86_64-pc-linux-gnu-gcc
CXX is x86_64-pc-linux-gnu-g++
x86_64-pc-linux-gnu-g++ found in $PATH at /usr/bin/x86_64-pc-linux-gnu-g++
/usr/bin/x86_64-pc-linux-gnu-g++ resolves to /usr/x86_64-pc-linux-gnu/gcc-bin/9.3.0/x86_64-pc-linux-gnu-g++
Checking whether the C compiler works... yes
Checking whether the C++ compiler works... yes
Checking that the C++ compiler can link a C++ program... yes
Checking if C++ compiler "x86_64-pc-linux-gnu-g++" is GCC... yes
Checking if C compiler "x86_64-pc-linux-gnu-gcc" is GCC... yes
Detected a x86_64 processor
Checking if target OS linux is supported by the toolchain... yes
Checking if C compiler is GCC 8.2 or newer...yes
Checking if C++ compiler is GCC 8.2 or newer...yes
Checking if C compiler supports -Wno-unused-local-typedefs... yes
Checking if C compiler supports -Wno-unused-function... yes
Checking if C compiler supports -Wno-unused-private-field... no
Checking if C compiler supports -Wno-deprecated-declarations... yes
Checking if C compiler supports -Wno-tautological-constant-out-of-range-compare... no
Checking if C compiler supports -Wno-tautological-constant-compare... no
Checking if C compiler supports -Wno-tautological-unsigned-zero-compare... no
Checking if C compiler supports -Wno-tautological-unsigned-enum-zero-compare... no
Checking if C compiler supports -Wno-unused-const-variable... yes
Checking if C compiler supports -Wno-unused-but-set-variable... yes
Checking if C compiler supports -Wno-missing-braces... yes
Checking if C compiler supports -Wno-inconsistent-missing-override... no
Checking if C compiler supports -Wno-potentially-evaluated-expression... no
Checking if C++ compiler supports -Wpessimizing-move... yes
Checking if C++ compiler supports -Wredundant-move... yes
Checking if C++ compiler supports -Wno-maybe-uninitialized... yes
Checking if C++ compiler supports -Wno-undefined-var-template... no
Checking if C++ compiler supports -Wno-instantiation-after-specialization... no
Checking if C compiler supports -Wno-unused-lambda-capture... no
Checking if C compiler supports -Wno-exceptions... no
Checking if C++ compiler supports -fsized-deallocation... yes
Checking if C++ compiler supports -Wno-defaulted-function-deleted... no
Checking if C++ compiler supports -Wunused-exception-parameter... no
Checking -Wnon-virtual-dtor for false positives... no
Checking if C compiler supports -fstack-protector-strong... yes
Checking if we are using libstdc++... yes
Checking if C++ compiler supports -std=c++17... yes
Checking if C compiler supports -std=c11... yes
WARNING: System versions of C++ libraries must be compiled with C++14/17 support
Checking for C++17... yes
Checking for memset_s... no
Checking for C function strnlen()... yes
Checking for libstdc++ 5.3.0 or better... yes
Checking if we are on a POSIX system... yes
Checking if the POSIX monotonic clock is supported... yes
Checking off_t is 8 bytes... yes
Checking if linker supports -fuse-ld=lld... yes
Checking if linker supports -Wl,--no-threads... no
Checking if linker supports -Wl,--build-id... yes
Checking if linker supports -Wl,--hash-style=gnu... yes
Checking if linker supports -Wl,-z,noexecstack... yes
Checking if linker supports -Wl,--warn-execstack... yes
Checking if linker supports -Wl,-z,relro... yes
Checking if C compiler supports -flto... yes
Checking if linker supports -flto... no
Link time optimization requested, but selected compiler does not honor -flto
See /var/tmp/portage/dev-db/mongodb-4.4.2/work/mongodb-src-r4.4.2/build/scons/config.log for details
 * ERROR: dev-db/mongodb-4.4.2::gentoo failed (compile phase):
 *   escons failed.
 * 
 * Call stack:
 *     ebuild.sh, line  125:  Called src_compile
 *   environment, line 3086:  Called escons 'CC=x86_64-pc-linux-gnu-gcc' 'CXX=x86_64-pc-linux-gnu-g++' '--disable-warnings-as-errors' '--use-system-boost' '--use-system-pcre' '--use-system-snappy' '--use-system-stemmer' '--use-system-yaml' '--use-system-zlib' '--use-system-zstd' '--lto=on' '--ssl' '--nostrip' 'install-core'
 *   environment, line 1542:  Called die
 * The specific snippet of code:
 *                   die -n "escons failed."
 * 
 * If you need support, post the output of `emerge --info '=dev-db/mongodb-4.4.2::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-db/mongodb-4.4.2::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-db/mongodb-4.4.2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-db/mongodb-4.4.2/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-db/mongodb-4.4.2/work/mongodb-src-r4.4.2'
 * S: '/var/tmp/portage/dev-db/mongodb-4.4.2/work/mongodb-src-r4.4.2'

emerge --info
Portage 3.0.13 (python 3.8.7-final-0, default/linux/amd64/17.1/hardened, gcc-9.3.0, glibc-2.32-r6, 5.10.14-gentoo-x86_64 x86_64)
=================================================================
System uname: Linux-5.10.14-gentoo-x86_64-x86_64-AMD_Ryzen_7_3800X_8-Core_Processor-with-glibc2.2.5
KiB Mem:    65762700 total,  56740400 free
KiB Swap:   33554428 total,  33554428 free
Timestamp of repository gentoo: Mon, 08 Feb 2021 22:30:01 +0000
Head commit of repository gentoo: e204066dbe6cb88978495fc2c58bcacb21ac2ad8
Timestamp of repository gamerlay: Fri, 05 Feb 2021 21:47:27 +0000
Head commit of repository gamerlay: 58a7b6a4f1d5b016b6bcbc25f2eb5a66312af659

sh bash 5.0_p18
ld GNU ld (Gentoo 2.35.1 p2) 2.35.1
app-shells/bash:          5.0_p18::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r6::gentoo, 3.8.7-r1::gentoo, 3.9.1-r1::gentoo
dev-util/cmake:           3.18.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1-r1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.13.4-r2::gentoo, 1.16.2-r1::gentoo
sys-devel/binutils:       2.35.1-r1::gentoo
sys-devel/gcc:            9.3.0-r2::gentoo
sys-devel/gcc-config:     2.3.2-r1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r6::gentoo
Repositories:

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

gamerlay
    location: /var/db/repos/gamerlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gamerlay.git
    masters: gentoo

localrepo
    location: /var/db/repos/localrepo
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
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"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=y"
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="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs 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="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_US en"
MAKEOPTS="-j16"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--quiet"
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"
USE="10bit X a52 aac aacplus aacs acl amd64 bluetooth branding brotli bzip2 colord crypt cups dav1d dbus device-mapper elogind exif ffmpeg flac gif hardened harfbuzz http2 iconv icu infinality ipp_autosetup ipv6 jpeg jpeg2k libglvnd libnotify libtirpc lto lvm lz4 lzma lzo matroska mp3 mp4 multilib ncurses networkmanager nls nptl ogg opencl opengl openmp pam pcre pgo pie png policykit postscript pulseaudio readline seccomp secure-delete spell split-usr ssh ssl ssp startup-notification svg system-av1 system-cairo system-ffmpeg system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-llvm system-sqlite system-webp theora threaded threads tiff udev udisks unicode upower vdo vdpau vorbis vpx vulkan webp x264 x265 xattr xcomposite xfs xtpax zip zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" 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" 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" 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="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en-US en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="nlpsolver" LLVM_TARGETS="AMDGPU BPF X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 1 Ionen Wolkens gentoo-dev 2021-02-11 03:26:26 UTC
Created attachment 686295 [details]
config.log

scons: Configure: Checking if linker supports -flto...
...
ld.lld: error: undefined symbol: main

Seems it auto-detects ld.lld and attempts to use it, works fine if it's not installed.
Comment 2 Will Lepofsky 2021-10-07 03:43:14 UTC
Problem still exists for 4.4.4, 4.4.8, and 5.0.2.
Comment 3 Will Lepofsky 2022-03-08 23:58:36 UTC
Problem still exists with version 5.0.5 as well.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-09 01:14:08 UTC
Created attachment 766615 [details, diff]
sconstruct-drop-linker-detection.patch

Please try the attached patch. Usually there isn't a need to keep listing affected versions though. Attaching a patch is the best way to get something moving if it seems stalled.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-09 01:14:32 UTC
(In reply to Sam James from comment #4)
> Created attachment 766615 [details, diff] [details, diff]
> sconstruct-drop-linker-detection.patch
> 
> Please try the attached patch. Usually there isn't a need to keep listing
> affected versions though. Attaching a patch is the best way to get something
> moving if it seems stalled.

(untested)
Comment 6 Will Lepofsky 2022-03-10 17:51:06 UTC
(In reply to Sam James from comment #4)
> Created attachment 766615 [details, diff] [details, diff]
> sconstruct-drop-linker-detection.patch
> 
> Please try the attached patch. Usually there isn't a need to keep listing
> affected versions though. Attaching a patch is the best way to get something
> moving if it seems stalled.

If I knew what to patch, I would have submitted the bug with a patch.  Thanks for the patch you provided, I'll try your patch over the weekend.
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-16 00:03:18 UTC
Did it work?
Comment 8 Larry the Git Cow gentoo-dev 2022-06-18 17:17:48 UTC
The bug has been closed via the following commit(s):

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

commit 79a3c0438c8f3885fb8d5840263b36c8ebd80f4f
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-06-18 17:17:37 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-18 17:17:41 +0000

    dev-db/mongodb: don't force LLD
    
    See patch for details.
    
    Closes: https://bugs.gentoo.org/769986
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/mongodb-4.4.10-no-force-lld.patch        | 29 +++++++++++++
 .../mongodb/files/mongodb-5.0.5-no-force-lld.patch | 49 ++++++++++++++++++++++
 dev-db/mongodb/mongodb-4.4.10-r1.ebuild            |  1 +
 dev-db/mongodb/mongodb-5.0.5-r2.ebuild             |  1 +
 4 files changed, 80 insertions(+)