Created attachment 848298 [details] Misconfiguration in Meson build This at least affects libglvnd, libdrm and wayland. When using abi_x86_32 for the above mentioned packages (and their dependencies, where necessary) on a 64 bit system, Meson seems to build the abi_x86_32.x86 portion of a package in 64 bit. This causes errors like this: For libglvnd the abi_x86_32.x86 compilation fails during linking: > ld.lld: error: /usr/lib/libX11.so is incompatible with elf64-x86-64 In this case the libX11.so is actually in the correct format (32 bit), but the objects it is attempted to link to are 64 bit. For wayland we get a similar issue, this time with libffi.so. Again, the shared object is correctly a 32 bit object, but the build artifacts are 64bit. > ld.lld: error: /usr/lib/libffi.so is incompatible with elf64-x86-64 For libdrm we get a different error, but I think this is caused by the same underlying issue. Here, compilation passes (because no external objects are linked I guess?), but the strict-multilib check fails, since the abi_x86_32.x86 build actually built (wrong) 64 bit libraries and is trying to put them into the (correct) 32bit directory: > Files matching a file type that is not allowed: > usr/lib/libdrm.so.2.4.0 > usr/lib/libdrm_radeon.so.1.0.1 > usr/lib/libdrm_amdgpu.so.1.0.0 > Error: x11-libs/libdrm-2.4.114::gentoo failed: > multilib-strict check failed! I'm on the experimental systemd/clang/merged-usr profile. I've played around with CC and friends for a gcc toolchain, but that has the same issue. Stable and unstable versions of meson, pkgconf and the above mentioned libraries all yield the same errors. I've attached a build log for libglvnd. I'm not too familiar with meson, but it looks strange to me that pkg-config is set to /usr/sbin/x86_64-pc-linux-gnu-pkg-config in both cases. Also, the build.pkg_config_path doesn't point in to the build directory for the 32 bit build in the same way it does for the 64bit build. Somehow this misconfiguration leads to the missing -m32 flag. It may also be relevant that CC doesn't actually affect the build. One has to change HOSTCC to actually change the compiler. This may be an unrelated issue with the clang profile or intended behavior though. Setting HOSTCC="clang -m32" makes the 32bit build pass, but the 64bit build fail.
This certainly isn't the case for me, so there's something more going on (obviously). 1. Please share emerge --info. 2. What are the differences between the ebuild in your attached build.log vs the one in gentoo? (It's from a local repository.) 3. If possible, please attempt to reproduce this in a clean stage3 via a chroot (just extract it to /tmp or something) and give a list of steps to do so.
(In reply to Aaron Siddhartha Mondal from comment #0) > It may also be relevant that CC doesn't actually affect the build. One has > to change HOSTCC to actually change the compiler. This may be an unrelated > issue with the clang profile or intended behavior though. Setting > HOSTCC="clang -m32" makes the 32bit build pass, but the 64bit build fail. This part in particular is suspicious and makes me think there's some other environment variables set that are interferring.
Portage 3.0.41 (python 3.10.9-final-0, default/linux/amd64/17.1/systemd/clang/merged-usr, gcc-12, glibc-2.36-r5, 6.1.4-gentoo x86_64) ================================================================= System uname: Linux-6.1.4-gentoo-x86_64-AMD_Ryzen_Threadripper_1920X_12-Core_Processor-with-glibc2.36 KiB Mem: 131778280 total, 112161532 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Wed, 11 Jan 2023 21:02:13 +0000 Head commit of repository gentoo: b036f67750985e03fbe42a95e1be6504a798453c Timestamp of repository steam-overlay: Tue, 10 Jan 2023 17:47:44 +0000 Head commit of repository steam-overlay: 03e78314c4c6343b9fe7aab35b4538b0a3aba524 sh bash 5.1_p16-r2 ld LLD 15.0.6 (compatible with GNU linkers) app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r2::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.36.0-r1::gentoo dev-lang/python: 3.10.9::gentoo, 3.11.1::gentoo dev-lang/rust-bin: 1.66.1::gentoo dev-util/cmake: 3.24.3::gentoo dev-util/meson: 1.0.0::gentoo sys-apps/baselayout: 2.9::gentoo sys-apps/sandbox: 2.29::gentoo sys-apps/systemd: 252.4::gentoo sys-devel/autoconf: 2.71-r5::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.39-r4::gentoo sys-devel/binutils-config: 5.4.1::gentoo sys-devel/clang: 15.0.6-r1::gentoo sys-devel/gcc: 12.2.1_p20221231::gentoo sys-devel/gcc-config: 2.10::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/lld: 15.0.6::gentoo sys-devel/llvm: 15.0.6-r1::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.15-r3::gentoo (virtual/os-headers) sys-libs/glibc: 2.36-r5::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: git sync-uri: github.com/gentoo-mirror/gentoo.git priority: -1000 sync-git-verify-commit-signature: yes local location: /var/db/repos/local masters: gentoo steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: github.com/gentoo-mirror/steam-overlay.git masters: gentoo ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" ADDR2LINE="llvm-addr2line" AR="llvm-ar" AS="clang -c" CBUILD="x86_64-pc-linux-gnu" CC="clang" CFLAGS="-O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /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/php/apache2-php8.1/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d" CPP="clang-cpp" CXX="clang++" CXXFLAGS="-O2 -pipe" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME" FCFLAGS="-O2 -pipe" 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" GENTOO_MIRRORS="distfiles.gentoo.org" LANG="en_US.utf8" LD="ld.lld" LDFLAGS="-Wl,-O2 -Wl,--as-needed" LEX="flex" NM="llvm-nm" OBJCOPY="llvm-objcopy" OBJDUMP="llvm-objdump" PKGDIR="/var/cache/binpkgs" 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" RANLIB="llvm-ranlib" READELF="llvm-readelf" SHELL="/bin/bash" STRINGS="llvm-strings" STRIP="llvm-strip" USE="X acl alsa amd64 binutils-plugin bzip2 clang cli context crypt dbus default-compiler-rt default-libcxx default-lld dri flatpak fortran gdbm iconv ipv6 libglvnd libtirpc llvm-libunwind multilib ncurses nls nptl openmp pam pcre pipewire-alsa policykit pulseaudio readline seccomp sound-server ssl system-llvm systemd test-rust threads udev unicode vulkan wayland x11-backend xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2021" 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 rdrand 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" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AMDGPU NVPTX" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-4" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi radeon" 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: ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS, SIZE, YACC, YFLAGS
Previous comment has `emerge --info`. The local is just an exact copy of the regular gentoo ebuild. The log for the regular build is the same. A regular `echo $HOSTCC` returns `clang`, which I think is correct, as the only two packages on this system built with gcc are efivar, glibc and gcc (and maybe some that override CC and friends themselves). I ran an `emerge -ev @world` before adding the abi_x86_32 use flags to the packages and the entire system with ~650 packages built fine. Non-meson 32bit multilib packages also seemed to build fine. It may be relevant that I used LLVM=1 to build the kernel. Maybe Meson or some tool dependency reads the kernel info somehow (similar to how Nvidia drivers do it) and can't deal with it being clang? But HOSTCC=gcc fails with essentially the same error. Meson just doesn't want to add that -m32. I'm not sure, but if this was an issue with pkgconf itself, then CMake builds should fail too right? I'll need some time to get a stage3 chroot running. I can try with a regular profile and the clang profile. Maybe this an issue with the clang profile after all? But it really seems like there is just one environment variable set wrong somewhere.
Note that HOSTCC shouldn't normally be set at all. Where's it coming from?
> Note that HOSTCC shouldn't normally be set at all. Where's it coming from? This was the issue. HOSTCC was set in .bashrc. Removing it fixed the builds. I still think it is curious that only Meson seems to have issues with this, but I guess things are working as intended. Thank you very much for your help!
Excellent, thanks for the update!