immunant / c2rust

Migrate C code to Rust
https://c2rust.com/
Other
3.79k stars 219 forks source link

cargo install c2rust failed: Error 2 #1063

Closed IanE-Official closed 4 months ago

IanE-Official commented 4 months ago

Hi Everyone, I'm having some trouble installing / building and would welcome any suggestions.

os and rust info

OS: macOS 14.2.1 23C71 arm64 
Host: MacBookPro18,3
Shell: zsh 5.9
-------
~ ❯ brew list  |grep llvm
llvm [Note: AKA llvm@17]
~ ❯ brew list  |grep rust
rust

-- error message

 Cloning into 'tinycbor_build'...
  HEAD is now at d393c16 Parser: fix reading it->extra on big endian when bytesNeeded == 1
  install: mkdir /private/var/folders/8p/qll6n1h54slfdsz98sv_7s9w0000gn/T/cargo-installFZIyCo/release/build/c2rust-ast-exporter-0ee22bd62c8293aa/out/build/include/tinycbor: File exists
  make[4]: *** [/private/var/folders/8p/qll6n1h54slfdsz98sv_7s9w0000gn/T/cargo-installFZIyCo/release/build/c2rust-ast-exporter-0ee22bd62c8293aa/out/build/include/tinycbor/tinycbor-version.h] Error 71
  make[4]: *** Waiting for unfinished jobs....
  gmake[3]: *** [CMakeFiles/tinycbor_build.dir/build.make:103: tinycbor/src/tinycbor_build-stamp/tinycbor_build-install] Error 2
  gmake[2]: *** [CMakeFiles/Makefile2:92: CMakeFiles/tinycbor_build.dir/all] Error 2
  gmake[1]: *** [CMakeFiles/Makefile2:281: CMakeFiles/clangAstExporter.dir/rule] Error 2
  gmake: *** [Makefile:215: clangAstExporter] Error 2
  thread 'main' panicked at /Users/iane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

  command did not execute successfully, got: exit status: 2

  build script failed, must exit now
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: failed to compile `c2rust v0.18.0`, intermediate artifacts can be found at `/var/folders/8p/qll6n1h54slfdsz98sv_7s9w0000gn/T/cargo-installFZIyCo`.

Detailed log of LLVM_CONFIG_PATH=/opt/homebrew/opt/llvm/bin/llvm-config cargo install c2rust: https://pastebin.com/Fgas17KW

thedataking commented 4 months ago

Thanks for the detailed report. I think the cargo version of c2rust does not have the patches for LLVM 17 support. Can you try building from the main branch and let me know if that works?

IanE-Official commented 4 months ago

Thanks for the quick reply @thedataking . Building from master worked!

For completeness, here is the detailed log of LLVM_CONFIG_PATH=/opt/homebrew/opt/llvm/bin/llvm-config cargo install --git https://github.com/immunant/c2rust.git --branch master c2rust: https://pastebin.com/sJ1CAfnF