`munmap_chunk(): invalid pointer` when wrapping a C++ package

Hello community,

I’ve been trying to wrap a C++ package using CxxWrap.jl. My wrapper code and CMakeList.txt are available here, and they seem to work locally. Then, using this build_tarballs.jl I created a jll package ghostbasil_jll which is deployed to my github succesfully but seems to cause mysterious crashes in Julia.

The problem:
I cannot get the jll package to work as intended even though my wrappers work locally. The current package crashes Julia on exit without running anything.

MWE: (this only works on Linux with julia 1.8.x and 1.9.x):

(@v1.8) pkg> add https://github.com/biona001/ghostbasil_jll.jl
julia> using CxxWrap
julia> using ghostbasil_jll
julia> @wrapmodule(ghostbasil_jll.get_libghostbasil_wrap_path)
julia> exit()

*** Error in `julia': munmap_chunk(): invalid pointer: 0x00007fa6ff48e390 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7f474)[0x7fa7196ce474]
/home/groups/sabatti/.julia/artifacts/2702bda90fb3f2d2791de7a87abf4a78f55a597f/lib/libghostbasil_wrap.so(_ZN5jlcxx15FunctionWrapperISt6vectorIdSaIdEEJNS_8ArrayRefIdLi2EEES5_NS4_IdLi1EEES6_llmmbbmmmddmEED0Ev+0x34)[0x7fa6f2c4af44]
/home/groups/sabatti/.julia/artifacts/d25a86126e4d79572040fbf3f1fcda158a703a4a/lib/libcxxwrap_julia.so(_ZNSt15_Sp_counted_ptrIPN5jlcxx6ModuleELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv+0x105)[0x7fa6f784aba5]
/home/groups/sabatti/.julia/artifacts/d25a86126e4d79572040fbf3f1fcda158a703a4a/lib/libcxxwrap_julia.so(_ZNSt8_Rb_treeIP12_jl_module_tSt4pairIKS1_St10shared_ptrIN5jlcxx6ModuleEEESt10_Select1stIS8_ESt4lessIS1_ESaIS8_EE8_M_eraseEPSt13_Rb_tree_nodeIS8_E+0xb2)[0x7fa6f784af82]
/lib64/libc.so.6(+0x39ce9)[0x7fa719688ce9]
/lib64/libc.so.6(+0x39d37)[0x7fa719688d37]

... error truncated.

What could be going on here? I’m not sure if this is an issue with my C++ code, my build_tarballs.jl, or something internal with CxxWrap.jl? But it seems to crash without calling any of my own code, so I’m not sure what to do. The error message is not meaningful to me.

The issue was due to libcxxwrrap_julia releasing a breaking change, see 0.15 not yet registered (was Regression with 0.15) · Issue #402 · JuliaInterop/CxxWrap.jl · GitHub

It seems that for jll packages depending on libcxxwrap_julia, one should always specify a compat in the build_tarballs.jl, e.g.

Dependency("libcxxwrap_julia_jll"; compat = "0.11.2")
1 Like