|
|
Log in / Subscribe / Register

portable APT?

portable APT?

Posted Nov 24, 2025 16:53 UTC (Mon) by epa (subscriber, #39769)
In reply to: portable APT? by atai
Parent article: APT Rust requirement raises questions

How about a Rust to C converter? I vaguely expected that would exist somewhere. It wouldn't run the borrow checker or most of Rust's other compile time checks, but that doesn't matter, as long as the code previously built with a full Rust compiler. And it could generate code that always runs singlethreaded.


to post comments

portable APT?

Posted Nov 24, 2025 17:14 UTC (Mon) by ojeda (subscriber, #143370) [Link]

For that, one may write a new backend for an existing Rust compiler. That way, the borrow checker and every other compile-time check still applies.

`rustc_codegen_clr` has such a mode, and there was also another start on a new C backend for `rustc`. Neither is "production ready", but it is a nice approach, and in fact it is not uncommon for languages to design their compilers that way.

portable APT?

Posted Nov 25, 2025 20:16 UTC (Tue) by hsivonen (subscriber, #91034) [Link] (1 responses)

Rust can target wasm and there’s wasm2c, which works well enough that RLBox is real and is used in Firefox with wasm coming from clang.

I don’t know about the level of effort requires to get the pile of C to expose the same interface as the Rust input is exposing as FFI.

portable APT?

Posted Nov 26, 2025 10:00 UTC (Wed) by moltonel (subscriber, #45207) [Link]

At that stage, you might as well compile to WASM, and run that binary using a wasm runtime on the platforms that lack Rust ?

portable APT?

Posted Nov 27, 2025 14:29 UTC (Thu) by slanterns (guest, #173849) [Link]

portable APT?

Posted Nov 27, 2025 23:52 UTC (Thu) by jmalcolm (subscriber, #8876) [Link]

There is a "Rust to C converter", or rather a Rust compiler that emits C (mrustc). More importantly, there are two different projects to bring Rust to GCC (gccrs and rustc_codegen_gcc).

If you can compile Rust to any architecture that supports GCC, you certainly have enough portability for APT.

Rust is already portable to the Debian architectures that people actually use. The ones that it does not support are not up-to-date anyway so shipping with an older version of APT would not be the end of the world.

As above though, there is no reason you cannot compile APT, even with Rust in it, for any of these platforms.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds