Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fails with Julia 1.9? #326

Closed
laurentbartholdi opened this issue Aug 27, 2022 · 4 comments
Closed

Fails with Julia 1.9? #326

laurentbartholdi opened this issue Aug 27, 2022 · 4 comments

Comments

@laurentbartholdi
Copy link

I tried the simple example from the manual,

JLCXX_MODULE define_julia_module(jlcxx::Module& mod)
{
  FLAGS_fst_error_fatal = false;
  
  mod.add_type<MyStruct>("MyStruct");
  
  mod.method("greet", []() {return "Hello";});
}

which runs fine in Julia 1.8, but not in dev (1.9.0-DEV.1189 (2022-08-26)): the error message appears in

julia> using XXX
C++ exception while wrapping module XXX: invalid subtyping in definition of MyStruct with supertype Any
ERROR: LoadError: invalid subtyping in definition of MyStruct with supertype Any

By the way, both 1.8 and 1.9 define the method "greet", but it does not return a string, rather a pointer:

julia> XXX.greet()
CxxWrap.CxxWrapCore.ConstCxxPtr{CxxWrap.CxxWrapCore.CxxChar}(Ptr{CxxWrap.CxxWrapCore.CxxChar} @0x0000000146bf5985)
@barche
Copy link
Collaborator

barche commented Aug 28, 2022

The issue is that you need to build both libcxxwrap-julia and the example code against Julia 1.9, since there is a binary incompatibility between 1.8 and 1.9. Unfortunately at this time I can't build against 1.9, erroring on this:

/usr/bin/ld: test/CMakeFiles/test_type_init.dir/test_type_init.cpp.o: copy relocation against non-copyable protected symbol `jl_unionall_type'

@fingolfin Have you encountered this?

@maleadt
Copy link
Member

maleadt commented Nov 17, 2022

Would it be possible to provide artifacts for Julia 1.9 and 1.10 (aka. the Julia master branch), or alternatively, refuse installation on unsupported versions (i.e. don't provide an artifact so that packages fail to load)? Currently, CxxWrap dependents crash hard (with a segfault), and those crashes are prominently featured in every PkgEval report.

One example: ConnectFourSolver.jl

[47] signal (11.1): Segmentation fault
in expression starting at /home/pkgeval/.julia/packages/CxxWrap/94t40/src/StdLib.jl:17
ijl_new_datatype at /cache/build/default-amdci4-5/julialang/julia-master/src/datatype.c:717
_ZN5jlcxx12new_datatypeEP9_jl_sym_tP12_jl_module_tP14_jl_datatype_tP9jl_svec_tS7_S7_iii at /home/pkgeval/.julia/artifacts/d54a2909808f0f05123ef98f8eef4fcde1073e52/lib/libcxxwrap_julia.so.0 (unknown line)
_ZN5jlcxx6Module17add_type_internalINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_13ParameterListIJEEE11_jl_value_tEENS_11TypeWrapperIT_EERKS7_PT1_ at /home/pkgeval/.julia/artifacts/d54a2909808f0f05123ef98f8eef4fcde1073e52/lib/libcxxwrap_julia_stl.so (unknown line)
define_cxxwrap_stl_module at /home/pkgeval/.julia/artifacts/d54a2909808f0f05123ef98f8eef4fcde1073e52/lib/libcxxwrap_julia_stl.so (unknown line)
register_julia_module at /home/pkgeval/.julia/artifacts/d54a2909808f0f05123ef98f8eef4fcde1073e52/lib/libcxxwrap_julia.so.0 (unknown line)
register_julia_module at /home/pkgeval/.julia/packages/CxxWrap/94t40/src/CxxWrap.jl:399 [inlined]
readmodule at /home/pkgeval/.julia/packages/CxxWrap/94t40/src/CxxWrap.jl:694
wrapmodule at /home/pkgeval/.julia/packages/CxxWrap/94t40/src/CxxWrap.jl:698

@fingolfin
Copy link
Contributor

Cxxwrap binaries for 1.9 have been in use by us since shortly after Julia master switched to 1.9 . For 1.10 the binaries were released today, just a few days after Julia master adopted that version number.

AFAIK ConnectFour has its own JLL, which its maintainer will have to update

@barche
Copy link
Collaborator

barche commented Nov 19, 2022

Closing here since this is tracked now at the ConnectFourSolver repl.

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

No branches or pull requests

4 participants