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

Method definition overwritten error for certain nested structures #45

Closed
sloede opened this issue Oct 7, 2020 · 3 comments · Fixed by #47
Closed

Method definition overwritten error for certain nested structures #45

sloede opened this issue Oct 7, 2020 · 3 comments · Fixed by #47

Comments

@sloede
Copy link

sloede commented Oct 7, 2020

When using CBindingGen.jl to generate C bindings in P4est.jl, certain nested structures now cause errors (likely due to some changes in #43). When building the bindings in P4est.jl and then loading the package with

git clone git@github.com:trixi-framework/P4est.jl.git
julia --project=P4est.jl/ -e 'using Pkg; Pkg.build()'
julia --project=P4est.jl/ -e 'using P4est'

I get the following errors:

WARNING: Method definition (::Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|owner_rank::(𝐣𝐥.Cint))})(UndefInitializer) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:143 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:143.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition concrete(Type{P4est.LibP4est.Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|owner_rank::(𝐣𝐥.Cint)}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:154 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:154.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition concrete(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|owner_rank::(𝐣𝐥.Cint))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:155 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:155.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition strategy(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|owner_rank::(𝐣𝐥.Cint))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:156 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:156.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition specification(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|owner_rank::(𝐣𝐥.Cint))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:157 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:157.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition sizeof(Type{P4est.LibP4est.Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|owner_rank::(𝐣𝐥.Cint)}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:158 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:158.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition (::Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|from_tree::(p4est_topidx_t))})(UndefInitializer) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:143 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:143.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition concrete(Type{P4est.LibP4est.Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|from_tree::(p4est_topidx_t)}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:154 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:154.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition concrete(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|from_tree::(p4est_topidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:155 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:155.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition strategy(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|from_tree::(p4est_topidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:156 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:156.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition specification(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|from_tree::(p4est_topidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:157 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:157.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition sizeof(Type{P4est.LibP4est.Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|from_tree::(p4est_topidx_t)}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:158 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:158.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition (::Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|local_num::(p4est_locidx_t))})(UndefInitializer) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:143 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:143.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition concrete(Type{P4est.LibP4est.Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|local_num::(p4est_locidx_t)}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:154 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:154.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition concrete(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|local_num::(p4est_locidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:155 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:155.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition strategy(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|local_num::(p4est_locidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:156 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:156.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition specification(Type{P4est.LibP4est.(Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|local_num::(p4est_locidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:157 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:157.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition sizeof(Type{P4est.LibP4est.Cstruct_anonymous|native|which_tree::(p4est_topidx_t)|local_num::(p4est_locidx_t)}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:158 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:158.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition (::Type{P4est.LibP4est.(Cstruct_anonymous|native|is_ghost::(int8_t)|quad::(𝐣𝐥.Ptr{p8est_quadrant_t})|quadid::(p4est_locidx_t))})(UndefInitializer) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:143 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:143.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition concrete(Type{P4est.LibP4est.Cstruct_anonymous|native|is_ghost::(int8_t)|quad::(𝐣𝐥.Ptr{p8est_quadrant_t})|quadid::(p4est_locidx_t)}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:154 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:154.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition concrete(Type{P4est.LibP4est.(Cstruct_anonymous|native|is_ghost::(int8_t)|quad::(𝐣𝐥.Ptr{p8est_quadrant_t})|quadid::(p4est_locidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:155 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:155.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition strategy(Type{P4est.LibP4est.(Cstruct_anonymous|native|is_ghost::(int8_t)|quad::(𝐣𝐥.Ptr{p8est_quadrant_t})|quadid::(p4est_locidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:156 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:156.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition specification(Type{P4est.LibP4est.(Cstruct_anonymous|native|is_ghost::(int8_t)|quad::(𝐣𝐥.Ptr{p8est_quadrant_t})|quadid::(p4est_locidx_t))}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:157 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:157.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition sizeof(Type{P4est.LibP4est.Cstruct_anonymous|native|is_ghost::(int8_t)|quad::(𝐣𝐥.Ptr{p8est_quadrant_t})|quadid::(p4est_locidx_t)}) in module LibP4est at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:158 overwritten at /home/mschlott/.julia/packages/CBinding/Z7nQ0/src/caggregate.jl:158.
  ** incremental compilation may be fatally broken for this module **

I checked the bindings file, and the issues are due to nested structs such as these two (taken from deps/libp4est.jl after executing the commands above):

  𝐣𝐥.@ctypedef p8est_iter_face_side_t 𝐣𝐥.@cstruct p8est_iter_face_side {                            
    treeid::p4est_topidx_t                                                                          
    face::int8_t                                                                                    
    is_hanging::int8_t                                                                              
    is::𝐣𝐥.@cunion p8est_iter_face_side_data {                                                      
      full::𝐣𝐥.@cstruct {                                                                           
        is_ghost::int8_t                                                                            
        quad::𝐣𝐥.Ptr{p8est_quadrant_t}                                                              
        quadid::p4est_locidx_t                                                                      
      }                                                                                             
      hanging::𝐣𝐥.@cstruct {                                                                        
        is_ghost::int8_t[4]                                                                         
        quad::𝐣𝐥.Ptr{p8est_quadrant_t}[4]                                                           
        quadid::p4est_locidx_t[4]                                                                   
      }                                                                                             
    }                                                                                               
  }

  𝐣𝐥.@ctypedef p8est_iter_edge_side_t 𝐣𝐥.@cstruct p8est_iter_edge_side {                            
    treeid::p4est_topidx_t                                                                          
    edge::int8_t                                                                                    
    orientation::int8_t                                                                             
    is_hanging::int8_t                                                                              
    is::𝐣𝐥.@cunion p8est_iter_edge_side_data {                                                      
      full::𝐣𝐥.@cstruct {                                                                           
        is_ghost::int8_t                                                                            
        quad::𝐣𝐥.Ptr{p8est_quadrant_t}                                                              
        quadid::p4est_locidx_t                                                                      
      }                                                                                             
      hanging::𝐣𝐥.@cstruct {                                                                        
        is_ghost::int8_t[2]                                                                         
        quad::𝐣𝐥.Ptr{p8est_quadrant_t}[2]                                                           
        quadid::p4est_locidx_t[2]                                                                   
      }                                                                                             
    }                                                                                               
    faces::int8_t[2]                                                                                
  }

Do you have an idea what could cause this issue? I did not occur when the names were still gensymmed.

@krrutkow
Copy link
Member

krrutkow commented Oct 7, 2020

Hey, look on the bright side, at least you don't get these warnings any more 😆

┌ Warning: file /home/mschlott/.julia/packages/CBinding/Vcw7p/src/caggregate.jl, line 151: no method found for Tuple{typeof(CBinding.concrete),Type{##S#254}}
└ @ LoweredCodeUtils ~/.julia/packages/LoweredCodeUtils/Y1zIf/src/signatures.jl:460

@krrutkow
Copy link
Member

krrutkow commented Oct 7, 2020

The deterministic names definitely breaks precompilation. Unfortunately, none of my use cases featured duplicate inner anonymous aggregate types. When I explicitly tested this, I did so in the REPL, which doesn't have any problem with it.

I can conditionally generate the declarations if the type hasn't been defined yet, but I'm not sure how Revise is going to like that. Perhaps @timholy could shed some light on that scenario?

@timholy
Copy link

timholy commented Oct 10, 2020

Thanks for fixing this, and sorry I didn't get around to looking at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants