Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

[Solved] gcc fails at stage1

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
10 posts • Page 1 of 1
Author
Message
Nima0908
Tux's lil' helper
Tux's lil' helper
Posts: 100
Joined: Mon Feb 24, 2025 7:47 pm

[Solved] gcc fails at stage1

  • Quote

Post by Nima0908 » Mon Mar 30, 2026 1:31 pm

Hello,
when trying to install gcc to bootstrap rust[mrustc-bootstrap] it fails at stage1. Iam on a musl/llvm setup.

build.log:
https://paste.c-net.org/BernieSections

config.log:
https://paste.c-net.org/NonsenseRustle

Code: Select all

!!! No gcc found. You probably need to 'source /etc/profile'
!!! to update the environment of this terminal and possibly
!!! other terminals also.
Portage 3.0.77 (python 3.13.11-final-0, default/linux/amd64/23.0/musl/llvm, [unavailable], musl-1.2.5-r8, 6.18.18-gentoo x86_64)
=================================================================
System uname: Linux-6.18.18-gentoo-x86_64-Intel-R-_Core-TM-_i7-7700_CPU_@_3.60GHz-with-libc
KiB Mem:    16282856 total,   1821832 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of repository gentoo: Mon, 30 Mar 2026 12:15:00 +0000
Head commit of repository gentoo: 10d04d59759526249c02c8384d3207deeb998080
Timestamp of repository guru: Mon, 30 Mar 2026 11:31:41 +0000
Head commit of repository guru: 49092c31d230cf8bdfd841d3350872dc0d59b020

Head commit of repository librewolf: 2387fc6f0b5cac40fd1ed2682152ce4fe2902f9b

sh bash 5.3_p9
ld LLD 21.1.8 (compatible with GNU linkers)
app-misc/pax-utils:        1.3.10::gentoo
app-shells/bash:           5.3_p9::gentoo
dev-build/autoconf:        2.72-r6::gentoo
dev-build/automake:        1.18.1::gentoo
dev-build/cmake:           4.1.4::gentoo
dev-build/libtool:         2.5.4::gentoo
dev-build/make:            4.4.1-r102::gentoo
dev-build/meson:           1.9.2::gentoo
dev-lang/perl:             5.42.0-r1::gentoo
dev-lang/python:           3.13.11::gentoo, 3.14.2::gentoo
dev-lang/rust:             1.92.0_p1-r1::gentoo
llvm-core/clang:           18.1.8-r7::gentoo, 21.1.8::gentoo
llvm-core/lld:             18.1.8::gentoo, 21.1.8::gentoo
llvm-core/llvm:            18.1.8-r6::gentoo, 21.1.8::gentoo
sys-apps/baselayout:       2.18::gentoo
sys-apps/openrc:           0.63-r1::gentoo
sys-apps/sandbox:          2.46::gentoo
sys-devel/binutils:        2.46.0::gentoo
sys-devel/binutils-config: 5.6::gentoo
sys-devel/gcc-config:      2.12.2::gentoo
sys-kernel/linux-headers:  6.18::gentoo (virtual/os-headers)
sys-libs/musl:             1.2.5-r8::gentoo
Repositories:

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

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

librewolf
    location: /var/db/repos/librewolf
    sync-type: git
    sync-uri: https://codeberg.org/librewolf/gentoo.git
    masters: gentoo
    volatile: False

Binary Repositories:

gentoo
    location: /var/cache/binhost/gentoo
    priority: 1
    sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64_musl_llvm
    verify-signature: True

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE @FREE @BINARY-REDISTRIBUTABLE"
ADDR2LINE="llvm-addr2line"
AR="llvm-ar"
AS="clang -c"
CBUILD="x86_64-pc-linux-musl"
CC="clang"
CFLAGS="-O2 -pipe "
CHOST="x86_64-pc-linux-musl"
CONFIG_PROTECT="/etc"
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"
CPP="clang-cpp"
CXX="clang++"
CXXFLAGS="-O2 -pipe "
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=8"
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 compress-index config-protect-if-modified distlocks ebuild-locks 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 unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe "
GENTOO_MIRRORS="https://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/     http://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/     rsync://mirror.eu.oneandone.net/gentoo/     https://de.mirrors.cicku.me/gentoo/     http://de.mirrors.cicku.me/gentoo/     https://mirror.dogado.de/gentoo     http://ftp.agdsn.de/gentoo     https://ftp.agdsn.de/gentoo     rsync://ftp.agdsn.de/gentoo     https://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/     http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/     rsync://ftp.spline.inf.fu-berlin.de/gentoo-distfiles/     https://ftp.gwdg.de/pub/linux/gentoo/     http://ftp.gwdg.de/pub/linux/gentoo/     ftp://ftp.gwdg.de/pub/linux/gentoo/     rsync://ftp.gwdg.de/gentoo/     https://gentoo.kurdy.org/     rsync://kurdy.org/gentoo     https://ftp.uni-hannover.de/gentoo/     http://ftp.uni-hannover.de/gentoo/     ftp://ftp.uni-hannover.de/gentoo/     ftp://mirror.netcologne.de/gentoo/     https://mirror.netcologne.de/gentoo/     http://mirror.netcologne.de/gentoo/     rsync://mirror.netcologne.de/gentoo/     https://mirror.netzwerge.de/gentoo/     http://mirror.netzwerge.de/gentoo/     rsync://mirror.netzwerge.de/gentoo     https://oberon.de.ext.planetunix.net/pub/gentoo/     http://oberon.de.ext.planetunix.net/pub/gentoo/     ftp://oberon.de.ext.planetunix.net/pub/gentoo/     rsync://oberon.de.ext.planetunix.net/gentoo/     https://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/     http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/     ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/     rsync://linux.rz.ruhr-uni-bochum.de/gentoo     https://ftp.halifax.rwth-aachen.de/gentoo/     http://ftp.halifax.rwth-aachen.de/gentoo/     ftp://ftp.halifax.rwth-aachen.de/gentoo/     rsync://ftp.halifax.rwth-aachen.de/gentoo/     https://ftp.tu-ilmenau.de/mirror/gentoo/     http://ftp.tu-ilmenau.de/mirror/gentoo/     rsync://ftp.tu-ilmenau.de/gentoo/     https://ftp.fau.de/gentoo     http://ftp.fau.de/gentoo     ftp://ftp.fau.de/gentoo     rsync://ftp.fau.de/gentoo     https://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/     http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/     ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/     rsync://ftp-stud.hs-esslingen.de/gentoo/     https://ftp.uni-stuttgart.de/gentoo-distfiles/     http://ftp.uni-stuttgart.de/gentoo-distfiles/"
INSTALL_MASK="charset.alias /usr/share/locale/locale.alias"
LANG="C.UTF-8"
LD="ld.lld"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--as-needed"
LEX="flex"
MAKEOPTS="-j8 -l8"
NM="llvm-nm"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
PKGDIR="/var/cache/binpkgs"
PORTAGE_COMPRESS="bzip2"
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"
RUSTFLAGS=" -C target-cpu=native -C target-feature=-crt-static -C prefer-dynamic -C relocation-model=pic"
SHELL="/bin/bash"
STRINGS="llvm-strings"
STRIP="llvm-strip"
USE="acl amd64 bzip2 cet clang crypt elogind iconv ipv6 libtirpc llvm-libunwind lto ncurses nls openmp pam pcre pic pipewire readline seccomp sound-server ssl test-rust unicode vulkan wayland xattr zlib" ABI_X86="64" ADA_TARGET="gcc_15" 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 aes avx avx2 bmi1 bmi2 f16c fma3 pclmul popcnt rdrand sse3 sse4_1 sse4_2 ssse3" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oncore skytraq superstar2 tsip tripmate tnt" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="de" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-3" POSTGRES_TARGETS="postgres17" PYTHON_SINGLE_TARGET="python3_13" PYTHON_TARGETS="python3_13" RUBY_TARGETS="ruby32 ruby33" VIDEO_CARDS="nouveau nvk zink" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, SIZE, YACC, YFLAGS
Please dont be confused about the rustflags, i have rust installed but nuked the builtin libc.a because it causes issues with mesa. I already had gcc installed once here to bootstrap rust the first time with rust-bin and it worked flawlessly (after commenting out -march and -mtune because it causes issues at stage 3 (i think it was stage 3)).

Thank your for your help.
Last edited by Nima0908 on Mon Mar 30, 2026 7:14 pm, edited 1 time in total.
Top
Hu
Administrator
Administrator
Posts: 24386
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Mon Mar 30, 2026 2:21 pm

According to your build log, clang does not understand --64 as an argument, but something is invoking clang with that argument. This looks strange, since the build appears to be trying to run a just-built gcc.
Top
Nima0908
Tux's lil' helper
Tux's lil' helper
Posts: 100
Joined: Mon Feb 24, 2025 7:47 pm

  • Quote

Post by Nima0908 » Mon Mar 30, 2026 2:59 pm

Weird. I noticed --64 too but i have no clue whats up with that. I originally thought that it was because i removed the gcc integration file in the clang conf but this doesnt really look like that issue.
Here is also how i try to install it, maybe that helps:

Code: Select all

marius@gentoo ~ $ sudo emerge -av1t =sys-devel/gcc-15.2.1_p20260214

 * IMPORTANT: 1 news items need reading for repository 'librewolf'.
 * IMPORTANT: 6 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
Dependency resolution took 3.49 s (backtrack: 0/20).

[blocks b      ] sys-devel/gcc ("sys-devel/gcc" is soft blocking llvm-runtimes/libatomic-stub-0)
[uninstall     ]  llvm-runtimes/libatomic-stub-0::gentoo
[ebuild  N     ] sys-devel/gcc-15.2.1_p20260214:15::gentoo  USE="(cxx) (default-stack-clash-protection) (default-znow) fortran lto openmp (pie) sanitize ssp zstd -ada (-cet) -cobol (-custom-cflags) -d -debug -doc (-fixed-point) -go -graphite -hardened (-ieee-long-double) -jit -libgdiagnostics (-libssp) -modula2 (-multilib) (-nls) -objc -objc++ -objc-gc (-pch) -pgo -rust (-systemtap) -test (-time64) -valgrind -vanilla (-vtv)" 0 KiB

Total: 1 package (1 new, 1 uninstall), Size of downloads: 0 KiB
Conflict: 1 block (all satisfied)

Would you like to merge these packages? [Yes/No]
and the make.conf:

Code: Select all

COMMON_FLAGS="-O2 -pipe "
#-march=native -mtune=native"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
RUSTFLAGS="${RUSTFLAGS} -C target-cpu=native -C target-feature=-crt-static -C prefer-dynami>

USE="-X wayland vulkan lto pipewire elogind -systemd sound-server"

L10N="de"
#LLVM_SLOT="21"
VIDEO_CARDS="nouveau nvk zink"
ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE"
MAKEOPTS="-j8 -l8"
EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=8"

CHOST="x86_64-pc-linux-musl"

LC_MESSAGES=C.UTF-8
The -march=native -mtune=native part is just commented out because of the previously mentionen stage3 issue. At the end of make.conf there is still the mirror conf but it would just clutter this and not provide any usefull information, so i removed it from the message. If there is any more information i could provide to pinpoint the issue, please let me know ill make sure to send it as soon as possible. THank you for your answer :)
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2180
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Mon Mar 30, 2026 3:10 pm

Hu wrote:According to your build log, clang does not understand --64 as an argument, but something is invoking clang with that argument. This looks strange, since the build appears to be trying to run a just-built gcc.
from OP's post
when trying to install gcc ...
and
!!! No gcc found. You probably need to 'source /etc/profile'
!!! to update the environment of this terminal and possibly
!!! other terminals also.
Portage 3.0.77 (python 3.13.11-final-0, default/linux/amd64/23.0/musl/llvm, [unavailable], musl-1.2.5-r8, 6.18.18-gentoo x86_64)
...[/code]
I suspect the system does not have Gcc prior to this build, and the gcc/cc/... were alias (link, symbolic or hard) to clang.
Top
Hu
Administrator
Administrator
Posts: 24386
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Mon Mar 30, 2026 3:19 pm

From OP's config.log:

Code: Select all

configure:3579: /var/tmp/portage/sys-devel/gcc-15.2.1_p20260214/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-15.2.1_p20260214/work/build/./gcc/ -B/usr/x86_64-pc-linux-musl/bin/ -B/usr/x86_64-pc-linux-musl/lib/ -isystem /usr/x86_64-pc-linux-musl/include -isystem /usr/x86_64-pc-linux-musl/sys-include   -fno-checking -o conftest -g -pipe -O2  -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--as-needed conftest.c  >&5
clang: error: unknown argument: '--64'
clang: error: no input files
Thus, the build system ran the just-built, and not yet even installed gcc, and did so by a qualified path. That gcc then ran something that ultimately ran clang with arguments that are meant for GNU as. I suspect OP has done something weird to the system. OP: what is the output of as --version; type as?
Top
sam_
Developer
Developer
User avatar
Posts: 2816
Joined: Fri Aug 14, 2020 12:33 am

  • Quote

Post by sam_ » Mon Mar 30, 2026 3:40 pm

toolchain.eclass depends on binutils to avoid this problem. It might be that unsetting AS or something is required, but I thought that when I tested it (some time ago), having binutils installed was sufficient. There's some story there you can see in git log, but it's not trivial to get it working w/ Clang's builtin assembler.
Top
Nima0908
Tux's lil' helper
Tux's lil' helper
Posts: 100
Joined: Mon Feb 24, 2025 7:47 pm

  • Quote

Post by Nima0908 » Mon Mar 30, 2026 4:44 pm

the outpus of as --version; type as:

Code: Select all

marius@gentoo ~ $ as --version; type as
bash: as: command not found
bash: type: as: not found
binutils is installed though, so iam a bit confused about this. Ill try rebuilding it, maybe thatll fix it (update: it didnt fiy it, there still is no as).
I suspect the system does not have Gcc prior to this build, and the gcc/cc/... were alias (link, symbolic or hard) to clang.
I had it previously for a very short time to bootstrap rust, then i depcleaned it because it was no longer needed.
It might be that unsetting AS or something is required, but I thought that when I tested it (some time ago), having binutils installed was sufficient.
Last time i installed it, i only had to remove -march=native -mtune=native as its only invoked at stage3 and because of that it differs from stage2 so the check fails and it doesnt build (if i remember correctly). Adding a stage4 would fix this but for now, unsetting march and mtune is the only way.
Top
sam_
Developer
Developer
User avatar
Posts: 2816
Joined: Fri Aug 14, 2020 12:33 am

  • Quote

Post by sam_ » Mon Mar 30, 2026 4:59 pm

binutils-config latest && . /etc/profile
Top
Nima0908
Tux's lil' helper
Tux's lil' helper
Posts: 100
Joined: Mon Feb 24, 2025 7:47 pm

  • Quote

Post by Nima0908 » Mon Mar 30, 2026 5:06 pm

Thank you very much, this fixed the as issue. I dont use gcc very often, so i completely forgot that.
Top
Nima0908
Tux's lil' helper
Tux's lil' helper
Posts: 100
Joined: Mon Feb 24, 2025 7:47 pm

  • Quote

Post by Nima0908 » Mon Mar 30, 2026 7:14 pm

After doing this, it compiled fine. Thank you very much
Top
Post Reply

10 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic