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 fails to build with LLVM 15 #676

Closed
jrmuizel opened this issue Sep 22, 2022 · 5 comments · Fixed by #677
Closed

c2rust fails to build with LLVM 15 #676

jrmuizel opened this issue Sep 22, 2022 · 5 comments · Fixed by #677
Assignees
Labels
bug Something isn't working building Build/compile errors or build system-related

Comments

@jrmuizel
Copy link

jrmuizel commented Sep 22, 2022

 --- stderr
  CMake Warning:
    Manually-specified variables were not used by the project:

      CMAKE_ASM_COMPILER
      CMAKE_ASM_FLAGS


  * Closing connection 0
  * Closing connection 1
  /Users/jrmuizel/.cargo/git/checkouts/c2rust-2a3ef4c32beab81a/1fddfc4/c2rust-ast-exporter/src/AstExporter.cpp:2270:52: error: no member named 'Ascii' in 'clang::StringLiteral::StringKind'
              case clang::StringLiteral::StringKind::Ascii:
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  1 error generated.
  make[3]: *** [CMakeFiles/clangAstExporter.dir/AstExporter.cpp.o] Error 1
  make[2]: *** [CMakeFiles/clangAstExporter.dir/all] Error 2
  make[1]: *** [CMakeFiles/clangAstExporter.dir/rule] Error 2
@kkysen kkysen changed the title c2rust fails to build with llvm 12,11 and 15 c2rust fails to build with llvm 11, 12, and 15 Sep 22, 2022
@kkysen
Copy link
Contributor

kkysen commented Sep 22, 2022

On Linux it builds with LLVM 11 and 12 fine. I haven't tested LLVM 15 before.

You're getting this same error for LLVM 11, 12, and 15 but not 13 and 14?

@jrmuizel
Copy link
Author

jrmuizel commented Sep 22, 2022

I didn't have 13 and 14 so didn't try them. The error seems to be the same in 11, 12 and 15. Using LLVM 8 worked though.

I was using:

LLVM_CONFIG_PATH=/usr/local/opt/llvm/bin/llvm-config cargo install --git https://github.com/immunant/c2rust.git c2rust
LLVM_CONFIG_PATH=/usr/local/opt/llvm@11/bin/llvm-config cargo install --git https://github.com/immunant/c2rust.git c2rust
LLVM_CONFIG_PATH=/usr/local/opt/llvm@15/bin/llvm-config cargo install --git https://github.com/immunant/c2rust.git c2rust

@thedataking thedataking self-assigned this Sep 23, 2022
@thedataking
Copy link
Contributor

thedataking commented Sep 23, 2022

I'm not able to reproduce with LLVM 11, 12 on Linux (Ubuntu 22.10) or LLVM 11 on MacOS Monterey. Update: I can reproduce with LLVM 15 on MacOS.

It looks like the definition of clang::StringLiteral::StringKindin Expr.h changed. It seems that the Ascii variant was renamed to Ordinary when LLVM 15 was released so I think that's the most likely explanation for this issue.

Are you able to run down the exact copy of Expr.h you are building against? Were you doing a clean build when hitting the problem on LLVM 11 and 12?

thedataking added a commit that referenced this issue Sep 23, 2022
clang::StringLiteral::StringKind::Ascii was renamed to
clang::StringLiteral::StringKind::Ordinary. Add release keys and
update build_translator.py. Closes #676.
@thedataking
Copy link
Contributor

thedataking commented Sep 23, 2022

@jrmuizel can you try LLVM_CONFIG_PATH=/usr/local/opt/llvm@15/bin/llvm-config cargo build on feature/llvm-15.0.0 and let me know if that works? I'm hitting a weird linker issue on MacOS to I switched to link dynamically instead of statically.

With static linking on MacOS, I'm seeing this error related to -opaque-pointers (see change in build.rs):

ld: in /usr/local/Cellar/llvm/15.0.0/lib/libclangAST.a(Stmt.cpp.o), could not parse object file /usr/local/Cellar/llvm/15.0.0/lib/libclangAST.a(Stmt.cpp.o): 'Opaque pointers are only supported in -opaque-pointers mode (Producer: 'LLVM15.0.0' Reader: 'LLVM APPLE_1_1400.0.29.102_0')', using libLTO version 'LLVM version 14.0.0, (clang-1400.0.29.102)' for architecture x86_64

@thedataking thedataking changed the title c2rust fails to build with llvm 11, 12, and 15 c2rust fails to build with LLVM 15 Sep 23, 2022
thedataking added a commit that referenced this issue Sep 30, 2022
clang::StringLiteral::StringKind::Ascii was renamed to
clang::StringLiteral::StringKind::Ordinary. Add release keys and
update build_translator.py. Closes #676.
@kkysen kkysen added bug Something isn't working building Build/compile errors or build system-related labels Sep 30, 2022
@pmembrey
Copy link

pmembrey commented Oct 3, 2022

@thedataking I tried the feature/llvm-15.0.0 branch and I was able to build it successfully with cargo build. I'm using version 15.0.1 of llvm on an M1 Mac.

In case it helps someone, on an M1 Mac, homebrew uses /opt/homebrew/ as its default location. I used this command to build:

LLVM_CONFIG_PATH=/opt/homebrew/Cellar/llvm/15.0.1/bin/llvm-config cargo build

thedataking added a commit that referenced this issue Oct 4, 2022
clang::StringLiteral::StringKind::Ascii was renamed to
clang::StringLiteral::StringKind::Ordinary. Add release keys and
update build_translator.py. Closes #676.
thedataking added a commit that referenced this issue Oct 5, 2022
clang::StringLiteral::StringKind::Ascii was renamed to
clang::StringLiteral::StringKind::Ordinary. Add release keys and
update build_translator.py. Closes #676.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working building Build/compile errors or build system-related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants