Closed kornelski closed 10 months ago
Have ever tried bear
to generate the compile_commands.json
on your project? Maybe you can just use bear -- clang ${PUT_YOUR_ARGS_HERE}
? or you may write a Makefile
and run bear -- make
instead?
@kornelski can you let us know whether bear
would solve your issue?
If not, I suppose we could make c2rust transpile
work in single file mode without a compile_commands.json
.
I'd be happy if it transpiled file(s) directly specified on the command line, without the JSON build indirection. Like bindgen, for example.
I find the the requirement to use
compile_commands.json
incredibly annoying, because it never fits the types of projects I want to convert to Rust, and also requires use of clunky 3rd party non-Rust dependencies and non-Rust build systems.It so happens that all C code that I dare to port to Rust is small — only a handful of
.c
files, sometimes literally just a single.c
file or a header-only dependency. And for such trivial code I use thecc
crate, not something complicated likemeson
.If a project is too hard to build with the
cc
crate, I consider it also too big and complex to convert to Rust. So I'm frustrated that c2rust only supports the types of projects I don't want to convert. When I want to convert literally a single.c
file that has zero dependencies and compiles withgcc *.c
without issues, I have to jump through so many hoops. I need to re-learn how to usecmake
, and I need to deal with series of issues in installing the right version of python, and installing its dependencies, and venvs and whatever else it requires. All of that to pass a single file path toc2rust
.Please, support
c2rust *.c
.