Skip to content
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

error with “cargo build” #3

Open
ooggss opened this issue Jul 10, 2024 · 4 comments
Open

error with “cargo build” #3

ooggss opened this issue Jul 10, 2024 · 4 comments

Comments

@ooggss
Copy link

ooggss commented Jul 10, 2024

When I use "cargo build --verbose"to build the project,I encounter the following problem:
error: failed to parse registry's information for: serde

Caused by:
Feature derive depends on serde_derive which is not an optional dependency.
Consider adding optional = true to the dependency

But I never change anything in the project.
And if I add optional = true to the dependency, I still get the same error.

@aidanhs
Copy link
Owner

aidanhs commented Jul 11, 2024

Unfortunately this seems like a bug in cargo/newer formats of the registry rust-lang/cargo#14237

Not really sure if there's a way to work around this, so the only option would be to update ayzim to latest rust - possible, but a bit annoying.

Are you sure you need this project? It was designed to optimise asm.js files, but these days people generally use wasm - so I'm not sure it's worth the effort to update.

(note: I think the same techniques used in ayzim could be used to speed up binaryen (the wasm optimiser) if that's something you wanted to pursue)

@ooggss
Copy link
Author

ooggss commented Jul 12, 2024

Unfortunately this seems like a bug in cargo/newer formats of the registry rust-lang/cargo#14237

Not really sure if there's a way to work around this, so the only option would be to update ayzim to latest rust - possible, but a bit annoying.

Are you sure you need this project? It was designed to optimise asm.js files, but these days people generally use wasm - so I'm not sure it's worth the effort to update.

(note: I think the same techniques used in ayzim could be used to speed up binaryen (the wasm optimiser) if that's something you wanted to pursue)

Thanks for your reply!

Actually I want to get some function pairs that written in different language like rust and c++ but have the identical functionality to develop and evaluate my tools , which is used to automatically translate the functions that written in other language to rust. And I found that you used rust to rewrite the Emscripten asm.js optimizer based on function level. So I can get some function pairs from your project and the Emscripten asm.js optimizer. But in order to evaluate my tools, I have to run your project.

@aidanhs
Copy link
Owner

aidanhs commented Jul 15, 2024

I see, interesting.

With that context, I want to note there are minor differences between ayzim and the emscripten optimiser. It's been a while now, but from memory the emscripten optimiser tries quite hard (sacrificing performance in some cases) to be deterministic e.g. with generating variable names and I'm not sure that ayzim is - partly because replicating exact behaviour was a touch tricky, partly because performance was my highest concern.
(of course, for a fair comparison you'd need to compare against the emscripten optimiser from ~7 years ago too)

If you want to proceed with this, you have a few options to solve the two issues of the plugin and the cargo issue (unfortunately I'm not enthused to follow any of them myself since I'm not using this project atm).

The cargo issue looks like it'll need this project to use a different version of rust. Your choices are:

  1. fully update rust
  2. minimally update rust to the version that has cargo with this bug fixed (apparently cargo 0.19 - I don't know what rust nightly version that corresponds to so you'd need to do digging)

When doing this, you'll need to figure out mast!. The mast! macro plugin is a simple macro to make writing box patterns easier - it just expands any tuple struct in a pattern like A(B(_)) to box A(box B(_)). You could:
a. remove the plugin entirely and write a small script to expand all the macros/do it by hand
b. (if fully updating rust) replace the plugin with a proc macro - I don't know how hard it'd be to do this
c. (if minimally updating rust) update the plugin - shouldn't be too hard

Overall, for someone who wanted to pursue this I'd probably recommend the combination of 1 + a - it requires the least knowledge of rust/this project and should be possible without too much learning about the project.

@ooggss
Copy link
Author

ooggss commented Jul 16, 2024

I see, interesting.

With that context, I want to note there are minor differences between ayzim and the emscripten optimiser. It's been a while now, but from memory the emscripten optimiser tries quite hard (sacrificing performance in some cases) to be deterministic e.g. with generating variable names and I'm not sure that ayzim is - partly because replicating exact behaviour was a touch tricky, partly because performance was my highest concern. (of course, for a fair comparison you'd need to compare against the emscripten optimiser from ~7 years ago too)

If you want to proceed with this, you have a few options to solve the two issues of the plugin and the cargo issue (unfortunately I'm not enthused to follow any of them myself since I'm not using this project atm).

The cargo issue looks like it'll need this project to use a different version of rust. Your choices are:

  1. fully update rust
  2. minimally update rust to the version that has cargo with this bug fixed (apparently cargo 0.19 - I don't know what rust nightly version that corresponds to so you'd need to do digging)

When doing this, you'll need to figure out mast!. The mast! macro plugin is a simple macro to make writing box patterns easier - it just expands any tuple struct in a pattern like A(B(_)) to box A(box B(_)). You could: a. remove the plugin entirely and write a small script to expand all the macros/do it by hand b. (if fully updating rust) replace the plugin with a proc macro - I don't know how hard it'd be to do this c. (if minimally updating rust) update the plugin - shouldn't be too hard

Overall, for someone who wanted to pursue this I'd probably recommend the combination of 1 + a - it requires the least knowledge of rust/this project and should be possible without too much learning about the project.

Thank you very much, again!

The version I choose is the one you mentioned in the REAMDE.

Besides, I'ill try to use the combination of 1 + a to solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants