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

C2Rust transpiler emits features removed in recent nightlies #1054

Open
SheldonHH opened this issue Jan 4, 2024 · 1 comment
Open

C2Rust transpiler emits features removed in recent nightlies #1054

SheldonHH opened this issue Jan 4, 2024 · 1 comment

Comments

@SheldonHH
Copy link

SheldonHH commented Jan 4, 2024

I'm experiencing difficulties in building the bzip2 project, which I have converted from C to Rust using C2Rust. The original bzip2 project is hosted on GitLab, and my converted version is on GitHub.

I am unable to build the converted project, hindering any further testing or development. Below are the details:

Build Issues:

  • The project fails to build after conversion.
  • [Include specific error messages or issues encountered during the build process.]

Questions:

  1. Are there known challenges or common errors when building a C2Rust converted project?
  2. What steps can be taken to resolve build issues in a project converted from C to Rust?
  3. Are there specific configurations or adjustments needed for a successful build in such cases?

I would appreciate any guidance or suggestions to resolve these build issues. Thank you for your assistance.

@thedataking
Copy link
Contributor

Hi @SheldonHH

Thanks for your report, it would have been helpful if you'd directly included the build errors. This is what I see:

error[E0557]: feature has been removed
 --> c2rust-lib.rs:8:12
  |
8 | #![feature(const_raw_ptr_to_usize_cast)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^ feature has been removed
  |
  = note: at compile-time, pointers do not have an integer value, so these casts cannot be properly supported

error[E0557]: feature has been removed
  --> c2rust-lib.rs:12:12
   |
12 | #![feature(main)]
   |            ^^^^ feature has been removed

error: cannot find attribute `main` in this scope
    --> bzip2.rs:3164:3
     |
3164 | #[main]
     |   ^^^^
     |
     = note: `main` is in scope, but it is a function, not an attribute

error: cannot find attribute `main` in this scope
   --> bzip2recover.rs:590:3
    |
590 | #[main]
    |   ^^^^
    |
    = note: `main` is in scope, but it is a function, not an attribute

It seems that C2Rust relies on features that are no longer in the latest nightlies. As a workaround, you can build with a much older nightly until you've patched the transpiled code to remove uses of the deprecated features. This works for me:

cargo +nightly-2020-03-21 build

@thedataking thedataking changed the title Build Failure in bzip2 Project Post C2Rust Conversion and How to build/organize project-scale C project? C2Rust transpiler emits features removed in recent nightlies Jan 4, 2024
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