Bug 8059 - Rust compiler
Summary: Rust compiler
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
Depends on:
Blocks: 5469 7977
  Show dependency treegraph
Reported: 2022-12-28 15:48 CET by Pierre Ossman
Modified: 2023-01-03 13:05 CET (History)
0 users

See Also:
Acceptance Criteria:


Description Pierre Ossman cendio 2022-12-28 15:48:07 CET
The rust language is gaining popularity, so we will reach a point where tools and libraries we want to use will be written in rust. As such, we need a rust compiler in our build system.

Building rust is a pain, though, as the compiler is also written in rust. To build it, you need an existing rust compiler. And you generally need a fairly new one. This is a problem for us, as we want a portable and reproducible build system.

There exists this project, which is a rust compiler written in C++, that is only meant for bootstrapping the normal rust compiler:


It doesn't support the latest version of rust, but it might be good enough. Or it could be a springboard to building a newer rust.

There is also this project that tries to wrap the above in some convenience script, incrementally building newer and newer versions of rust using the previously built version:

Comment 1 Pierre Ossman cendio 2022-12-28 15:58:46 CET
I attempted to build mrustc here, but unfortunately it crashes our gcc with some internal error:

> In file included from src/trans/codegen_c.cpp:17:0:
> src/trans/codegen_c.cpp: In instantiation of '{anonymous}::CodeGenerator_C::emit_struct_inner(const HIR::TypeRef&, const TypeRepr*, unsigned int)::<lambda(auto:7&)> [with auto:7 = std::basic_ostream<char>]':
> /usr/include/c++/5.5.0/type_traits:2346:26:   required by substitution of 'template<class _Fn, class ... _Args> static std::__success_type<decltype (declval<_Fn>()((declval<_Args>)()...))> std::__result_of_other_impl::_S_test(int) [with _Fn = {anonymous}::CodeGenerator_C::emit_struct_inner(const HIR::TypeRef&, const TypeRepr*, unsigned int)::<lambda(auto:7&)>&; _Args = {std::basic_ostream<char, std::char_traits<char> >&}]'
> /usr/include/c++/5.5.0/type_traits:2357:55:   required from 'struct std::__result_of_impl<false, false, {anonymous}::CodeGenerator_C::emit_struct_inner(const HIR::TypeRef&, const TypeRepr*, unsigned int)::<lambda(auto:7&)>&, std::basic_ostream<char, std::char_traits<char> >&>'
> /usr/include/c++/5.5.0/type_traits:2361:12:   required from 'class std::result_of<{anonymous}::CodeGenerator_C::emit_struct_inner(const HIR::TypeRef&, const TypeRepr*, unsigned int)::<lambda(auto:7&)>&(std::basic_ostream<char>&)>'
> /usr/include/c++/5.5.0/functional:2053:9:   required by substitution of 'template<class _Functor, class, class> std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = {anonymous}::CodeGenerator_C::emit_struct_inner(const HIR::TypeRef&, const TypeRepr*, unsigned int)::<lambda(auto:7&)>; <template-parameter-1-2> = void; <template-parameter-1-3> = <missing>]'
> src/trans/codegen_c.cpp:1682:21:   required from here
> src/trans/codegen_c.cpp:1682:144: internal compiler error: Segmentation fault
>                      MIR_ASSERT(*m_mir_res, cur_ofs <= offset, "Current offset is already past expected (#" << fld << "): " << cur_ofs << " > " << offset);
>                                                                                                                                                 ^
> src/mir/helpers.hpp:40:159: note: in definition of macro 'MIR_ASSERT'
>  #define MIR_ASSERT(state, cnd, ...) do { if( !(cnd) ) (state).print_bug( [&](auto& _os){_os << __FILE__ << ":" << __LINE__ << " ASSERT " #cnd " failed - " << __VA_ARGS__; } ); } while(0)
>                                                                                                                                                                ^
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> make[1]: *** [.obj/trans/codegen_c.o] Error 1

Note You need to log in before you can comment on or make changes to this bug.