summaryrefslogtreecommitdiff
path: root/community/gsoc/project_ideas/rust.mdwn
blob: 2e0235a287f61a3526acc03c957823947f819296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
[[!meta copyright="Copyright © 2023 Free Software Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

[[!meta title="Porting Rust"]]

The goal of this project is to make the [Rust
language](https://www.rust-lang.org/) available on GNU/Hurd.

Presumably less work will be needed on the language's frontend itself, but
rather on the supporting libraries.


The Rust language is being used more and more widely, and notably in
rather fundamental libraries such as librsvg or python-cryptography. It
is thus more and more pressing for GNU/Hurd to have a compiler for Rust.

The Rust compiler itself is quite portable, but its runtime library, libstd,
needs to be ported to the GNU/Hurd system. This essentially consists in telling
Rust how the standard C library functions can be called, i.e. the C ABI.

There as an [initial attempt against rustc 1.30](https://people.debian.org/~sthibault/hurd-i386/rustc-1.30-patch) that was enough to get rustc
to crossbuild, but it was missing most of what libstd needs. It is most probably
very outdated nowadays, but that gives an idea.

An example of the main part of the libstd port can be seen for the [VxWorks
port](https://github.com/rust-lang/libc/blob/master/src/vxworks/mod.rs)

The bulk of such a file can be mostly generated from the libc C
headers thanks to the bindgen tool, it then needs to be cleaned up and
integrated into the Rust build infrastructure, some preliminary work had
already been investigated in that part.

A good level of C programming will be welcome to understand the
questions of ABI and the libc C functions being bound.

Knowing the Rust language is not required: it can be learnt along the
way, this can be a good occasion.

Possible mentors: [[Samuel Thibault (youpi)|samuelthibault]] samuel.thibault@gnu.org

For somebody who has already a very good level of C programming and good Rust
programming skills, this can probably be a 175-hour project. Otherwise it will
be a good occasion to learn, and can then be a 350-hour project.

It is expected to be of medium difficulty: a fair part of the port is about
mimicing other ports. Deciding how to mimic can be discussed with the community
anyway. The other part is about expressing the C ABI. This requires to properly
understand what that means, but once that is understood, it should be relatively
straightforward to implement.

You can contact the bug-hurd@gnu.org mailing list to discuss about this project.

Bonding exercise: Building the Debian rustc package on Debian GNU/Linux.
Building some Debian package (not rustc) on Debian GNU/Hurd.
Have a look at the [initial attempt against rustc 1.30](https://people.debian.org/~sthibault/hurd-i386/rustc-1.30-patch) to get an idea how it looks like, how the ABI gets expressed in Rust.

[Rust language](https://www.rust-lang.org/)

[How to build and run Rust](https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html)