JuliaInterop / Clang.jl

C binding generator and Julia interface to libclang
https://juliainterop.github.io/Clang.jl/
MIT License
217 stars 68 forks source link

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

Open giordano opened 3 months ago

giordano commented 3 months ago

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

Gnimuc commented 3 months ago

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.

giordano commented 3 months ago

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:

Gnimuc commented 3 months ago

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.

giordano commented 3 months ago

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).

Gnimuc commented 3 months ago

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.

giordano commented 3 months ago

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: