Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
musl/llvm + rust: chicken & egg, how to bootstrap?
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
Zucca
Moderator
Moderator


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

PostPosted: Thu May 08, 2025 7:47 am    Post subject: musl/llvm + rust: chicken & egg, how to bootstrap? Reply with quote

So... I've set up yet another machine.
This one's gonna be a so called "controller" - it will control some relay boards over serial line.
Because it has only a Celeron N3010 and 8GB RAM, I decided to to play around a little and go with (experimental) musl/llvm toolchain. Fun to experiment at least. This way I can avoid having two compiler sets (llvm+friends + gcc). I try to avoid having lot's of big packages, for now, because:
Code:
sys-kernel/gentoo-kernel-6.6.88: 18 hours, 39 minutes, 13 seconds

However... Eventually I will need rust because of some dependency requirement.

Then problem is that there's no rust-bin for amd64/musl/llvm.
The mrustc doesn't help either as:
Code:
DEPEND="sys-libs/zlib"                                                                                                 
# mrustc transpiles Rust to C, and currently the C code it generates doesn't currently work with clang                 
RDEPEND="                                                                                                             
        ${DEPEND}                                                                                                     
        sys-devel/gcc:*                                                                                               
"                                                                                                                     
BDEPEND="sys-devel/gcc:*"
... I really would like to avoid gcc on this system.

There seems to be no binary packages for rust or mrustc for amd64/musl/llvm either.
It looks like my only option is mrustc via gcc compilation. Correct?

I'll avoid rust for now... But eventually I think I'll need it anyways. Unless llvm project pops out their rust compiler.

Tips, suggestions?
_________________
..: 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
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 2310

PostPosted: Thu May 08, 2025 8:46 am    Post subject: Re: musl/llvm + rust: chicken & egg, how to bootstrap? Reply with quote

Zucca wrote:
So... I've set up yet another machine.
This one's gonna be a so called "controller" - it will control some relay boards over serial line.
Because it has only a Celeron N3010 and 8GB RAM, I decided to to play around a little and go with (experimental) musl/llvm toolchain. Fun to experiment at least. This way I can avoid having two compiler sets (llvm+friends + gcc). I try to avoid having lot's of big packages, for now, because:
Code:
sys-kernel/gentoo-kernel-6.6.88: 18 hours, 39 minutes, 13 seconds

However... Eventually I will need rust because of some dependency requirement.

Then problem is that there's no rust-bin for amd64/musl/llvm.


I think this is actually some error in the profiles I keep meaning to look at. The binary should work. Try unmasking it.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


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

PostPosted: Thu May 08, 2025 6:20 pm    Post subject: Re: musl/llvm + rust: chicken & egg, how to bootstrap? Reply with quote

sam_ wrote:
The binary should work. Try unmasking it.
I assume you mean rust-bin?
Yeah. I've actually unmasked one version...
But I keep getting stuck because
Code:
RDEPEND="
        >=app-eselect/eselect-rust-20190311                                                                           
        dev-libs/openssl                                                                                               
        sys-apps/lsb-release                                                                                           
        sys-devel/gcc:*                                                                                               
        !dev-lang/rust:stable                                                                                         
        !dev-lang/rust-bin:stable                                                                                     
"
... it needs gcc at runtime?
Is this correct? Does it need some gcc provided library?
_________________
..: 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
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 2310

PostPosted: Thu May 08, 2025 6:52 pm    Post subject: Reply with quote

Yes, it needs libgcc* at least.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


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

PostPosted: Thu May 08, 2025 9:00 pm    Post subject: Reply with quote

Dang it. :P

Well... I'll start compiling.
I guess one cannot have gcc-less or llvm-less system... at least not that easily.

I think I read somewhere gcc folks are working on some experimental rust compiler. I wonder what's on the llvm side...
Yes. These two are not comparable as-is, but I'd hope to use only one of them in some cases, instead of having both being part of the regular system.

Anyway. I like experimenting with these not-so-common profiles... I'll see what comes out if this. So far pretty nice, unless one wants rust. But that either isn't impossible. ;)
_________________
..: 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
sam_
Developer
Developer


Joined: 14 Aug 2020
Posts: 2310

PostPosted: Thu May 08, 2025 9:29 pm    Post subject: Reply with quote

rustc is the LLVM side?
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


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

PostPosted: Fri May 09, 2025 8:55 am    Post subject: Reply with quote

Ah. So rustc is an "llvm compiler" like clang? Didn't knew that.
_________________
..: 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
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 506

PostPosted: Fri May 09, 2025 5:05 pm    Post subject: Reply with quote

Yes, rustc uses llvm as its backend.
As far as I know mrustc does not officially support musl/clang systems, but!
If the only dependency on gcc is mrustc, then you'd only need to compile gcc once. Later on you can use rustc and system llvm to compile newer versions of rustc.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


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

PostPosted: Sun May 11, 2025 5:17 pm    Post subject: Reply with quote

bstaletic wrote:
If the only dependency on gcc is mrustc, then you'd only need to compile gcc once. Later on you can use rustc and system llvm to compile newer versions of rustc.
Yes. This is what I hope for.
I'm now back home and I'll continue tinkering with the machine.
_________________
..: 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
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