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

Double registration error #410

Open
torrance opened this issue Mar 6, 2024 · 1 comment
Open

Double registration error #410

torrance opened this issue Mar 6, 2024 · 1 comment

Comments

@torrance
Copy link

torrance commented Mar 6, 2024

I have an existing published package that I'm updating for Julia 1.10, and have also updated CxxWrap 0.12 -> 0.14 as a result.

The CxxWrap code has needed a number of small changes to get working, however I'm stuck resolving the following error that is thrown when calling @wrapmodule:

Failed to precompile Casacore [72bb1062-94f5-49fa-bb69-94b615203ad9] to "/home/torrance/.julia/compiled/v1.10/Casacore/jl_FLCzpN".
ERROR: LoadError: Double registration for method (:constructor, :CasacoreVector, :LibCasacore, 0x73730944f472ff3e)
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] _register_function_pointers(func::CxxWrap.CxxWrapCore.CppFunctionInfo, precompiling::Bool)
    @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/5IZvn/src/CxxWrap.jl:361
  [3] wrap_functions(functions::Vector{CxxWrap.CxxWrapCore.CppFunctionInfo}, julia_mod::Module)
    @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/5IZvn/src/CxxWrap.jl:704
  [4] wrapfunctions(jlmod::Module)
    @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/5IZvn/src/CxxWrap.jl:726
  [5] wrapmodule(so_path_cb::Function, funcname::Symbol, m::Module, flags::Nothing)
    @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/5IZvn/src/CxxWrap.jl:763
  [6] top-level scope
    @ ~/Casacore.jl/src/LibCasacore.jl:7
  [7] include(mod::Module, _path::String)
    @ Base ./Base.jl:495
  [8] include(x::String)
    @ Casacore ~/Casacore.jl/src/Casacore.jl:1
  [9] top-level scope
    @ ~/Casacore.jl/src/Casacore.jl:3
 [10] include
    @ ./Base.jl:495 [inlined]
 [11] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2222
 [12] top-level scope
    @ stdin:3

The error doesn't help clarify which method is duplicated, but through trial and error it looks like it is an attempt to add a parametric type that is at fault. Specifically, if I comment out the entire casacorecxx_jll module and leave just this:

    mod.add_type<jlcxx::Parametric<jlcxx::TypeVar<1>>>("CasacoreVector")
        .apply<
            casacore::Vector<Bool>, casacore::Vector<Double>
        >([] (auto wrapped) {

        });

I can still trigger the error. If I remove the second parametric type parameter (e.g. leave just casacore::Vector<Bool>), the error goes away.

So what's wrong with how I'm trying to handle the parametric types here?

@torrance
Copy link
Author

torrance commented Mar 6, 2024

Seems like I was able to resolve this by specifying a Dependency("libcxxwrap_julia_jll", compat="0.11.2") in the binary builder specification.

Is there a compatibility table mapping CxxWrap version to libcxxwrap version?

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

No branches or pull requests

1 participant