JuliaInterop / Clang.jl

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

Bug introduced in Clang.jl v0.16.6 #405

Closed ranocha closed 1 year ago

ranocha commented 1 year ago

We are generating bindings for p4est in https://github.com/trixi-framework/P4est.jl/pull/49. The setup using Clang.jl is contained int the dev folder therein. Everything works fine if we use Clang.jl up to v0.16.5. If we switch to Clang.jl v0.16.6 or newer (up to the latest release v0.16.10 or the current master), the important definitions

struct p8est_corner_transform_t
    ntree::p4est_topidx_t
    ncorner::Int8
end

struct p8est_corner_info_t
    icorner::p4est_topidx_t
    corner_transforms::sc_array_t
end

and some other parts are missing.

The full diff is as follows. ``` diff --git a/dev/LibP4est.jl b/dev/LibP4est.jl index f455c8b..56b9e8e 100644 --- a/dev/LibP4est.jl +++ b/dev/LibP4est.jl @@ -7168,9 +7168,9 @@ function Base.getproperty(x::Ptr{p6est_quadrant_data}, f::Symbol) f === :user_long && return Ptr{Clong}(x + 0) f === :user_int && return Ptr{Cint}(x + 0) f === :which_tree && return Ptr{p4est_topidx_t}(x + 0) - f === :piggy1 && return Ptr{__JL_Ctag_317}(x + 0) - f === :piggy2 && return Ptr{__JL_Ctag_318}(x + 0) - f === :piggy3 && return Ptr{__JL_Ctag_319}(x + 0) + f === :piggy1 && return Ptr{__JL_Ctag_314}(x + 0) + f === :piggy2 && return Ptr{__JL_Ctag_315}(x + 0) + f === :piggy3 && return Ptr{__JL_Ctag_316}(x + 0) return getfield(x, f) end @@ -7404,16 +7404,6 @@ struct p8est_edge_info_t edge_transforms::sc_array_t end -struct p8est_corner_transform_t - ntree::p4est_topidx_t - ncorner::Int8 -end - -struct p8est_corner_info_t - icorner::p4est_topidx_t - corner_transforms::sc_array_t -end - """ p8est_connectivity_face_neighbor_corner_set(c, f, nf, set) @@ -9163,9 +9153,9 @@ function Base.getproperty(x::Ptr{p8est_quadrant_data}, f::Symbol) f === :user_long && return Ptr{Clong}(x + 0) f === :user_int && return Ptr{Cint}(x + 0) f === :which_tree && return Ptr{p4est_topidx_t}(x + 0) - f === :piggy1 && return Ptr{__JL_Ctag_320}(x + 0) - f === :piggy2 && return Ptr{__JL_Ctag_321}(x + 0) - f === :piggy3 && return Ptr{__JL_Ctag_322}(x + 0) + f === :piggy1 && return Ptr{__JL_Ctag_314}(x + 0) + f === :piggy2 && return Ptr{__JL_Ctag_315}(x + 0) + f === :piggy3 && return Ptr{__JL_Ctag_316}(x + 0) return getfield(x, f) end @@ -12546,138 +12536,6 @@ function Base.setproperty!(x::Ptr{__JL_Ctag_316}, f::Symbol, v) end -struct __JL_Ctag_317 - which_tree::p4est_topidx_t - owner_rank::Cint -end -function Base.getproperty(x::Ptr{__JL_Ctag_317}, f::Symbol) - f === :which_tree && return Ptr{p4est_topidx_t}(x + 0) - f === :owner_rank && return Ptr{Cint}(x + 4) - return getfield(x, f) -end - -function Base.getproperty(x::__JL_Ctag_317, f::Symbol) - r = Ref{__JL_Ctag_317}(x) - ptr = Base.unsafe_convert(Ptr{__JL_Ctag_317}, r) - fptr = getproperty(ptr, f) - GC.@preserve r unsafe_load(fptr) -end - -function Base.setproperty!(x::Ptr{__JL_Ctag_317}, f::Symbol, v) - unsafe_store!(getproperty(x, f), v) -end - - -struct __JL_Ctag_318 - which_tree::p4est_topidx_t - from_tree::p4est_topidx_t -end -function Base.getproperty(x::Ptr{__JL_Ctag_318}, f::Symbol) - f === :which_tree && return Ptr{p4est_topidx_t}(x + 0) - f === :from_tree && return Ptr{p4est_topidx_t}(x + 4) - return getfield(x, f) -end - -function Base.getproperty(x::__JL_Ctag_318, f::Symbol) - r = Ref{__JL_Ctag_318}(x) - ptr = Base.unsafe_convert(Ptr{__JL_Ctag_318}, r) - fptr = getproperty(ptr, f) - GC.@preserve r unsafe_load(fptr) -end - -function Base.setproperty!(x::Ptr{__JL_Ctag_318}, f::Symbol, v) - unsafe_store!(getproperty(x, f), v) -end - - -struct __JL_Ctag_319 - which_tree::p4est_topidx_t - local_num::p4est_locidx_t -end -function Base.getproperty(x::Ptr{__JL_Ctag_319}, f::Symbol) - f === :which_tree && return Ptr{p4est_topidx_t}(x + 0) - f === :local_num && return Ptr{p4est_locidx_t}(x + 4) - return getfield(x, f) -end - -function Base.getproperty(x::__JL_Ctag_319, f::Symbol) - r = Ref{__JL_Ctag_319}(x) - ptr = Base.unsafe_convert(Ptr{__JL_Ctag_319}, r) - fptr = getproperty(ptr, f) - GC.@preserve r unsafe_load(fptr) -end - -function Base.setproperty!(x::Ptr{__JL_Ctag_319}, f::Symbol, v) - unsafe_store!(getproperty(x, f), v) -end - - -struct __JL_Ctag_320 - which_tree::p4est_topidx_t - owner_rank::Cint -end -function Base.getproperty(x::Ptr{__JL_Ctag_320}, f::Symbol) - f === :which_tree && return Ptr{p4est_topidx_t}(x + 0) - f === :owner_rank && return Ptr{Cint}(x + 4) - return getfield(x, f) -end - -function Base.getproperty(x::__JL_Ctag_320, f::Symbol) - r = Ref{__JL_Ctag_320}(x) - ptr = Base.unsafe_convert(Ptr{__JL_Ctag_320}, r) - fptr = getproperty(ptr, f) - GC.@preserve r unsafe_load(fptr) -end - -function Base.setproperty!(x::Ptr{__JL_Ctag_320}, f::Symbol, v) - unsafe_store!(getproperty(x, f), v) -end - - -struct __JL_Ctag_321 - which_tree::p4est_topidx_t - from_tree::p4est_topidx_t -end -function Base.getproperty(x::Ptr{__JL_Ctag_321}, f::Symbol) - f === :which_tree && return Ptr{p4est_topidx_t}(x + 0) - f === :from_tree && return Ptr{p4est_topidx_t}(x + 4) - return getfield(x, f) -end - -function Base.getproperty(x::__JL_Ctag_321, f::Symbol) - r = Ref{__JL_Ctag_321}(x) - ptr = Base.unsafe_convert(Ptr{__JL_Ctag_321}, r) - fptr = getproperty(ptr, f) - GC.@preserve r unsafe_load(fptr) -end - -function Base.setproperty!(x::Ptr{__JL_Ctag_321}, f::Symbol, v) - unsafe_store!(getproperty(x, f), v) -end - - -struct __JL_Ctag_322 - which_tree::p4est_topidx_t - local_num::p4est_locidx_t -end -function Base.getproperty(x::Ptr{__JL_Ctag_322}, f::Symbol) - f === :which_tree && return Ptr{p4est_topidx_t}(x + 0) - f === :local_num && return Ptr{p4est_locidx_t}(x + 4) - return getfield(x, f) -end - -function Base.getproperty(x::__JL_Ctag_322, f::Symbol) - r = Ref{__JL_Ctag_322}(x) - ptr = Base.unsafe_convert(Ptr{__JL_Ctag_322}, r) - fptr = getproperty(ptr, f) - GC.@preserve r unsafe_load(fptr) -end - -function Base.setproperty!(x::Ptr{__JL_Ctag_322}, f::Symbol, v) - unsafe_store!(getproperty(x, f), v) -end - - """ __JL_Ctag_323 diff --git a/dev/Manifest.toml b/dev/Manifest.toml index dadcf46..0e8729c 100644 ```

I have not been able to construct a minimal working example. However, I could bisect the problem to the change from Clang.jl v0.16.5 to v0.16.6, which seems to be only https://github.com/JuliaInterop/Clang.jl/pull/393.

Do you have an idea how to fix this problem?

Gnimuc commented 1 year ago

Did you see any error info when running the generator?

ranocha commented 1 year ago

Clang.jl v0.16.5

P4est/dev$ julia17 --project generator.jl
  Activating project at `~/.julia/dev/P4est/dev`
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_connectivity.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_io.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_config.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_mpi.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_containers.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_base.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_config.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_mesh.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_ghost.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_iterate.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_lnodes.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_connectivity.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_mesh.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_ghost.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_iterate.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_lnodes.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_uint128.h
[ Info: Parsing headers...
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est_search.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p6est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p6est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est_search.h
[ Info: Building the DAG...
[ Info: Emit Julia expressions...
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_log_indent_push() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/KhwAv/src/generator/codegen.jl:128
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_log_indent_pop() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/KhwAv/src/generator/codegen.jl:128
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_connectivity_new_icosahedron() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/KhwAv/src/generator/codegen.jl:128
[ Info: [ProloguePrinter]: print to LibP4est.jl
[ Info: [GeneralPrinter]: print to LibP4est.jl
[ Info: [EpiloguePrinter]: print to LibP4est.jl
[ Info: Done!

Clang.jl v0.16.6

P4est/dev$ julia17 --project generator.jl
  Activating project at `~/.julia/dev/P4est/dev`
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_connectivity.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_io.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_config.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_mpi.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_containers.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_base.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_config.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_mesh.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_ghost.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_iterate.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_lnodes.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_connectivity.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_mesh.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_ghost.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_iterate.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_lnodes.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_uint128.h
[ Info: Parsing headers...
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est_search.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p6est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p6est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est_search.h
[ Info: Building the DAG...
[ Info: Emit Julia expressions...
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_log_indent_push() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/uWQ8S/src/generator/codegen.jl:128
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_log_indent_pop() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/uWQ8S/src/generator/codegen.jl:128
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_connectivity_new_icosahedron() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/uWQ8S/src/generator/codegen.jl:128
[ Info: [ProloguePrinter]: print to LibP4est.jl
[ Info: [GeneralPrinter]: print to LibP4est.jl
[ Info: [EpiloguePrinter]: print to LibP4est.jl
[ Info: Done!

The 'mpi.h' not found errors are the same I get with the old version (and fixed by our prologue.jl and fixes.sh). The only difference between the outputs is the hash of Clang.jl.

Gnimuc commented 1 year ago

Could you give #407 a try?

ranocha commented 1 year ago

I just did - sadly, it does not help. I still get

P4est/dev$ julia17 --project generator.jl && ./fixes.sh
  Activating project at `~/.julia/dev/P4est/dev`
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_connectivity.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_io.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_config.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_mpi.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_containers.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_base.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_config.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_mesh.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_ghost.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_iterate.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p4est_lnodes.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_connectivity.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_mesh.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_ghost.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_iterate.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/p8est_lnodes.h
[ Info: Found dependent header: ~/.julia/dev/P4est/dev/p4est_include/sc_uint128.h
[ Info: Parsing headers...
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
~/.julia/dev/P4est/dev/p4est_include/sc.h:103:10: fatal error: 'mpi.h' file not found
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p4est_search.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p6est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p6est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est_extended.h
[ Info: Processing header: ~/.julia/dev/P4est/dev/p4est_include/p8est_search.h
[ Info: Building the DAG...
[ Info: Emit Julia expressions...
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_log_indent_push() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/ANWq9/src/generator/codegen.jl:129
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_log_indent_pop() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/ANWq9/src/generator/codegen.jl:129
┌ Warning: No Prototype for CLCursor (Clang.CLFunctionDecl) p4est_connectivity_new_icosahedron() - assuming no arguments
└ @ Clang.Generators ~/.julia/packages/Clang/ANWq9/src/generator/codegen.jl:129
[ Info: [ProloguePrinter]: print to LibP4est.jl
[ Info: [GeneralPrinter]: print to LibP4est.jl
[ Info: [EpiloguePrinter]: print to LibP4est.jl
[ Info: Done!
+ sed -i '/INTEGER(KIND/d' LibP4est.jl
+ sed -i /P4EST_NOTICE/d LibP4est.jl
+ sed -i /P4EST_GLOBAL_NOTICE/d LibP4est.jl
+ sed -i s/mpicomm::Cint/mpicomm::MPI_Comm/g LibP4est.jl
+ sed -i s/mpifile::Cint/mpifile::MPI_File/g LibP4est.jl
+ sed -i s/mpidatatype::Cint/mpidatatype::MPI_Datatype/g LibP4est.jl
+ sed -i 's/\bt::Cint/t::MPI_Datatype/g' LibP4est.jl
+ sed -i 's/array::Cstring/array::Ptr{Int8}/g' LibP4est.jl

P4est/dev$ git diff
diff --git a/dev/LibP4est.jl b/dev/LibP4est.jl
index 116050b..5f3a663 100644
--- a/dev/LibP4est.jl
+++ b/dev/LibP4est.jl
@@ -7080,9 +7080,9 @@ function Base.getproperty(x::Ptr{p6est_quadrant_data}, f::Symbol)
     f === :user_long && return Ptr{Clong}(x + 0)
     f === :user_int && return Ptr{Cint}(x + 0)
     f === :which_tree && return Ptr{p4est_topidx_t}(x + 0)
-    f === :piggy1 && return Ptr{__JL_Ctag_317}(x + 0)
-    f === :piggy2 && return Ptr{__JL_Ctag_318}(x + 0)
-    f === :piggy3 && return Ptr{__JL_Ctag_319}(x + 0)
+    f === :piggy1 && return Ptr{__JL_Ctag_314}(x + 0)
+    f === :piggy2 && return Ptr{__JL_Ctag_315}(x + 0)
+    f === :piggy3 && return Ptr{__JL_Ctag_316}(x + 0)
     return getfield(x, f)
 end

@@ -7316,16 +7316,6 @@ struct p8est_edge_info_t
     edge_transforms::sc_array_t
 end

-struct p8est_corner_transform_t
-    ntree::p4est_topidx_t
-    ncorner::Int8
-end
-
-struct p8est_corner_info_t
-    icorner::p4est_topidx_t
-    corner_transforms::sc_array_t
-end
-
 """
     p8est_connectivity_face_neighbor_corner_set(c, f, nf, set)

@@ -9075,9 +9065,9 @@ function Base.getproperty(x::Ptr{p8est_quadrant_data}, f::Symbol)
     f === :user_long && return Ptr{Clong}(x + 0)
     f === :user_int && return Ptr{Cint}(x + 0)
     f === :which_tree && return Ptr{p4est_topidx_t}(x + 0)
-    f === :piggy1 && return Ptr{__JL_Ctag_320}(x + 0)
-    f === :piggy2 && return Ptr{__JL_Ctag_321}(x + 0)
-    f === :piggy3 && return Ptr{__JL_Ctag_322}(x + 0)
+    f === :piggy1 && return Ptr{__JL_Ctag_314}(x + 0)
+    f === :piggy2 && return Ptr{__JL_Ctag_315}(x + 0)
+    f === :piggy3 && return Ptr{__JL_Ctag_316}(x + 0)
     return getfield(x, f)
 end

@@ -12458,138 +12448,6 @@ function Base.setproperty!(x::Ptr{__JL_Ctag_316}, f::Symbol, v)
 end

-struct __JL_Ctag_317
-    which_tree::p4est_topidx_t
-    owner_rank::Cint
-end
-function Base.getproperty(x::Ptr{__JL_Ctag_317}, f::Symbol)
-    f === :which_tree && return Ptr{p4est_topidx_t}(x + 0)
-    f === :owner_rank && return Ptr{Cint}(x + 4)
-    return getfield(x, f)
-end
-
-function Base.getproperty(x::__JL_Ctag_317, f::Symbol)
-    r = Ref{__JL_Ctag_317}(x)
-    ptr = Base.unsafe_convert(Ptr{__JL_Ctag_317}, r)
-    fptr = getproperty(ptr, f)
-    GC.@preserve r unsafe_load(fptr)
-end
-
-function Base.setproperty!(x::Ptr{__JL_Ctag_317}, f::Symbol, v)
-    unsafe_store!(getproperty(x, f), v)
-end
-
-
-struct __JL_Ctag_318
-    which_tree::p4est_topidx_t
-    from_tree::p4est_topidx_t
-end
-function Base.getproperty(x::Ptr{__JL_Ctag_318}, f::Symbol)
-    f === :which_tree && return Ptr{p4est_topidx_t}(x + 0)
-    f === :from_tree && return Ptr{p4est_topidx_t}(x + 4)
-    return getfield(x, f)
-end
-
-function Base.getproperty(x::__JL_Ctag_318, f::Symbol)
-    r = Ref{__JL_Ctag_318}(x)
-    ptr = Base.unsafe_convert(Ptr{__JL_Ctag_318}, r)
-    fptr = getproperty(ptr, f)
-    GC.@preserve r unsafe_load(fptr)
-end
-
-function Base.setproperty!(x::Ptr{__JL_Ctag_318}, f::Symbol, v)
-    unsafe_store!(getproperty(x, f), v)
-end
-
-
-struct __JL_Ctag_319
-    which_tree::p4est_topidx_t
-    local_num::p4est_locidx_t
-end
-function Base.getproperty(x::Ptr{__JL_Ctag_319}, f::Symbol)
-    f === :which_tree && return Ptr{p4est_topidx_t}(x + 0)
-    f === :local_num && return Ptr{p4est_locidx_t}(x + 4)
-    return getfield(x, f)
-end
-
-function Base.getproperty(x::__JL_Ctag_319, f::Symbol)
-    r = Ref{__JL_Ctag_319}(x)
-    ptr = Base.unsafe_convert(Ptr{__JL_Ctag_319}, r)
-    fptr = getproperty(ptr, f)
-    GC.@preserve r unsafe_load(fptr)
-end
-
-function Base.setproperty!(x::Ptr{__JL_Ctag_319}, f::Symbol, v)
-    unsafe_store!(getproperty(x, f), v)
-end
-
-
-struct __JL_Ctag_320
-    which_tree::p4est_topidx_t
-    owner_rank::Cint
-end
-function Base.getproperty(x::Ptr{__JL_Ctag_320}, f::Symbol)
-    f === :which_tree && return Ptr{p4est_topidx_t}(x + 0)
-    f === :owner_rank && return Ptr{Cint}(x + 4)
-    return getfield(x, f)
-end
-
-function Base.getproperty(x::__JL_Ctag_320, f::Symbol)
-    r = Ref{__JL_Ctag_320}(x)
-    ptr = Base.unsafe_convert(Ptr{__JL_Ctag_320}, r)
-    fptr = getproperty(ptr, f)
-    GC.@preserve r unsafe_load(fptr)
-end
-
-function Base.setproperty!(x::Ptr{__JL_Ctag_320}, f::Symbol, v)
-    unsafe_store!(getproperty(x, f), v)
-end
-
-
-struct __JL_Ctag_321
-    which_tree::p4est_topidx_t
-    from_tree::p4est_topidx_t
-end
-function Base.getproperty(x::Ptr{__JL_Ctag_321}, f::Symbol)
-    f === :which_tree && return Ptr{p4est_topidx_t}(x + 0)
-    f === :from_tree && return Ptr{p4est_topidx_t}(x + 4)
-    return getfield(x, f)
-end
-
-function Base.getproperty(x::__JL_Ctag_321, f::Symbol)
-    r = Ref{__JL_Ctag_321}(x)
-    ptr = Base.unsafe_convert(Ptr{__JL_Ctag_321}, r)
-    fptr = getproperty(ptr, f)
-    GC.@preserve r unsafe_load(fptr)
-end
-
-function Base.setproperty!(x::Ptr{__JL_Ctag_321}, f::Symbol, v)
-    unsafe_store!(getproperty(x, f), v)
-end
-
-
-struct __JL_Ctag_322
-    which_tree::p4est_topidx_t
-    local_num::p4est_locidx_t
-end
-function Base.getproperty(x::Ptr{__JL_Ctag_322}, f::Symbol)
-    f === :which_tree && return Ptr{p4est_topidx_t}(x + 0)
-    f === :local_num && return Ptr{p4est_locidx_t}(x + 4)
-    return getfield(x, f)
-end
-
-function Base.getproperty(x::__JL_Ctag_322, f::Symbol)
-    r = Ref{__JL_Ctag_322}(x)
-    ptr = Base.unsafe_convert(Ptr{__JL_Ctag_322}, r)
-    fptr = getproperty(ptr, f)
-    GC.@preserve r unsafe_load(fptr)
-end
-
-function Base.setproperty!(x::Ptr{__JL_Ctag_322}, f::Symbol, v)
-    unsafe_store!(getproperty(x, f), v)
-end
-
-
 """
     __JL_Ctag_323

diff --git a/dev/Manifest.toml b/dev/Manifest.toml
index dadcf46..2094aa9 100644
--- a/dev/Manifest.toml
+++ b/dev/Manifest.toml
@@ -19,9 +19,11 @@ version = "0.4.2"

 [[deps.Clang]]
 deps = ["CEnum", "Clang_jll", "Downloads", "Pkg", "TOML"]
-git-tree-sha1 = "32908e9e1700e17f3676a4a097f176629b6bcdaf"
+git-tree-sha1 = "e57913ab80583ed39b4b62a0c4ef6ff5e74e408c"
+repo-rev = "fix-405"
+repo-url = "https://github.com/JuliaInterop/Clang.jl.git"
 uuid = "40e3b903-d033-50b4-a0cc-940c62c95e31"
-version = "0.16.5"
+version = "0.16.10"

 [[deps.Clang_jll]]
 deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll", "libLLVM_jll"]
diff --git a/dev/Project.toml b/dev/Project.toml
index 1b9d615..5d0d249 100644
--- a/dev/Project.toml
+++ b/dev/Project.toml
@@ -7,6 +7,6 @@ P4est_jll = "6b5a15aa-cf52-5330-8376-5e5d90283449"

 [compat]
 CEnum = "0.4"
-Clang = "0.15, 0.16.0 - 0.16.5" # see https://github.com/JuliaInterop/Clang.jl/issues/405
+Clang = "0.15, 0.16"
 MPI = "0.20"
 P4est_jll = "2.8"
Gnimuc commented 1 year ago

Does the version of Clang_jll change between 0.16.5 and 0.16.6?

Gnimuc commented 1 year ago

Does p4est's JLL package work on Windows? If not, I'll try to find a Linux machine tomorrow to debug this.

ranocha commented 1 year ago

No - I added the Manifest.toml file to git and the only changes when upgrading to Clang#fix-405 were

diff --git a/dev/Manifest.toml b/dev/Manifest.toml
index dadcf46..2094aa9 100644
--- a/dev/Manifest.toml
+++ b/dev/Manifest.toml
@@ -19,9 +19,11 @@ version = "0.4.2"

 [[deps.Clang]]
 deps = ["CEnum", "Clang_jll", "Downloads", "Pkg", "TOML"]
-git-tree-sha1 = "32908e9e1700e17f3676a4a097f176629b6bcdaf"
+git-tree-sha1 = "e57913ab80583ed39b4b62a0c4ef6ff5e74e408c"
+repo-rev = "fix-405"
+repo-url = "https://github.com/JuliaInterop/Clang.jl.git"
 uuid = "40e3b903-d033-50b4-a0cc-940c62c95e31"
-version = "0.16.5"
+version = "0.16.10"

 [[deps.Clang_jll]]
 deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll", "libLLVM_jll"]
ranocha commented 1 year ago

Does p4est's JLL package work on Windows? If not, I'll try to find a Linux machine tomorrow to debug this.

Yes, it works on Windows. Thanks a lot for your help :+1:

Gnimuc commented 1 year ago

Done!

ranocha commented 1 year ago

Thanks for the quick fix! I just tested it locally and it seems to work fine with Clang.jl v0.17.