Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 719330 - sys-libs/musl: faulty ldconfig script causes sandbox access violation in sys-libs/ncurses-6.2-r1
Summary: sys-libs/musl: faulty ldconfig script causes sandbox access violation in sys-...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Gentoo musl team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-04-25 02:14 UTC by Alec Ari
Modified: 2021-11-22 12:18 UTC (History)
9 users (show)

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


Attachments
emerge --info (emerge_info.txt,5.65 KB, text/plain)
2020-04-25 02:17 UTC, Alec Ari
Details
sys-libs/ncurses build.log (ncurses_build.log,39.54 KB, text/x-log)
2020-04-25 02:19 UTC, Alec Ari
Details
make.conf (make.conf,1.62 KB, text/plain)
2020-04-25 02:21 UTC, Alec Ari
Details
build.log (clean_build.log.bz2,67.27 KB, application/x-bzip2)
2020-04-26 13:00 UTC, Jory A. Pratt
Details
build.log (ncurses-6.2-build.log.bz2,25.97 KB, application/x-bzip)
2020-04-27 13:51 UTC, Michael 'veremitz' Everitt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Ari 2020-04-25 02:14:52 UTC
sys-libs/ncurses fails to build due to an access violation while "checking for linker search path."



Reproducible: Always

Steps to Reproduce:
I'm using musl, not sure if this is the problem.

1. USE="-cxx" emerge -av sys-libs/ncurses
2. Wait
Actual Results:  
checking for linker search path...
* ACCESS DENIED:  rename:       /etc/ld-musl-x86_64.path
* ACCESS DENIED:  rename:       /etc/ld-musl-x86_64.path
/usr/lib /lib

Expected Results:  
Not have an access violation

Using musl
Comment 1 Alec Ari 2020-04-25 02:17:59 UTC
Created attachment 634454 [details]
emerge --info
Comment 2 Alec Ari 2020-04-25 02:19:33 UTC
Created attachment 634456 [details]
sys-libs/ncurses build.log
Comment 3 Alec Ari 2020-04-25 02:21:24 UTC
Created attachment 634460 [details]
make.conf

I tried replacing lld with the default gold ld linker and switched from clang to GCC, still the same problem.
Comment 4 Mike Gilbert gentoo-dev 2020-04-26 05:10:41 UTC
The configure script calls ldconfig with various options.

On glibc, it stops after calling "ldconfig -NX -v" which succeeds and simply outputs some information.

The version of ldconfig we install for musl doesn't understand the "-N" option, so the call fails. The configure script then calls "ldconfig -v", which attempts to regenerate /etc/ld-musl-x86_64.path.

I'm going to blame this one on the incomplete implementation of ldconfig provided by our musl ebuild.
Comment 5 Mike Gilbert gentoo-dev 2020-04-26 05:17:25 UTC
(In reply to Alec Ari from comment #3)
> I tried replacing lld with the default gold ld linker and switched from
> clang to GCC, still the same problem.

What does "ld --verbose | grep SEARCH_DIR" output?
Comment 6 Jory A. Pratt gentoo-dev 2020-04-26 12:57:05 UTC
(In reply to Mike Gilbert from comment #5)
> (In reply to Alec Ari from comment #3)
> > I tried replacing lld with the default gold ld linker and switched from
> > clang to GCC, still the same problem.
> 
> What does "ld --verbose | grep SEARCH_DIR" output?

This entire bug is caused from the improper cflags and ldflags. I am unable to duplicate it.

ld --verbose | grep SEARCH_DIR
SEARCH_DIR("/usr/x86_64-gentoo-linux-musl/lib64"); SEARCH_DIR("/usr/lib/binutils/x86_64-gentoo-linux-musl/2.33.164"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DI ("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/x86_64-gentoo-linux-musl/lib"); SEARCH_DIR("/usr/lib/binutils/x86_64-gentoo-linux-musl/2.33.1"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");

I will go ahead and provide a full build.log as well.
Comment 7 Jory A. Pratt gentoo-dev 2020-04-26 13:00:33 UTC
Created attachment 634650 [details]
build.log

Portage 2.3.89 (python 3.6.10-final-0, default/linux/amd64/17.0/musl/hardened, gcc-9.2.0, musl-1.1.24, 5.5.13-zen1-musl x86_64)
=================================================================
System uname: Linux-5.5.13-zen1-musl-x86_64-Intel-R-_Core-TM-_i5-3320M_CPU_@_2.60GHz-with-gentoo-2.6
KiB Mem:     7968576 total,   4553556 free
KiB Swap:    5242876 total,   5202428 free
Head commit of repository gentoo: 635fb26aa677a757d37401e555024585c6209827

Head commit of repository anarchy: 9f172cc3b3426b235784b93c1451e6d2b14a5b81

Head commit of repository musl: d56571623d6ce56e3e7d4ba8782f8a2f229754b0

Head commit of repository smaeul: 84419a24b8337db6852b994780a4f34cfd4e7377

sh dash 0.5.9.1-r3
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
distcc 3.3.3 x86_64-gentoo-linux-musl [disabled]
ccache version 3.7.7 [enabled]
app-shells/bash:          4.4_p23-r1::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.18::gentoo, 3.6.10-r2::gentoo, 3.7.7-r2::gentoo, 3.8.2-r2::gentoo
dev-util/ccache:          3.7.7-r1::gentoo
dev-util/cmake:           3.16.5::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.13::musl
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.33.1-r1::musl
sys-devel/gcc:            9.2.0-r3::musl
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4::gentoo (virtual/os-headers)
sys-libs/musl:            1.1.24::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: git+ssh://git@git.gentoo.org/repo/gentoo.git
    priority: -1000

anarchy
    location: /var/db/repos/anarchy
    sync-type: git
    sync-uri: git+ssh://git@git.gentoo.org/dev/anarchy.git
    masters: gentoo

musl
    location: /var/db/repos/musl
    sync-type: git
    sync-uri: git+ssh://git@git.gentoo.org/proj/musl.git
    masters: gentoo

smaeul
    location: /var/db/repos/smaeul
    sync-type: git
    sync-uri: https://github.com/smaeul/portage-overlay
    masters: gentoo

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    priority: 10

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-O2 -march=native -fstack-protector-all -pipe"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/lib/libreoffice/program/sofficerc /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="-O2 -march=native -fstack-protector-all -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=y --autounmask-keep-masks"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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="-O2 -march=native -fstack-protector-all -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=native -fstack-protector-all -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="charset.alias locale.alias /usr/lib/modules-load.d"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,-z,text"
MAKEOPTS="-j5 --no-print-directory -l4"
PKGDIR="/var/cache/binpkgs"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-z -9 -f -S .xz"
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"
USE="X aac alsa amd64 bluetooth bzip2 cairo cdio cgroups crypt cups cxx dbus dri dri3 elogind ffmpeg gtk gtk3 hardened iconv icu introspection ipv6 jpeg libcanberra libressl libsecret libtirpc lzma mp3 ncurses nptl opengl openmp pam pcre pdf pic pie png policykit postproc pulseaudio readline seccomp spell split-usr sqlite ssh ssl ssp theora threads tiff truetype udev udisks unicode upower vaapi vpx x264 xattr xcb xinerama xtpax xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel" 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 f16c mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="libressl" ELIBC="musl" 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 synaptics" KERNEL="linux" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF X86" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="aarch64 arm x86_64" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="i965 intel" 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, LANG, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS

Just for completeness :)
Comment 8 Anthony Basile gentoo-dev 2020-04-27 12:58:08 UTC
(In reply to Mike Gilbert from comment #4)
> The configure script calls ldconfig with various options.
> 
> On glibc, it stops after calling "ldconfig -NX -v" which succeeds and simply
> outputs some information.
> 
> The version of ldconfig we install for musl doesn't understand the "-N"
> option, so the call fails. The configure script then calls "ldconfig -v",
> which attempts to regenerate /etc/ld-musl-x86_64.path.
> 
> I'm going to blame this one on the incomplete implementation of ldconfig
> provided by our musl ebuild.

Maybe, we don't need to rebuild the cache on musl since there is not equivalent of ld.so.cache.

@Alec Ari.  Can you edit `/sbin/ldconfig` and just comment out line 41.  In context, that's in the switch statement which parses the command line opts.  Tell me if this fixes the issue.


                n|N|C|p)
                        echo "Unimplemented option: -$opt" >&2
                        exit 1
                        ;;
Comment 9 Michael 'veremitz' Everitt 2020-04-27 13:35:14 UTC
This looks all kinds of wrong. The configure tests as run standalone are fine, the ldconfig in gentoo's musl looks innocuous enough, so this is a 'feature' of sandbox? or a conflict between that and upstream's configure....

I can't presently identify where this rename is being called from, but I shall investigate further....
Comment 10 Michael 'veremitz' Everitt 2020-04-27 13:51:49 UTC
Created attachment 634864 [details]
build.log

Portage 2.3.79 (python 3.6.5-final-0, default/linux/amd64/17.0/musl/hardened, gcc-8.3.0, musl-1.1.22-r1, 4.9.162-mje-ck1 x86_64)
=================================================================
System uname: Linux-4.9.162-mje-ck1-x86_64-Intel_Xeon_E3-12xx_v2_-Ivy_Bridge-with-gentoo-2.6
KiB Mem:     2054368 total,   1182680 free
KiB Swap:    5242876 total,   5171332 free
Timestamp of repository gentoo: Wed, 15 Jan 2020 03:30:01 +0000
Head commit of repository gentoo: 4f84e4ab7a18343834b6f9a6966412d37df3b05a
sh dash 0.5.9.1-r3
ld GNU ld (Gentoo 2.32 p2) 2.32.0
ccache version 3.7.2 [enabled]
app-shells/bash:          4.4_p23-r1::gentoo
dev-lang/perl:            5.28.2-r1::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/ccache:          3.7.2::gentoo
dev-util/cmake:           3.14.6::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.13::musl
sys-devel/autoconf:       2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            8.2.0-r6::musl, 8.3.0-r1::gentoo, 9.2.0-r3::musl
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.14-r1::musl (virtual/os-headers)
sys-libs/musl:            1.1.22-r1::mjeveritt
Repositories:

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

crossdev
    location: /usr/local/portage.crossdev
    masters: gentoo

mjeveritt
    location: /usr/local/portage.mjeveritt
    masters: gentoo

musl
    location: /var/lib/layman/musl
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/proj/musl.git
    masters: gentoo
    priority: 50

mv
    location: /var/lib/layman/mv
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/user/mv.git
    masters: gentoo
    priority: 50

ABI="amd64"
ABI_X86="64"
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
ACCEPT_PROPERTIES="*"
ACCEPT_RESTRICT="*"
ADA_TARGET="gnat_2018"
ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"
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="amd64"
AUTOCLEAN="yes"
BOOTSTRAP_USE="unicode internal-glib pkg-config split-usr python_targets_python3_6 python_targets_python2_7 multilib nptl -berkdb -gdbm hardened pic xtpax -jit -orc"
BROOT=""
CALLIGRA_FEATURES="karbon sheets words"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-O2 -pipe -mtune=ivybridge"
CFLAGS_amd64="-m64"
CFLAGS_x32="-mx32"
CFLAGS_x86="-m32"
CHOST="x86_64-gentoo-linux-musl"
CHOST_amd64="x86_64-gentoo-linux-musl"
CHOST_x32="x86_64-pc-linux-gnux32"
CHOST_x86="i686-pc-linux-gnu"
CLEAN_DELAY="5"
COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
COLLISION_IGNORE="/lib/modules/*"
COMMON_FLAGS="-O2 -pipe -mtune=ivybridge"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/spool/munin-async/.ssh"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CPU_FLAGS_X86="mmx mmxext sse sse2"
CXXFLAGS="-O2 -pipe -mtune=ivybridge"
DEFAULT_ABI="amd64"
DISTDIR="/usr/portage/distfiles"
EDITOR="/bin/nano"
ELIBC="musl"
EMERGE_DEFAULT_OPTS="--ask --verbose --autounmask=n"
EMERGE_WARNING_DELAY="10"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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 -mtune=ivybridge"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs candy ccache config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict 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 -mtune=ivybridge"
GCC_SPECS=""
GENTOO_MIRRORS="https://mirror.netcologne.de/gentoo/"
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=""
GSETTINGS_BACKEND="dconf"
HOME="/root"
INFOPATH="/usr/share/gcc-data/x86_64-gentoo-linux-musl/8.3.0/info:/usr/share/binutils-data/x86_64-gentoo-linux-musl/2.32/info:/usr/share/info"
INPUT_DEVICES="libinput keyboard mouse"
INSTALL_MASK="charset.alias /lib/systemd /usr/lib/systemd /etc/systemd"
IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest prefix-stack"
KERNEL="linux"
LANG="en_GB.utf8"
LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
LC_CTYPE="en_GB.UTF-8"
LC_MESSAGES="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LDFLAGS_amd64="-m elf_x86_64"
LDFLAGS_x32="-m elf32_x86_64"
LDFLAGS_x86="-m elf_i386"
LESS="-R -M --shift 5"
LESSOPEN="|lesspipe %s"
LIBDIR_amd64="lib"
LIBDIR_x32="libx32"
LIBDIR_x86="lib32"
LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"
LOGNAME="root"
LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.cfg=00;32:*.conf=00;32:*.diff=00;32:*.doc=00;32:*.ini=00;32:*.log=00;32:*.patch=00;32:*.pdf=00;32:*.ps=00;32:*.tex=00;32:*.txt=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"
MAIL="/var/mail/root"
MAKEOPTS="-j4"
MANPAGER="manpager"
MANPATH="/usr/share/gcc-data/x86_64-gentoo-linux-musl/8.3.0/man:/usr/share/binutils-data/x86_64-gentoo-linux-musl/2.32/man:/usr/local/share/man:/usr/share/man"
MULTILIB_ABIS="amd64"
MULTILIB_STRICT_DENY="64-bit.*shared object"
MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"
MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec|llvm)"
NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
NOCOLOR="true"
OFFICE_IMPLEMENTATION="libreoffice"
OLDPWD="/root"
OPENGL_PROFILE="xorg-x11"
PAGER="/usr/bin/less"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin"
PAX_MARKINGS="none"
PHP_TARGETS="php7-2"
PKGDIR="/usr/portage/packages"
PORTAGE_ARCHLIST="alpha amd64 amd64-linux arm arm-linux arm64 arm64-linux hppa ia64 m68k m68k-mint mips ppc ppc-aix ppc-macos ppc64 ppc64-linux riscv s390 sh sparc sparc-solaris sparc64-solaris x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-linux x86-macos x86-solaris x86-winnt"
PORTAGE_BIN_PATH="/usr/lib/portage/python3.6"
PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"
PORTAGE_CONFIGROOT="/"
PORTAGE_DEBUG="0"
PORTAGE_DEPCACHEDIR="/var/cache/edb/dep"
PORTAGE_ELOG_CLASSES="log warn error"
PORTAGE_ELOG_MAILFROM="portage@localhost"
PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for ${PACKAGE} on ${HOST}"
PORTAGE_ELOG_MAILURI="root"
PORTAGE_ELOG_SYSTEM="save_summary:log,warn,error,qa echo"
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_LIBC="musl"
PORTAGE_LOGDIR_CLEAN="find "${PORTAGE_LOGDIR}" -type f ! -name "summary.log*" -mtime +7 -delete"
PORTAGE_OVERRIDE_EPREFIX=""
PORTAGE_PYM_PATH="/usr/lib/python3.6/site-packages"
PORTAGE_PYTHONPATH="/usr/lib/python3.6/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_IS_HARDENED="1"
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"
PS1="\[\033]0;\u@\h:\w\007\]\[\033[1;34m\][\D{%a-%d-%b %l:%M%p}] \[\033[1;31m\]\u@\h\[\033[0;33m\]:\l:\! \[\033[1;34m\]\w \$\[\033[00m\] "
PWD="/home/michael/repos/gentoo/sys-libs/ncurses"
PYTHONDONTWRITEBYTECODE="1"
PYTHON_SINGLE_TARGET="python3_6"
PYTHON_TARGETS="python2_7 python3_6"
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/rpm"
RUBY_TARGETS="ruby24 ruby25"
SHELL="/bin/bash"
SHLVL="1"
SUDO_COMMAND="/bin/bash"
SUDO_GID="1000"
SUDO_UID="1000"
SUDO_USER="michael"
SYMLINK_LIB="no"
SYSROOT="/"
TERM="xterm-256color"
TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
UNINSTALL_IGNORE="/lib/modules/* /var/run /var/lock"
USE="acl amd64 bzip2 crypt cxx hardened iconv ipv6 libtirpc ncurses nls nptl openmp pam pcre pie readline seccomp split-usr ssl ssp unicode xattr xtpax zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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="mmx mmxext sse sse2" ELIBC="musl" 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 keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy 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"
USER="root"
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 MONKEYD_PLUGINS NETBEANS_MODULES 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_ARM CPU_FLAGS_PPC 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 hppa ia64 m68k m68k-mint mips ppc ppc64 ppc64-linux ppc-aix ppc-macos riscv s390 sh sparc sparc64-solaris sparc-solaris x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos 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="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy 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"
Comment 11 Michael 'veremitz' Everitt 2020-04-27 13:53:00 UTC
I can't reproduce it here either, as previous comment confirms.
Comment 12 Michael 'veremitz' Everitt 2020-04-27 14:00:27 UTC
Try dropping these out of your LDFLAGS and re-try:

"-Wl,-z,now -Wl,-z,relro"
Comment 13 Mike Gilbert gentoo-dev 2020-04-27 14:31:40 UTC
At this point, we need some feedback from the bug reporter to answer questions in comment 5 and comment 8.
Comment 14 Michael 'veremitz' Everitt 2020-04-27 14:41:18 UTC
Or am I barking up completely the wrong tree, and ldconfig is somehow reaching https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/musl/files/ldconfig.in#n144 and balking there?
Comment 15 Jory A. Pratt gentoo-dev 2020-04-27 17:59:06 UTC
(In reply to Michael 'veremitz' Everitt from comment #12)
> Try dropping these out of your LDFLAGS and re-try:
> 
> "-Wl,-z,now -Wl,-z,relro"

These are not the problem, passing -fPIC via cflags and LDFLAGS is unsupported for one. There is also no reason for him to be passing CFLAGS to LDFLAGS, he is not using LTO.
Comment 16 Alec Ari 2020-04-27 19:21:25 UTC
Using the gold linker (my default setup)

ld --verbose | grep SEARCH_DIR

ld: fatal error: no input files


Using the bfd linker:

ld.bfd --verbose | grep SEARCH_DIR

SEARCH_DIR("/usr/x86_64-gentoo-linux-musl/lib64"); SEARCH_DIR("/usr/lib/binutils/x86_64-gentoo-linux-musl/2.3464"); SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/x86_64-gentoo-linux-musl/lib"); SEARCH_DIR("/usr/lib/binutils/x86_64-gentoo-linux-musl/2.34"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");


Using lld:

ld.lld --verbose | grep SEARCH_DIR

ld.lld: error: no input files


I reverted back all the *FLAGS to just -O2 -pipe, left out LDFLAGS completely, rebuilt musl and binutils. I've been using Gentoo for years, even with the -fPIC in there, and never came across a problem like this.

I commented out line 41:

                n|N|C|p)
                        echo "Unimplemented option: -$opt" >&2
                        #exit 1
                        ;;

And it errors out just like before.

Quick test:

ln -sfv /usr/bin/ld.bfd /usr/bin/ld

And the problem goes away.. ncurses just built! So the problem is pointing at the Binutils gold linker! I've been using the gold linker ever since it was introduced into Gentoo and I never had a problem like this either, the only thing I am doing different now is using musl.

Alec
Comment 17 Alec Ari 2020-04-27 19:32:02 UTC
I just symlinked /usr/bin/ld.lld to /usr/bin/ld as another test (since --verbose returned an error) and the access violation happened again.

So the Binutils bfd linker (which I really don't like as it's the slowest alternative) is the only thing I can use to build ncurses.
Comment 18 Mike Gilbert gentoo-dev 2020-04-27 19:38:20 UTC
I don't think we really support changing the /usr/bin/ld symlink; it should always point at ${CHOST}-ld.
Comment 19 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-27 20:47:32 UTC
${CHOST}-ld can also be gold if binutils is built with sys-devel/binutils[default-gold]. I would not rely on specific implementation.

That's what OP's emerge --info has:
> ld GNU gold (Gentoo 2.34 p1 2.34.0) 1.16

That is a reasonable configuration.

I think it's somewhat fine to mess with /usr/bin/ld for small tests (binutils-config used to support it directly). I'd strongly advise not use it for running systems though. Binutils upgrades/switches will mangle it.

Packages that don't support arbitrary linker might want to use 'tc-ld-disable-gold' or equivalent to enforce supported linker. But better fix packages in a more reliable way.

I can reproduce locally the failure in musl stage3 as:
# USE='-cxx default-gold' emerge -v1 binutils sys-libs/ncurses

F: rename
S: deny
P: /etc/ld-musl-x86_64.path
A: /etc/ld-musl-x86_64.path
R: /etc/ld-musl-x86_64.path
C: mv /tmp/ld-musl-x86_64.C2xj09 /etc/ld-musl-x86_64.path
Comment 20 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-27 20:57:09 UTC
https://wiki.musl-libc.org/faq.html#Q:-Where-is-%3Ccode%3Eldconfig%3C/code%3E? says musl systems have no ldconfig.

And inspecting one locally suggests it's a gentoo script:

"""
$ head -n 5 `which /sbin/ldconfig`
#!/bin/bash -e
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

ROOT="/"
...
"""

Gentoo might want to do something about it.

I would suggest something of the following options:
1. change it not to update /etc/ if there is nothing to update
2. remove it completely (will probably require slightly tweaking portage)
Comment 21 Mike Gilbert gentoo-dev 2020-04-27 21:00:22 UTC
(In reply to Sergei Trofimovich from comment #19)

Is there a better way to get the linker search path in a configure script?

https://github.com/mirror/ncurses/commit/ac3f601c4de5d916f410c9ba4918194a47345e84#diff-9ceb48203b3fd0a963276aeb22265658R3863
Comment 22 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-27 21:29:36 UTC
(In reply to Mike Gilbert from comment #21)
> (In reply to Sergei Trofimovich from comment #19)
> 
> Is there a better way to get the linker search path in a configure script?
> 
> https://github.com/mirror/ncurses/commit/
> ac3f601c4de5d916f410c9ba4918194a47345e84#diff-
> 9ceb48203b3fd0a963276aeb22265658R3863

Don't think there is a good way to detect all internal default search paths. Paths differ even across ld.gold/ld.bfd. Nothing should rely on it.

If ncurses just needs library paths overriding then cache variable might be an option. Something like:
    cf_cv_ld_searchpath="${EPREFIX}/usr/$(get_libdir) ${EPREFIX}/$(get_libdir)"

But looking at https://github.com/mirror/ncurses/blob/master/misc/gen-pkgconfig.in#L98 ncurses filters out default -Lpaths from $(libdir). I don't think it's needed. I would say that code should just go away entirely.
Comment 23 Mike Gilbert gentoo-dev 2020-04-27 21:39:31 UTC
(In reply to Sergei Trofimovich from comment #22)
> If ncurses just needs library paths overriding then cache variable might be
> an option. Something like:
>     cf_cv_ld_searchpath="${EPREFIX}/usr/$(get_libdir)
> ${EPREFIX}/$(get_libdir)"

Ah, I didn't notice there was a cache variable we can utilize. Thanks for point it out.
Comment 24 Anthony Basile gentoo-dev 2020-04-27 21:46:40 UTC
(In reply to Sergei Trofimovich from comment #20)
> https://wiki.musl-libc.org/faq.html#Q:-Where-is-%3Ccode%3Eldconfig%3C/
> code%3E? says musl systems have no ldconfig.
> 
> And inspecting one locally suggests it's a gentoo script:
> 
> """
> $ head -n 5 `which /sbin/ldconfig`
> #!/bin/bash -e
> # Copyright 1999-2015 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
> 
> ROOT="/"
> ...
> """
> 
> Gentoo might want to do something about it.
> 
> I would suggest something of the following options:
> 1. change it not to update /etc/ if there is nothing to update
> 2. remove it completely (will probably require slightly tweaking portage)

I wrote the script. 1 sounds like a good idea.  I don't know about 2 though.
Comment 25 Alec Ari 2020-04-28 00:11:36 UTC
Hey everyone,

I just wanted to say thank you all for looking into this and CC'ing this issue to the departments responsible.

@Mike in regards to #18; I understand the method of a forced manual symlink is not supported, a bad idea, and will be wiped out by a re-emerge. The usage of `ln` was only done for a quick one-time only test as Sergei mentioned in #19.

@Sergei, thank you for confirming this failure on your end as well.

Cheers everyone, and good luck on a fix! I'm glad I was able to help!

I have much faith in the Gentoo developers and am sure they will come up with the right solution.

Stay safe everyone, and thanks again for everything.

Alec
Comment 26 Alec Ari 2020-05-13 05:27:33 UTC
FWIW, I added /sbin/ldconfig to INSTALL_MASK (make.conf) then replaced all the contents of /sbin/ldconfig with the one from Alpine Linux, and sys-libs/ncurses built.

When I went to rebuild sys-libs/musl however, the installation failed:

>>> Installing (1 of 1) sys-libs/musl-1.2.0::gentoo
 * ERROR: sys-libs/musl-1.2.0::gentoo failed (postinst phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line 125:  Called pkg_postinst
 *   environment, line 2022:  Called die
 * The specific snippet of code:
 *       ldconfig || die

So I added exit 0 to the very end of /sbin/ldconfig and everything seemed fine.

Then I went one more step further and replaced the entire /sbin/ldconfig file with just "exit 0" and everything actually seems OK!

musl by default uses the library search path:

/lib:/usr/local/lib:/usr/lib

As referenced here:

https://www.musl-libc.org/doc/1.0.0/manual.html

So replacing the entire /sbin/ldconfig with exit 0 satisfies sys-libs/ncurses when it's checking the search path. Just wanted to let you guys know.

For now, until this is fixed in mainline or I encounter a problem, I'm going to be using this configuration. It works for me and gets the job done. I understand this is not supported so I will not be opening any bugs pertaining to this.

Alec
Comment 27 Larry the Git Cow gentoo-dev 2021-11-22 12:18:43 UTC
The bug has been closed via the following commit(s):

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

commit d9a66f3d2030eb59c117cb96296d7a617d757fc1
Author:     Kofi Hannam <meeyou@tuta.io>
AuthorDate: 2021-11-22 11:58:15 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-11-22 11:58:49 +0000

    sys-libs/musl: exit early in ldconfig if nothing has changed
    
    This fixes an access violation when compiling sys-libs/ncurses
    and /usr/bin/ld is not ld.bfd.
    
    Closes: https://bugs.gentoo.org/719330
    Closes: https://github.com/gentoo/gentoo/pull/21939
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Kofi Hannam <meeyou@tuta.io>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-libs/musl/files/ldconfig.in-r1                           | 8 ++++++++
 sys-libs/musl/{musl-1.2.2-r5.ebuild => musl-1.2.2-r6.ebuild} | 0
 2 files changed, 8 insertions(+)