Clang.jl icon indicating copy to clipboard operation
Clang.jl copied to clipboard

Troubles parsing a C++ project with Clang.jl v0.18.0 and julia v1.11 (llvm 16)

Open giordano opened this issue 10 months ago • 7 comments

I'm having troubles parsing a C++ project with Clang.jl v0.18.0 and julia v1.11 (which uses llvm16). To be clear, my current parsing script works fine with same version of Clang.jl but using julia v1.7-v1.10 (llvm from 12 to 15). This may be related to #470.

My parsing script is at https://github.com/JuliaIPU/IPUToolkit.jl/blob/dca1f4d514a4f8184967da10b5b2b7e6919d8789/deps/generate_wrapper.jl (@Gnimuc contributed to it before :slightly_smiling_face:), getting the files to parse is a bit complicated, but there's a docker container you can use (graphcore/poplar:3.3.0-ubuntu-20.04-20230703), but it's possible the parsing script just has to be updated (although, again, it's working fine with other versions of julia/llvm).

For reference, I'm attaching below the diff of a couple of files generated by the parsing script gen_inherit.cpp.patch.txt gen_inline.cpp.patch.txt

giordano avatar Apr 09 '24 13:04 giordano

Julia 1.11 uses llvm16 and there are some breaking changes introduced in llvm16/clang16(see #465).

As IPUToolkit.jl maintains its own C++ parsing script, we should upgrade the script to be compatible with clang16.

Gnimuc avatar Apr 09 '24 13:04 Gnimuc

I had a look at the 0.18 changelog (I was very glad to see it!) but the only breaking change mentioned didn't look relevant, that's why I opened the issue :slightly_smiling_face:

giordano avatar Apr 09 '24 13:04 giordano

Those breaking changes are from clang internals. We(mainly contributed by @JamesWrigley) only write changelogs for Clang.jl.

It may take a little longer to fix issues related to clang internal changes, you may need to pin Clang.jl to v0.17.x before it gets fixed.

Gnimuc avatar Apr 09 '24 13:04 Gnimuc

you may need to pin Clang.jl to v0.17.x before it gets fixed.

Do I need to do that? Clang.jl v0.18 seems to work fine with Julia v1.9-1.10 (llvm 14-15), only problem is Julia v1.11 (llvm 16).

giordano avatar Apr 09 '24 15:04 giordano

You're right. It's safe until Julia v1.1 is released. But if you're only using Clang.jl for generating bindings, it should be ok to remove it as a dependency.

Gnimuc avatar Apr 10 '24 10:04 Gnimuc

But if you're only using Clang.jl for generating bindings, it should be ok to remove it as a dependency.

I wish I could do that, bu the problem is that I have no other way to generate the bindings to start with :slightly_smiling_face:

giordano avatar Apr 10 '24 11:04 giordano

I presume there hasn't been any progress with regards to C++ support for LLVM 16+, right?

giordano avatar Aug 17 '24 20:08 giordano