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

Error in v0.12.0 #143

Closed
sloede opened this issue Jan 19, 2024 · 4 comments · Fixed by #144
Closed

Error in v0.12.0 #143

sloede opened this issue Jan 19, 2024 · 4 comments · Fixed by #144

Comments

@sloede
Copy link
Contributor

sloede commented Jan 19, 2024

I am completely befuddled by this:

With libopenfhe_julia_jll.jl, which is used by OpenFHE.jl and which I just released a new version for, I now get the following error:

ERROR: LoadError: Double registration for method (:constructor, :SharedPtr, :OpenFHE, 0x764f54ca19ae174d)
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
   @ ~/work/OpenFHE.jl/OpenFHE.jl/src/OpenFHE.jl:11
 [7] include
   @ ./Base.jl:419 [inlined]
 [8] 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, UInt64}}, source::String)
   @ Base ./loading.jl:1554
 [9] top-level scope
   @ stdin:1
in expression starting at /home/runner/work/OpenFHE.jl/OpenFHE.jl/src/OpenFHE.jl:1
in expression starting at stdin:1
munmap_chunk(): invalid pointer

signal (6): Aborted
in expression starting at none:0
pthread_kill at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)

<snip>

The weird thing is that it seems like a Heisenbug: If I build this locally and downgrade the version of the openfhe-julia library or of libcxxwrap-julia (I get the error with main), it seems to work again, even if I afterwards update both libraries to the latest respective versions again.

EDIT: I can confirm that it occurs with libcxxwrap-julia v0.12.0 but not with v0.11.2.

@barche Have you seen such an error before and have maybe an inkling about where I should start looking for a bug?

@sloede sloede changed the title LoadError: Double registration for method (:constructor, :SharedPtr, :OpenFHE, 0x764f54ca19ae174d) Error in v0.12.0 Jan 19, 2024
@sloede
Copy link
Contributor Author

sloede commented Jan 19, 2024

I can confirm that the issue does occur with 24906be, but not with c244461.

@sloede
Copy link
Contributor Author

sloede commented Jan 19, 2024

To reproduce on Ubuntu 22.04 (at least it works on my machine [famous last words]):

set -eo pipefail

# install OpenFHE
git clone git@github.com:openfheorg/openfhe-development.git
cd openfhe-development
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install \
  -DBUILD_BENCHMARKS=OFF -DBUILD_UNITTESTS=OFF \
  -DWITH_BE2=ON -DWITH_BE4=ON
make -j 4
make install
cd ../..

# install libcxxwrap-julia
git clone git@github.com:JuliaInterop/libcxxwrap-julia.git
cd libcxxwrap-julia
git checkout v0.12.0
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install
make -j 4
make install
cd ../..

# install OpenFHE-julia
git clone git@github.com:sloede/openfhe-julia.git
cd openfhe-julia
mkdir build && cd build
prefix_path="$(pwd)/../../libcxxwrap-julia/install/;$(pwd)/../../openfhe-development/install/"
cmake .. -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_PREFIX_PATH="$prefix_path"
make -j 4
make install
cd ../..

# install OpenFHE.jl
git clone git@github.com:sloede/OpenFHE.jl.git
cd OpenFHE.jl
mkdir run && cd run
libopenfhe_julia="$(dirname $(dirname $(pwd)))/openfhe-julia/build/lib/libopenfhe_julia.so"
cat << EOF >> LocalPreferences.toml
[OpenFHE]
libopenfhe_julia = "$libopenfhe_julia"
EOF
cd ../..

julia --project=OpenFHE.jl/run -e 'using Pkg; Pkg.develop(path="OpenFHE.jl"); Pkg.instantiate()'

@sloede
Copy link
Contributor Author

sloede commented Jan 25, 2024

@barche Any idea what is going on here and/or what to do to fix it? Right now, we continue to build our JLLs against v0.11.2, but I don't believe that this is a good permanent solution...

@barche
Copy link
Contributor

barche commented Jan 25, 2024

Sorry, I should make this more clear somewhere: when there is a breaking change in libcxxwrap-julia, this will also imply a breaking change in CxxWrap.jl. Currently I relased the new JLL, but not yet the new CxxWrap, so due to compat restrictions libcxxwrap_julia_jll version 0.11.2 is the one that gets installed. Until the next CxxWrap is released I indeed recommend to keep building against libcxxwrap-julia 0.11.2.

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.

2 participants