Comments (4)
Ah, actually, is this covered by this limitation notice in the wiki?
from c2rust.
There is too many features used in mruby that is in the known limitation:
- longjmp/setjmp
- bitfields
- variadic function definitions
- C macros
from c2rust.
Apologies for not reading thoroughly before opening this issue. Will close.
from c2rust.
Wanted to see what was going on here so I dug a bit deeper. This failure is actually not one of the limitations mentioned above, it is due to a non-C99 gcc extension, Labels as Values. Ruby can use a threaded interpreter dispatch style that stores goto labels in an array and dispatches directly to one of these labels after each opcode is handled. Rust does not have an analogous feature, so we have no plans to support this extension.
However, I was able to disable the feature in mruby with the following build_config.rb:
MRuby::Build.new do |conf|
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
else
toolchain :gcc
end
conf.cc do |cc|
cc.defines = %w(MRB_DISABLE_DIRECT_THREADING)
end
end
Note that while this allowed the project to be fully translated, varargs functions are not (yet) supported. mrb_get_args
, mrb_format
, mrb_raisef
, etc. will need to either be compiled as C code and statically linked into the rust code or re-implemented manually. There are also some warnings about potential flexible array member struct fields. At first glance these appear to be false positive warnings, but I may have missed a real problem in there.
from c2rust.
Related Issues (20)
- Aggregate libc functions into one file. HOT 1
- FYI: fatal runtime error: Rust cannot catch foreign exceptions
- Readme example of transpile for main.c doesn't work HOT 1
- Transpile `#include` as `include!()` HOT 4
- C2Rust transpiler emits features removed in recent nightlies HOT 1
- Switch case with ranges HOT 2
- rust-toolchain.toml is too old for 1.75 rust HOT 4
- cargo install c2rust failed: Could not find a configuration file for package "LLVM" that exactly matches requested version "16.0.6". HOT 2
- Build not matching clang version (Fedora 39, Clang 17.0.6) HOT 3
- cargo install c2rust failed: Error 2 HOT 2
- In the while loop body using a volatile variable, the generated code will lack a semicolon.
- why do you not support windows HOT 1
- Build fails with LLVM 18 and tip-of-tree HOT 1
- fail build on archlinux HOT 2
- Casting bool to pointer type results in invalid Rust
- Fatal error: 'stddef.h' file not found HOT 4
- ast_exporter can't convert a c code to ast HOT 2
- (Question) Do you plan to support C++ ? HOT 1
- Missing parentheses on reference applied to a cast
- Translate glsl
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from c2rust.