Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Failure to build dev-lang/rust on amd64-musl-llvm
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
JaWie
n00b
n00b


Joined: 03 Apr 2025
Posts: 5

PostPosted: Sun Jun 08, 2025 11:44 am    Post subject: [Solved] Failure to build dev-lang/rust on amd64-musl-llvm Reply with quote

Hi! I tried to emerge X.org, but unfortunately there is rust in the full dependency tree and it prevents me from achieving the goal. Since some bootstraping compiler is required to even start with rust, I decided to use dev-lang/mrustc. At first, I had problems emerging it as well, due to it requiring being built using GCC, even though it successfully pulled GCC as a dependency. I eventually came across a post on Reddit:
WaterFoxforlife wrote:

Code:
emerge gcc


then edit
Code:
/var/db/repos/gentoo/dev-lang/mrustc/mrustc-0.11.2.ebuild

replace it with this modified one:
Code:
https://pastebin.com/M9h1dAr3


replace
Code:
/var/db/repos/gentoo/dev-lang/rust/rust-1.74.1-r101.ebuild


with this:
Code:
https://pastebin.com/6YxwW4yU


Make a
Code:
/etc/portage/env/mrustc.conf
file

Code:
CC="/usr/bin/x86_64-pc-linux-musl-gcc"
CXX="clang++"
CFLAGS="${COMMON_FLAGS} -O3"


Afterwards, write

Code:
dev-lang/mrustc mrustc.conf
dev-lang/rust mrustc.conf


in
Code:
/etc/portage/package.env
.

Run

Code:
USE=mrustc-bootstrap emerge -v --oneshot dev-lang/rust:1.74.1

After it's done you have a working dev-lang/rust to compile the next versions

to do that you'll first have to remove

Code:
dev-lang/rust mrustc.conf

from
Code:
/etc/portage/package.env


Then FINALLY

Code:
emerge -v dev-lang/rust
emerge --depclean


EDIT: Just remembered I had to make an env to get gcc builds working

In case for you too, emerging gcc didn't work, add a
Code:
/etc/portage/env/disable_gcc_bootstrap.conf
file with

Code:
EXTRA_ECONF="--disable-bootstrap"


inside it and then add this to
Code:
/etc/portage/package.env


Code:
sys-devel/gcc disable_gcc_bootstrap.conf

& emerge gcc

Tell me if something doesn't work

And one of the follow-ups says:
ErikashiKai wrote:
So today i bootstrapped rust with mrust and discovered you don't need the modified ebuild anymore just the env.

So I just created the file
Code:
/etc/portage/env/mrustc.conf
, modified
Code:
/etc/portage/package.env
and ran emerge. dev-lang/mrustc emerged fine, however dev-lang/rust-1.74.1-r101 keeps failing at some point of the build process. I tried to search for the error messages, but found nothing. If anyone has any idea what could be wrong here, I'll highly appreciate any help! I uploaded the contents of build.log, the output of emerge --info '=dev-lang/rust-1.74.1-r101::gentoo' and the output of emerge -pqv '=dev-lang/rust-1.74.1-r101::gentoo'.

Last edited by JaWie on Tue Jun 17, 2025 12:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 4123
Location: Rasi, Finland

PostPosted: Mon Jun 09, 2025 8:50 am    Post subject: Reply with quote

Hi. I use the same profile on one of my systems.

Code:
/usr/lib/gcc/x86_64-pc-linux-musl/14/../../../../x86_64-pc-linux-musl/bin/ld: unrecognized option '--color-diagnostics'
Looks like the build process tries to pass that option to musl ld.

I didn't use mrustc, but bluntly used rust-bin to build rust.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
JaWie
n00b
n00b


Joined: 03 Apr 2025
Posts: 5

PostPosted: Tue Jun 17, 2025 12:21 pm    Post subject: Reply with quote

Hi Zucca. I'm sorry for late reply, but updating @world took a few days, since it pulled a new clang version. Your solution is much better than using dev-lang/mrustc, as the latter requires one to then build every subsequent dev-lang/rust version starting from 1.74.1-r101. Meanwhile, after unmasking a chosen dev-lang/rust-bin version, Portage doesn't seem to even force an update unless some ebuild explicitly requires a newer one. At first I even pulled dev-lang/rust-bin-1.86.0-r1 and then tried to emerge dev-lang/rust-1.87.0-r1, but the build process failed. I ended replacing that with dev-lang/rust-bin-1.87.0 for now. It might've actually happened due to my initial RUSTFLAGS, which I eventually adjusted after building an unusable dev-util/bindgen (which I had to remove and reemerge after RUSTFLAGS changes - has been working fine so far), but I'll maybe test that again after 1.88 becomes stable. So thank you for your advice!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



OSZAR »