Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 768897 - sys-libs/glibc-2.32-r5 ROOT != '/' install for aarch64: libm !needed
Summary: sys-libs/glibc-2.32-r5 ROOT != '/' install for aarch64: libm !needed
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal major (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: preserve-libs
  Show dependency tree
 
Reported: 2021-02-05 19:03 UTC by Stuart Shelton
Modified: 2021-05-20 07:22 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
glibc ARM64 build log (glibc-2.32-r5:20210213-053459.log.xz,190.45 KB, application/x-xz)
2021-02-13 11:56 UTC, Stuart Shelton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2021-02-05 19:03:53 UTC
I'm building Gentoo in a container on ARM64, where I'm starting with the Gentoo 'stage3' image building packages with 'ROOT' set, then using a multi-stage build to take the contents of the ROOT directory and copy it to the (actual) root as the resulting image.

The same system has worked correctly for x86 and AMD64.

On ARM64, however, at the end of the sys-libs/glibc-2.32-r5 build the output (with ROOT='/build') is:

```
>>> needed    obj /build/lib64/libm-2.32.so
>>> Safely unmerging already-installed instance...
>>> Original instance of package unmerged safely.
>>> sys-libs/glibc-2.32-r5 merged.
>>> Regenerating /build/etc/ld.so.cache...
<<< !needed  obj /build/lib64/libm-2.32.so
```

... and on inspection, the /build directory-tree has all elements of the glibc package *except* for:

# ls -l /build{,/usr}/lib*/libm[-.]*
lrwxrwxrwx 1 root root      12 Feb  5 18:19 /build/lib64/libm.so.6 -> libm-2.32.so
-rw-r--r-- 1 root root 1718992 Feb  5 18:18 /build/usr/lib64/libm.a
lrwxrwxrwx 1 root root      21 Feb  5 18:18 /build/usr/lib64/libm.so -> ../../lib64/libm.so.6

... we retain the (...)/lib64/libm.so.6 symlink, but (...)/lib64/libm-2.32.so has been removed!

I can't find any documentation on how needed/!needed is calculated, but it appears that in the case of a ROOT install on aarch64 (but not x64) it is causing a necessary shared-object to be removed on installation.
Comment 1 Stuart Shelton 2021-02-05 19:06:10 UTC
From within the container with the file erroneously removed, built from the most recent stage3 image from Docker Hub:

```
# emerge --info         
Portage 3.0.4 (python 3.7.9-final-0, default/linux/arm64/17.0, gcc-9.3.0, glibc-2.31-r6, 5.4.83-v8+ aarch64)
=================================================================
System uname: Linux-5.4.83-v8+-aarch64-with-gentoo-2.7
KiB Mem:     8002296 total,   2642488 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Mon, 09 Nov 2020 09:03:20 +0000
sh bash 5.0_p18
ld GNU ld (Gentoo 2.34 p6) 2.34.0
app-shells/bash:          5.0_p18::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r2::gentoo, 3.7.9::gentoo, 3.8.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.69-r5::gentoo
sys-devel/automake:       1.16.2-r1::gentoo
sys-devel/binutils:       2.34-r2::gentoo
sys-devel/gcc:            9.3.0-r1::gentoo
sys-devel/gcc-config:     2.3.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.31-r6::gentoo
Repositories:

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

container
    location: /var/db/repo/container
    masters: gentoo

srcshelton
    location: /var/db/repo/srcshelton
    sync-type: git
    sync-uri: /var/db/repo/srcshelton.local
    masters: gentoo

ABI="arm64"
ACCEPT_KEYWORDS="arm64"
ACCEPT_LICENSE="Apache-2.0 Artistic Artistic-2 BSD BSD-2 BSD-4 GPL-1+ GPL-2 GPL-2+ GPL-3 GPL-3+ ISC LGPL-2 LGPL-2.1 LGPL-2.1+ LGPL-3 LGPL-3+ MIT public-domain"
ACCEPT_PROPERTIES="*"
ACCEPT_RESTRICT="*"
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"
ARCH="arm64"
AUTOCLEAN="yes"
BINPKG_COMPRESS="bzip2"
BOOTSTRAP_USE="unicode internal-glib pkg-config split-usr python_targets_python3_8"
BROOT=""
CALLIGRA_FEATURES="karbon sheets words"
CBUILD="aarch64-unknown-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="aarch64-unknown-linux-gnu"
CHOST_arm64="aarch64-unknown-linux-gnu"
CLEAN_DELAY="5"
COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
COLLISION_IGNORE="/lib/modules/*"
COLUMNS="202"
COMMON_FLAGS="-O2 -pipe"
CONFIG_PROTECT="/etc /etc/env.d /lib/rcscripts/addons /usr/share/gnupg/qualified.txt /var/www/localhost/htdocs/phpBB /var/www/localhost/htdocs/roundcube/config /var/www/localhost/htdocs/wordpress"
CONFIG_PROTECT_MASK="/etc/X11/xkb /etc/ca-certificates.conf /etc/env.d /etc/fonts /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CPU_FLAGS_ARM="edsp thumb thumb2 v4 v5 v6 v7 v8 vfp vfp-d32 vfpv3 vfpv4"
CPU_FLAGS_X86="f16c pclmul"
CXXFLAGS="-O2 -march=native -pipe"
DEBUG="1"
DEFAULT_ABI="arm64"
DISTDIR="/var/cache/portage/dist"
ELIBC="glibc"
EMERGE_DEFAULT_OPTS="--autounmask-write=y --backtrack=100 --binpkg-changed-deps=y --binpkg-respect-use=y --buildpkg=y --color=y --deep --ignore-soname-deps=n --keep-going=y --rebuild-if-new-slot=y --verbose=y --verbose-conflicts"
EMERGE_WARNING_DELAY="10"
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"
EPREFIX=""
EROOT="/"
ESYSROOT="/"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg clean-logs compress-build-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync mount-sandbox multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs qa-unresolved-soname-deps sandbox sfperms split-elog split-log splitdebug strict unknown-features-filter unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""
FETCHCOMMAND_RSYNC="rsync -LtvP "${URI}" "${DISTDIR}/${FILE}""
FETCHCOMMAND_SFTP="bash -c "x=\${2#sftp://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port= ; eval \"declare -a ssh_opts=(\${3})\" ; exec sftp \${port:+-P \${port}} \"\${ssh_opts[@]}\" \"\${host}:/\${x#*/}\" \"\$1\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
FETCHCOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port= ; exec rsync --rsh=\"ssh \${port:+-p\${port}} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
FFLAGS="-O2 -pipe"
GCC_SPECS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
GENTOO_PROFILE="default/linux/arm64/17.0"
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=""
HOME="/root"
HOSTNAME="turnpike"
INFOPATH="/usr/share/gcc-data/aarch64-unknown-linux-gnu/9.3.0/info:/usr/share/binutils-data/aarch64-unknown-linux-gnu/2.34/info:/usr/share/info"
INPUT_DEVICES="libinput"
INSTALL_MASK="AUTHORS.gz AUTHORS.bz2 BACKLOG.gz BACKLOG.bz2 BLURB.gz BLURB.bz2 CHANGELOG.gz CHANGELOG.bz2 Changelog.gz Changelog.bz2 ChangeLog.gz ChangeLog.bz2 ChangeLog.0.gz ChangeLog.1.gz CHANGES.gz CHANGES.bz2 Changes.gz Changes.bz2 COPYING.gz COPYING.bz2 Copying.gz Copying.bz2 CREDITS.gz CREDITS.bz2 INSTALL.gz INSTALL.bz2 MANIFEST.gz MANIFEST.bz2 NEWS.gz NEWS.bz2 PORTING.gz PORTING.bz2 THANKS.gz THANKS.bz2 TODO.gz TODO.bz2 WHATS_NEW.gz WHATS_NEW.bz2 /usr/lib/debug /usr/share/locale -/usr/share/locale/locale.alias -/usr/share/locale/en -/usr/share/locale/en_GB -/usr/share/locale/en_US /usr/share/X11/locale -/usr/share/X11/locale/compose.dir -/usr/share/X11/locale/locale.alias -/usr/share/X11/locale/locale.dir -/usr/share/X11/locale/C -/usr/share/X11/locale/en_US.UTF-8 -/usr/share/X11/locale/iso8859-1 -/usr/share/X11/locale/iso8859-15 /usr/share/man -/usr/share/man/man0 -/usr/share/man/man0p -/usr/share/man/man1 -/usr/share/man/man1p -/usr/share/man/man2 -/usr/share/man/man3 -/usr/share/man/man3p -/usr/share/man/man4 -/usr/share/man/man5 -/usr/share/man/man6 -/usr/share/man/man7 -/usr/share/man/man8 -/usr/share/man/mann -/usr/share/man/cat0 -/usr/share/man/cat0p -/usr/share/man/cat1 -/usr/share/man/cat1p -/usr/share/man/cat2 -/usr/share/man/cat3 -/usr/share/man/cat3p -/usr/share/man/cat4 -/usr/share/man/cat5 -/usr/share/man/cat6 -/usr/share/man/cat7 -/usr/share/man/cat8 -/usr/share/man/catn /usr/lib64/python*/site-packages/mercurial/locale /usr/share/binutils-data/x86_64-pc-linux-gnu/*/locale /usr/share/gcc-data/x86_64-pc-linux-gnu/*/locale /usr/lib/systemd /usr/lib/tmpfiles.d /usr/lib/sysusers.d /lib/systemd /etc/systemd"
IUSE_IMPLICIT="prefix prefix-guest prefix-stack"
JOBS="3"
KERNEL="linux"
L10N="en en_GB"
LANG="C.UTF8"
LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
LC_CTYPE="C.UTF-8"
LC_MESSAGES="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LESS="-R -M --shift 5"
LESSOPEN="|lesspipe %s"
LIBDIR_arm64="lib64"
LIBDIR_x32="lib32"
LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"
LINES="61"
LLVM_TARGETS="BPF X86"
LUA_SINGLE_TARGET="lua5-1"
LUA_TARGETS="lua5-1"
MAKEOPTS="-j3"
MANPAGER="manpager"
MANPATH="/usr/share/gcc-data/aarch64-unknown-linux-gnu/9.3.0/man:/usr/share/binutils-data/aarch64-unknown-linux-gnu/2.34/man:/usr/local/share/man:/usr/share/man"
MAXLOAD="3.00"
MICROCODE_SIGNATURES="-S"
MULTILIB_ABIS="arm64"
NOCOLOR="false"
OFFICE_IMPLEMENTATION="libreoffice"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
PEAR_CACHEDIR="/var/cache/pear"
PEAR_DOWNLOADDIR="/var/tmp/pear"
PEAR_TEMPDIR="/var/tmp"
PHP_TARGETS="php7-3 php7-4"
PKGDIR="/var/cache/portage/pkg/arm64/docker"
PORTAGE_ARCHLIST="alpha amd64 amd64-linux arm arm-linux arm64 arm64-linux arm64-macos hppa ia64 m68k mips ppc ppc-macos ppc64 ppc64-linux riscv s390 sparc sparc-solaris sparc64-solaris x64-cygwin x64-macos x64-solaris x64-winnt x86 x86-linux x86-solaris x86-winnt"
PORTAGE_BIN_PATH="/usr/lib/portage/python3.7"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"
PORTAGE_COMPRESS_FLAGS="-9eT0"
PORTAGE_CONFIGROOT="/"
PORTAGE_DEBUG="0"
PORTAGE_DEPCACHEDIR="/var/cache/edb/dep"
PORTAGE_ELOG_CLASSES="log warn error"
PORTAGE_ELOG_MAILFROM="portage@rufus.miltonroad.net"
PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for ${PACKAGE} on ${HOST}"
PORTAGE_ELOG_MAILURI="stuart@shelton.me smtp.miltonroad.net"
PORTAGE_ELOG_SYSTEM="echo save mail_summary"
PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS="5"
PORTAGE_FETCH_RESUME_MIN_SIZE="350K"
PORTAGE_GID="250"
PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --digest-algo SHA256 --clearsign --yes --default-key "${PORTAGE_GPG_KEY}" --homedir "${PORTAGE_GPG_DIR}" "${FILE}""
PORTAGE_INST_GID="0"
PORTAGE_INST_UID="0"
PORTAGE_INTERNAL_CALLER="1"
PORTAGE_LOGDIR="/var/log/portage"
PORTAGE_LOGDIR_CLEAN="find "${PORTAGE_LOGDIR}" -type f ! -name "summary.log*" -mtime +7 -delete"
PORTAGE_OVERRIDE_EPREFIX=""
PORTAGE_PYM_PATH="/usr/lib/python3.7/site-packages"
PORTAGE_PYTHONPATH="/usr/lib/python3.7/site-packages"
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_RSYNC_RETRIES="-1"
PORTAGE_SYNC_STALE="30"
PORTAGE_TMPDIR="/var/tmp"
PORTAGE_VERBOSE="1"
PORTAGE_WORKDIR_MODE="0700"
PORTAGE_XATTR_EXCLUDE="btrfs.* security.evm security.ima        security.selinux system.nfs4_acl user.apache_handler    user.Beagle.* user.dublincore.* user.mime_encoding user.xdg.*"
POSTGRES_TARGETS="postgres10 postgres11"
PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USERLAND USE_EXPAND_IMPLICIT USE_EXPAND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL USE_EXPAND_VALUES_USERLAND"
PWD="/"
PYTHONDONTWRITEBYTECODE="1"
PYTHON_SINGLE_TARGET="python3_8"
PYTHON_TARGETS="python3_8"
RESUMECOMMAND="wget -c -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""
RESUMECOMMAND_RSYNC="rsync -LtvP "${URI}" "${DISTDIR}/${FILE}""
RESUMECOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port= ; exec rsync --rsh=\"ssh \${port:+-p\${port}} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
ROOT="/"
ROOTPATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin"
RPMDIR="/var/cache/portage/rpm"
RUBY_TARGETS="ruby26"
SHLVL="1"
SYMLINK_LIB="no"
SYSROOT="/"
TERM="screen-256color"
TRACE="1"
TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
UNINSTALL_IGNORE="/lib/modules/* /var/run /var/lock"
USE="acl acpi adns aio ao arm64 bash-completion berkdb bzip2 caps chroot cli crypt curl cxx dri encode expat fam ffmpeg fftw filecaps flac ftp gd gdbm gif gmp iconv icu id3tag idn iodbc ipv6 ithreads javascript jpeg jpeg2k json lame libatomic libedit libffi libglvnd libidn2 libsamplerate libtirpc libwww lighttpd lz4 lzma lzo mad mariadb mbox memcached mmap mp3 mpfr mysql mysqli ncurses network nfs nls nntp nptl odbc ogg pam pcre perl php png python readline rpc sctp seccomp sep-usr server slp smtp sndfile snmp speex spell split-usr sql sqlite ssl svg syslog tcmalloc tcpd theora threads tiff unicode unwind urandom uuid vim-syntax vorbis wavpack x264 xattr xinetd xml xvid xxhash yaml zlib zstd" 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_ARM="edsp thumb thumb2 v4 v5 v6 v7 v8 vfp vfp-d32 vfpv3 vfpv4" CPU_FLAGS_X86="f16c pclmul" 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" L10N="en en_GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="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="fbdev dummy matrox v4l" 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"
USERLAND="GNU"
USE_EXPAND="ABI_MIPS ABI_PPC ABI_RISCV ABI_S390 ABI_X86 ADA_TARGET ALSA_CARDS APACHE2_MODULES APACHE2_MPMS CALLIGRA_FEATURES CAMERAS COLLECTD_PLUGINS CPU_FLAGS_ARM CPU_FLAGS_PPC CPU_FLAGS_X86 CURL_SSL ELIBC ENLIGHTENMENT_MODULES FFTOOLS GPSD_PROTOCOLS GRUB_PLATFORMS INPUT_DEVICES KERNEL L10N LCD_DEVICES LIBREOFFICE_EXTENSIONS LIRC_DEVICES LLVM_TARGETS LUA_SINGLE_TARGET LUA_TARGETS MONKEYD_PLUGINS NGINX_MODULES_HTTP NGINX_MODULES_MAIL NGINX_MODULES_STREAM OFED_DRIVERS OFFICE_IMPLEMENTATION OPENMPI_FABRICS OPENMPI_OFED_FEATURES OPENMPI_RM PHP_TARGETS POSTGRES_TARGETS PYTHON_SINGLE_TARGET PYTHON_TARGETS QEMU_SOFTMMU_TARGETS QEMU_USER_TARGETS ROS_MESSAGES RUBY_TARGETS SANE_BACKENDS USERLAND UWSGI_PLUGINS VIDEO_CARDS VOICEMAIL_STORAGE XFCE_PLUGINS XTABLES_ADDONS"
USE_EXPAND_HIDDEN="ABI_MIPS ABI_PPC ABI_RISCV ABI_S390 ABI_X86 CPU_FLAGS_PPC CPU_FLAGS_X86 ELIBC KERNEL USERLAND"
USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
USE_EXPAND_UNPREFIXED="ARCH"
USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm64 arm64-macos hppa ia64 m68k mips ppc ppc64 ppc64-linux ppc-macos riscv s390 sparc sparc64-solaris sparc-solaris x64-cygwin x64-macos x64-solaris x64-winnt x86 x86-fbsd x86-linux x86-solaris x86-winnt"
USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"
USE_EXPAND_VALUES_USERLAND="BSD GNU"
USE_ORDER="env:pkg:conf:defaults:pkginternal:features:repo:env.d"
VIDEO_CARDS="fbdev dummy matrox v4l"
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"
container="podman"
use_essential="asm ipv6 ithreads mdev openssl ssl threads tls-heartbeat zlib cpu_flags_arm_edsp cpu_flags_arm_neon cpu_flags_arm_thumb cpu_flags_arm_vfp cpu_flags_arm_vfpv3 cpu_flags_arm_vfpv4 cpu_flags_arm_vfp-d32 cpu_flags_arm_crc32 cpu_flags_arm_v4 cpu_flags_arm_v5 cpu_flags_arm_v6 cpu_flags_arm_v7 cpu_flags_arm_thumb2"
```
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2021-02-11 23:45:44 UTC
(In reply to Stuart Shelton from comment #0)
> I'm building Gentoo in a container on ARM64, where I'm starting with the
> Gentoo 'stage3' image building packages with 'ROOT' set, then using a
> multi-stage build to take the contents of the ROOT directory and copy it to
> the (actual) root as the resulting image.

Can you paste sequence of commands to run so I could reproduce it in chroot? The missing file is very strange. 'needed' entried are probably a distraction. If you install glibc-2.32 libm-2.32.so should be installed and not removed.

Attaching full build and install log for a problematic install might help.
Comment 3 Stuart Shelton 2021-02-13 11:56:09 UTC
Created attachment 686544 [details]
glibc ARM64 build log


Build log attached - I need integrate my ARM64 changes, but once I can commit them the entire container-build system is online at https://github.com/srcshelton/docker-gentoo-build,
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2021-02-13 13:55:42 UTC
I'd prefer not to debug a large build system not directly related to Gentoo.

Please provide minimal sequence of commands equivalent to what you are doing. So far it seems that you are doing more than just 'ROOT=/build emerge glibc'.
Comment 5 Stuart Shelton 2021-02-14 12:48:58 UTC
The specific command is:

```
USE='asm ipv6 ithreads mdev openssl ssl threads tls-heartbeat zlib cpu_flags_arm_edsp cpu_flags_arm_neon cpu_flags_arm_thumb cpu_flags_arm_vfp cpu_flags_arm_
vfpv3 cpu_flags_arm_vfpv4 cpu_flags_arm_vfp-d32 cpu_flags_arm_crc32 cpu_flags_arm_v4 cpu_flags_arm_v5 cpu_flags_arm_v6 cpu_flags_arm_v7 cpu_flags_arm_thumb2' emerge --jobs=3 --load-average=3.00 --tree --usepkg=y dev-util/pkgconf sys-libs/glibc sys-apps/portage
```

... with environment:

```
ROOT                = "/build/"
SYSROOT             = "/build/"
PORTAGE_CONFIGROOT  = "/build/"

FEATURES            = "assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg clean-logs compress-build-logs
                       compressdebug config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles ipc-sandbox merge-sync mount-sandbox
                       multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs qa-unresolved-soname-deps sandbox
                       sfperms split-elog split-log splitdebug strict unknown-features-filter unknown-features-warn unmerge-logs unmerge-orphans userfetch
                       userpriv usersandbox usersync xattr"
ACCEPT_LICENSE      = "Apache-2.0 Artistic Artistic-2 BSD BSD-2 BSD-4 GPL-1+ GPL-2 GPL-2+ GPL-3 GPL-3+ ISC LGPL-2 LGPL-2.1 LGPL-2.1+ LGPL-3 LGPL-3+
                       MIT public-domain"
ACCEPT_KEYWORDS     = "arm64"
MAKEOPTS            = "-j3"

EMERGE_DEFAULT_OPTS = "--autounmask-write=y --backtrack=100 --binpkg-changed-deps=y --binpkg-respect-use=y --buildpkg=y --color=y --deep --ignore-soname-deps=n
                       --keep-going=y --rebuild-if-new-slot=y --verbose=y --verbose-conflicts  --with-bdeps=y --with-bdeps-auto=y"

DISTDIR             = "/var/cache/portage/dist"
PKGDIR              = "/var/cache/portage/pkg/arm64/docker"
PORTAGE_LOGDIR      = "/var/log/portage"

```

... running on the docker.io/gentoo/stage3 image tagged 'latest' (at the time or writing, 1f9289a887a8 which is two months old).
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2021-02-14 16:53:42 UTC
(In reply to Stuart Shelton from comment #5)
> The specific command is:
> 
> ```
> USE='asm ipv6 ithreads mdev openssl ssl threads tls-heartbeat zlib
> cpu_flags_arm_edsp cpu_flags_arm_neon cpu_flags_arm_thumb cpu_flags_arm_vfp
> cpu_flags_arm_
> vfpv3 cpu_flags_arm_vfpv4 cpu_flags_arm_vfp-d32 cpu_flags_arm_crc32
> cpu_flags_arm_v4 cpu_flags_arm_v5 cpu_flags_arm_v6 cpu_flags_arm_v7
> cpu_flags_arm_thumb2' emerge --jobs=3 --load-average=3.00 --tree --usepkg=y
> dev-util/pkgconf sys-libs/glibc sys-apps/portage
> ```

Is rebuilding glibc enough to trigger the failure?

> ... with environment:
> 
> ```
> ROOT                = "/build/"
> SYSROOT             = "/build/"
> PORTAGE_CONFIGROOT  = "/build/"
>
> FEATURES            = "assume-digests binpkg-docompress binpkg-dostrip
> binpkg-logs binpkg-multi-instance buildpkg clean-logs compress-build-logs
>                        compressdebug config-protect-if-modified distlocks
> ebuild-locks fakeroot fixlafiles ipc-sandbox merge-sync mount-sandbox
>                        multilib-strict network-sandbox news parallel-fetch
> parallel-install pid-sandbox preserve-libs qa-unresolved-soname-deps sandbox
>                        sfperms split-elog split-log splitdebug strict
> unknown-features-filter unknown-features-warn unmerge-logs unmerge-orphans
> userfetch
>                        userpriv usersandbox usersync xattr"
> ACCEPT_LICENSE      = "Apache-2.0 Artistic Artistic-2 BSD BSD-2 BSD-4 GPL-1+
> GPL-2 GPL-2+ GPL-3 GPL-3+ ISC LGPL-2 LGPL-2.1 LGPL-2.1+ LGPL-3 LGPL-3+
>                        MIT public-domain"
> ACCEPT_KEYWORDS     = "arm64"
> MAKEOPTS            = "-j3"
> 
> EMERGE_DEFAULT_OPTS = "--autounmask-write=y --backtrack=100
> --binpkg-changed-deps=y --binpkg-respect-use=y --buildpkg=y --color=y --deep
> --ignore-soname-deps=n
>                        --keep-going=y --rebuild-if-new-slot=y --verbose=y
> --verbose-conflicts  --with-bdeps=y --with-bdeps-auto=y"
> 
> DISTDIR             = "/var/cache/portage/dist"
> PKGDIR              = "/var/cache/portage/pkg/arm64/docker"
> PORTAGE_LOGDIR      = "/var/log/portage"
> 
> ```

Is /build directory empty at the time of running the emerge?
How do you pass that "environment"? They syntax does not look like a shell environment.

> ... running on the docker.io/gentoo/stage3 image tagged 'latest' (at the
> time or writing, 1f9289a887a8 which is two months old).

I am not familiar with docker images. Are they identical to stages from http://distfiles.gentoo.org/releases/arm64/? Or I need to add extra configuration to vanilla stage3?

I'd prefer to have exact commands to run in a chroot.
Comment 7 Stuart Shelton 2021-02-14 17:15:28 UTC
(In reply to Stuart Shelton from comment #5)
> ... running on the docker.io/gentoo/stage3 image tagged 'latest' (at the
> time or writing, 1f9289a887a8 which is two months old).

Also happens on the just-updated d8b473f87d4e image from 16 hours ago.
Comment 8 Stuart Shelton 2021-02-14 17:42:02 UTC
(In reply to Sergei Trofimovich from comment #6)
> 
> Is rebuilding glibc enough to trigger the failure?
It seems that way, yes.

> Is /build directory empty at the time of running the emerge?
> How do you pass that "environment"? They syntax does not look like a shell
> environment.
The `build` directory starts-off empty, but a few packages are built into this location before the step which tries to build glibc - namely, `fakeroot` (deps libcap, 
linux-headers, attr), audit (deps libcap-ng), and then this step which builds glibc.

> I am not familiar with docker images. Are they identical to stages from
> http://distfiles.gentoo.org/releases/arm64/? Or I need to add extra
> configuration to vanilla stage3?
There is documentation at https://github.com/gentoo/gentoo-docker-images - it looks as if the files at https://ftp-osl.osuosl.org/pub/gentoo/releases/${ARCH}/autobuilds are used to build the container image.

> I'd prefer to have exact commands to run in a chroot.
I guess you could extract the image to a directory, mount the necessary system paths (dev, proc, sys, etc.), bind-mount your portage directory and then run the above command...

(I'd suggest using `podman` over `docker` personally, but the 'extract' step above is:

```
img='docker.io/gentoo/stage3:latest'
docker image pull --override-arch arm64 "${img}"
docker image save -o stage3-latest.tar "${img}"
```
)
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2021-02-15 07:40:36 UTC
(In reply to Stuart Shelton from comment #8)
> > How do you pass that "environment"? They syntax does not look like a shell
> > environment.

I still don;t see how to do it.
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2021-02-15 07:59:17 UTC
Looks like I lost chroot access to arm64 host anyway.

Let's see if we can figure out where the bug comes from with a bit of speculation.

preserved-libs are cleaned up in _remove_preserved_libs():

	def _remove_preserved_libs(self, cpv_lib_map):
		"""
		Remove files returned from _find_unused_preserved_libs().
		"""

		os = _os_merge

		files_to_remove = set()
		for files in cpv_lib_map.values():
			files_to_remove.update(files)
		files_to_remove = sorted(files_to_remove)
		showMessage = self._display_merge
		root = self.settings['ROOT']

		parent_dirs = set()
		for obj in files_to_remove:
			obj = os.path.join(root, obj.lstrip(os.sep))
			parent_dirs.add(os.path.dirname(obj))
			if os.path.islink(obj):
				obj_type = _("sym")
			else:
				obj_type = _("obj")
			try:
				os.unlink(obj)
			except OSError as e:
				if e.errno != errno.ENOENT:
					raise
				del e
			else:
				showMessage(_("<<< !needed  %s %s\n") % (obj_type, obj),
					noiselevel=-1)

I wonder if installing a binary with libm dependency before glibc dependency into new ROOT forces portage to record libm as needed library. Does not explain much why libc.so(and other libc libs) are affected the same.

Worth checking different install order and make glibc installed first.
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2021-02-15 09:19:24 UTC
I tried to repeoduce it on amd64 and did not succeed. I tried as:

  # mkdir -p /build/bin # gawk fails to set a symlink otherwise
  # ROOT=/build emerge -Ov1 sys-apps/gawk # has libm.so.6 dep
  # ROOT=/build emerge -Ov1 sys-libs/glibc

Try to find minimum set of commands and variables needed to reproduce it on your system.
Comment 12 Stuart Shelton 2021-02-15 10:15:19 UTC
(In reply to Sergei Trofimovich from comment #9)
> (In reply to Stuart Shelton from comment #8)
> > > How do you pass that "environment"? They syntax does not look like a shell
> > > environment.
> 
> I still don;t see how to do it.

Sorry!  It's reformatted output from 'emerge --info'

(See https://github.com/srcshelton/docker-gentoo-build/blob/3e9668e255b9e78abdf67f073a30972d12c7ab82/gentoo-base/entrypoint.sh#L177)
Comment 13 Stuart Shelton 2021-02-15 10:21:24 UTC
(In reply to Sergei Trofimovich from comment #10)
> Let's see if we can figure out where the bug comes from with a bit of
> speculation.

To confirm, though, the presence of the '!needed' text in this function and in the output I'm seeing does indicate (prove?) that this is where the library is being lost - and so the question is now one of "Why does portage think a new libm (in this ROOT) is a stale preserved library"?

As a temporary work-around, is there any variable which can be set or function which can be called from an ebuild to disable library-preservation checks?
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2021-02-16 18:43:53 UTC
Perhaps dev-portage@ can help us diagnose/workaround. Reassigning.
Comment 15 Zac Medico gentoo-dev 2021-05-16 19:40:30 UTC
(In reply to Stuart Shelton from comment #13)
> (In reply to Sergei Trofimovich from comment #10)
> > Let's see if we can figure out where the bug comes from with a bit of
> > speculation.
> 
> To confirm, though, the presence of the '!needed' text in this function and
> in the output I'm seeing does indicate (prove?) that this is where the
> library is being lost - and so the question is now one of "Why does portage
> think a new libm (in this ROOT) is a stale preserved library"?
> 
> As a temporary work-around, is there any variable which can be set or
> function which can be called from an ebuild to disable library-preservation
> checks?

It could be something about the ld.so.conf configuration as mentioned in bug 790461 comment 9.
Comment 16 Zac Medico gentoo-dev 2021-05-16 23:35:56 UTC
(In reply to Stuart Shelton from comment #0)
> I can't find any documentation on how needed/!needed is calculated, but it
> appears that in the case of a ROOT install on aarch64 (but not x64) it is
> causing a necessary shared-object to be removed on installation.

I've checked the code at is looks like maybe it could follow a symlink from a preserved library to an unintended target in node.alt_paths here:

   unlink_list.update(node.alt_paths)

https://github.com/gentoo/portage/blob/portage-3.0.18/lib/portage/dbapi/vartree.py#L3482
Comment 17 Zac Medico gentoo-dev 2021-05-16 23:57:06 UTC
(In reply to Sergei Trofimovich from comment #10)
> I wonder if installing a binary with libm dependency before glibc dependency
> into new ROOT forces portage to record libm as needed library. Does not
> explain much why libc.so(and other libc libs) are affected the same.

A plausible explanation is that someone (not portage) accidentally copied an *existing* preserve_libs_registry file with inappropriate content to ${ROOT}/var/lib/portage/preserved_libs_registry.