-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rustybox won't compile with latest nightly toolchain #35
Comments
It looks like all the errors are of the form
I'm not exactly sure what we're supposed to be using in place of We could also try recompiling some of this stuff with the latest c2rust which ostensibly has been updated to address this. |
@samuela, I might have figured it out from the changes in between old and new documentation. It seems like a pattern of I tried to write an automatic refactoring script using JS + Deno + Regex, but it ultimately is too simple to proper replacements in some complicated cases, though it does work on most simpler ones. Script: import { walk } from "https://deno.land/std/fs/mod.ts";
const iter = walk('./');
for await (const e of iter)
if (e.isFile && e.path.includes('.rs')) {
let fileText = new TextDecoder().decode(await Deno.readFile(e.path));
console.log('Looking at file ' + e.path);
let regex = /(\(.+\)|[A-z]+)[\n ]*.wrapping_offset_from\((.+)\)/gi;
console.log('Does the file contain the issue? ' + regex.test(fileText));
let fixedText = fileText.replace(regex, '$1.wrapping_offset((($2) as isize) - (($1) as isize))');
// Write the fixed text back to the file
await Deno.writeFile(e.path, new TextEncoder().encode(fixedText));
} To run: I hope you find this information helpful to succeed where I failed 😼 Let |
I am also hoping to make a small distro using it soon, so I hope this can be resolved! There is no other project like this, it seems! |
Hi @skyne98, that's awesome! Super excited to hear that you're interested in building a distro around it. That was one of my initial motivations when starting the project, but I haven't gotten around to it. The dependency on nightly features has led to this unfortunate bit rot. I think that the best path forward for rustybox may actually be to re-run c2rust on a more recent version of c2rust and busybox. Automating that process may be the best way to stay up-to-date with changes in nightly features. Granted, getting this working the first time was a significant PITA. Another option is to start rewriting things in rust. A lot of the basics can already be imported from https://github.com/uutils/coreutils. |
It would be nice to keep things up to date with the most recent BusyBox and c2rust automatically, however, one problem arises in my mind: how do we make sure to only covert the parts which weren't rewritten? Also, I am not familiar with the workflow of c2rust, so sorry I am currently no help on this front 😐 |
Yes, this is the fundamental question. I think the key here is to do it on a per-utility basis, eg. transpile "mkdir" but not "ls", etc. Don't worry, c2rust is surprisingly approachable! I won't go so far as to say that it's straightforward, but it was easier than I expected. |
In that case, there should be some simple build system in place. The whole binary should be clearly split-up and somehow marked as rewritten (or not). The build system will rely on this information to make decisions about if to transpile. I guess it can be as simple as having some mark file near the source code file, or some specific comment at the first line of each source code file. But again, no idea how easy or hard it is to do granular transpilations with |
yeah I think something like that makes sense. IIRC busybox has build flags to enable/disable each possible sub utility. That's prob the way to go in terms of configuring which ones to transpile. Based on my previous experience I'm guessing that transpilation is likely not stable enough yet to just be another part of the build process; in my experience it required some manual fixes after transpilation to get things to compile. |
Probably will have some time to look into how If I get some time, I could have and would have preferred to do it using Deno + TS, but I guess it would be too much of an unnecessary dependency, what do you think? Although, people will rarely need to transpile, so I guess it can be fine. |
I think best to start with something simple. First things first let's see if it's even possible to automate the whole c2rust transformation. And if so we can move from there to figure out the best way to flag utilities on and off. I'm confident we can get the configuration story figured out one way or another |
Yep, we can go Some build system -> Check the state file -> c2rust -> Apply patch fix manual fixes and try to do it for a single utility with a simple bash file for the first run. This way, we can just update a patch file whenever the manual changes required change. Whenever I get to it, I will test out some options. So, would you mind using something like Deno as a build dependency (or more of a generation dependency)? Also, it would be cool if you could show an example of transpiling one util |
I'd like to keep the core build system -- eg |
Hah, I see! I kind of got my hands dirty with nix recently, replicating its derivation system as the package management system for the distro project I am working on, so it might be fun diving even deeper to understand it better! 😄 |
So I was trying to compile rustybox and obviously, I have the latest nightly toolchain.
But I'm afraid that the build failed viciously 😅
I wonder, would it require the nightly toolchain which was present back at the time of the last commit made on
May 31, 2020
?I've attached the log below.
log.txt
The text was updated successfully, but these errors were encountered: