>>> Compiling source in /var/tmp/portage/sys-apps/which-2.23/work/which-2.23 ... make -j24 make all-recursive make[1]: Entering directory '/var/tmp/portage/sys-apps/which-2.23/work/which-2.23' Making all in . make[2]: Entering directory '/var/tmp/portage/sys-apps/which-2.23/work/which-2.23' x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -O2 -pipe -march=native -c -o getopt.o getopt.c x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -O2 -pipe -march=native -c -o getopt1.o getopt1.c x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -O2 -pipe -march=native -c -o bash.o bash.c x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -O2 -pipe -march=native -c -o which.o which.c x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -O2 -pipe -march=native -c -o tilde.o tilde.c In file included from which.c:22: getopt.h:105:12: error: conflicting types for 'getopt'; have 'int(void)' 105 | extern int getopt(); | ^~~~~~ In file included from sys.h:21, from which.c:19: /usr/include/unistd.h:127:5: note: previous declaration of 'getopt' with type 'int(int, char * const*, const char *)' 127 | int getopt(int, char * const [], const char *); | ^~~~~~ make[2]: *** [Makefile:599: which.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[2]: Leaving directory '/var/tmp/portage/sys-apps/which-2.23/work/which-2.23' make[1]: *** [Makefile:819: all-recursive] Error 1 make[1]: Leaving directory '/var/tmp/portage/sys-apps/which-2.23/work/which-2.23' make: *** [Makefile:473: all] Error 2 * ERROR: sys-apps/which-2.23::gentoo failed (compile phase): * emake failed Portage 3.0.68 (python 3.12.10-final-0, default/linux/amd64/23.0/split-usr/musl, gcc-15, musl-1.2.5-r3, 6.13.11-gentoo-x86_64 x86_64) ================================================================= System uname: Linux-6.13.11-gentoo-x86_64-x86_64-AMD_Ryzen_9_5900X_12-Core_Processor-with-libc KiB Mem: 65778008 total, 32713016 free KiB Swap: 20971516 total, 19875124 free sh bash 5.2_p37 ld GNU ld (Gentoo 2.43 p3) 2.43.1 app-misc/pax-utils: 1.3.8::gentoo app-shells/bash: 5.2_p37::gentoo dev-build/autoconf: 2.72-r1::gentoo dev-build/automake: 1.16.5-r2::gentoo, 1.17-r2::gentoo dev-build/cmake: 3.31.6::gentoo dev-build/libtool: 2.5.4::gentoo dev-build/make: 4.4.1-r100::gentoo dev-build/meson: 1.7.2::gentoo dev-lang/perl: 5.40.2::gentoo dev-lang/python: 3.12.10::gentoo, 3.13.3::gentoo sys-apps/baselayout: 2.17::gentoo sys-apps/openrc: 0.62::gentoo sys-apps/sandbox: 2.46::gentoo sys-devel/binutils: 2.43-r2::gentoo, 2.44::gentoo sys-devel/binutils-config: 5.5.2::gentoo sys-devel/gcc: 14.2.1_p20250419::gentoo, 15.1.0::gentoo sys-devel/gcc-config: 2.12.1::gentoo sys-kernel/linux-headers: 6.14::gentoo (virtual/os-headers) sys-libs/musl: 1.2.5-r3::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: True sync-rsync-verify-metamanifest: yes sync-rsync-extra-opts: sync-rsync-verify-max-age: 3 sync-rsync-verify-jobs: 1 Binary Repositories: gentoobinhost priority: 1 sync-uri: https://gentoo.osuosl.org/releases/amd64/binpackages/17.1/x86-64_musl ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-gentoo-linux-musl" CFLAGS="-O2 -pipe -march=native" CHOST="x86_64-gentoo-linux-musl" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe -march=native" DISTDIR="/usr/portage/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 -march=native" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks export-pms-vars fixlafiles ipc-sandbox merge-sync merge-wait network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe -march=native" GENTOO_MIRRORS="http://distfiles.gentoo.org" INSTALL_MASK="charset.alias /usr/share/locale/locale.alias" LANG="C.UTF8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs" LEX="flex" MAKEOPTS="-j24" 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" SHELL="/bin/bash" USE="acl amd64 bzip2 cet crypt iconv ipv6 libtirpc ncurses nls openmp pam pcre pic readline seccomp split-usr ssl test test-rust unicode xattr zlib" ABI_X86="64" ADA_TARGET="gcc_14" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio 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 navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres17" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby32" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
It's musl vs GCC 15 (c23). The getopt version in which is ancient but apparently didn't get update din the latest release either (bug 945958).
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ffee66804b47833aa0f78d9cc764426212094eac commit ffee66804b47833aa0f78d9cc764426212094eac Author: Sam James <sam@gentoo.org> AuthorDate: 2025-04-26 15:00:19 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-04-26 15:00:19 +0000 sys-apps/which: workaround ancient getopt on musl Bug: https://bugs.gentoo.org/945958 Closes: https://bugs.gentoo.org/954755 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/which/which-2.23.ebuild | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)