opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.37k stars 5.75k forks source link

Build fails on compilation of Julia bindings -- `Mirrored types (marked with IsMirroredType) can't be added` #3531

Open dfenn opened 1 year ago

dfenn commented 1 year ago

System Information

OpenCV version: 4.8.0 Operating System / Platform: Ubuntu 22.04.2 LTS (WSL2) Compiler & compiler version: GCC 11.3.0

Detailed description

Error while compiling Julia bindings (using CxxWrap version 0.9.7):

In file included from <path>/libcxxwrap-julia/include/jlcxx/jlcxx.hpp:15,
                 from <path>/opencv-4.8.0/build/modules/julia/gen/autogen_cpp/cv_core.cpp:7:
<path>/libcxxwrap-julia/include/jlcxx/module.hpp: In instantiation of ‘jlcxx::TypeWrapper<T> jlcxx::Module::add_type_internal(const string&, JLSuperT*) [with T = cv::RotatedRect; SuperParametersT = jlcxx::ParameterList<>; JLSuperT = _jl_datatype_t; std::string = std::__cxx11::basic_string<char>]’:
<path>/libcxxwrap-julia/include/jlcxx/module.hpp:1222:48:   required from ‘jlcxx::TypeWrapper<T> jlcxx::Module::add_type(const string&, JLSuperT*) [with T = cv::RotatedRect; SuperParametersT = jlcxx::ParameterList<>; JLSuperT = _jl_datatype_t; std::string = std::__cxx11::basic_string<char>]’
<path>/opencv-4.8.0/build/modules/julia/gen/autogen_cpp/cv_core.cpp:246:30:   required from here
<path>/libcxxwrap-julia/include/jlcxx/module.hpp:1144:17: error: static assertion failed: Mirrored types (marked with IsMirroredType) can't be added using add_type, map them directly to a struct instead and use map_type or explicitly disable mirroring for this type, e.g. define template<> struct IsMirroredType<Foo> : std::false_type { };

Could possibly be related to this CxxWrap issue, but I'm not familiar enough with the code to say: https://github.com/JuliaInterop/CxxWrap.jl/issues/271

Steps to reproduce

I built CxxWrap following the instructions here: https://docs.opencv.org/4.x/d8/da4/tutorial_julia.html. That all completed successfully.

I configured OpenCV using -D WITH_JULIA=ON.

The build failed.

Issue submission checklist

asmorkalov commented 1 year ago

The issue transferred to opencv_contrib as all Julia related things are hosted there.

asmorkalov commented 1 year ago

@archit120 Could you take a look on it?

ooxx-tw commented 1 year ago

Hi, I have similar problem. environment: Ubuntu 22.04 .... -- Found Julia executable: /home/User/julia/bin/julia -- Julia_VERSION_STRING: 1.6.7 -- Julia_INCLUDE_DIRS: /home/User/julia/include/julia -- Julia_LIBRARY_DIR: /home/User/julia/lib -- Julia_LIBRARY: /home/User/julia/lib/libjulia.so.1 -- JULIA_HOME: /home/User/julia/bin -- Julia_LLVM_VERSION: v11.0.1 -- Julia_WORD_SIZE: 64 -- JlCxx_DIR: /home/User/.julia/artifacts/c26cbccbc5075a22f2b34a08dd9c9ad52d58f381/lib/cmake/JlCxx ....

Consolidate compiler generated dependencies of target opencv_julia [ 89%] Building CXX object modules/julia/CMakeFiles/opencv_julia.dir/gen/autogen_cpp/cv_core.cpp.o In file included from /home/User/.julia/artifacts/c26cbccbc5075a22f2b34a08dd9c9ad52d58f381/include/jlcxx/jlcxx.hpp:15, from /home/User/opencv/build/modules/julia/gen/autogen_cpp/cv_core.cpp:7: /home/User/.julia/artifacts/c26cbccbc5075a22f2b34a08dd9c9ad52d58f381/include/jlcxx/module.hpp: In instantiation of ‘jlcxx::TypeWrapper jlcxx::Module::add_type_internal(const string&, JLSuperT) [with T = cv::RotatedRect; SuperParametersT = jlcxx::ParameterList<>; JLSuperT = _jl_datatype_t; std::string = std::__cxx11::basic_string]’: /home/User/.julia/artifacts/c26cbccbc5075a22f2b34a08dd9c9ad52d58f381/include/jlcxx/module.hpp:1222:48: required from ‘jlcxx::TypeWrapper jlcxx::Module::add_type(const string&, JLSuperT) [with T = cv::RotatedRect; SuperParametersT = jlcxx::ParameterList<>; JLSuperT = _jl_datatype_t; std::string = std::__cxx11::basic_string]’ /home/User/opencv/build/modules/julia/gen/autogen_cpp/cv_core.cpp:246:30: required from here /home/User/.julia/artifacts/c26cbccbc5075a22f2b34a08dd9c9ad52d58f381/include/jlcxx/module.hpp:1144:17: error: static assertion failed: Mirrored types (marked with IsMirroredType) can't be added using add_type, map them directly to a struct instead and use map_type or explicitly disable mirroring for this type, e.g. define template<> struct IsMirroredType : std::false_type { }; 1144 | static_assert(!IsMirroredType::value, "Mirrored types (marked with IsMirroredType) can't be added using add_type, map them directly to a struct instead and use map_type or explicitly disable mirroring for this type, e.g. define template<> struct IsMirroredType : std::false_type { };"); | ^~~~~~~~~ /home/User/.julia/artifacts/c26cbccbc5075a22f2b34a08dd9c9ad52d58f381/include/jlcxx/module.hpp:1144:17: note: ‘!(bool)std::integral_constant<bool, true>::value’ evaluates to false make[2]: [modules/julia/CMakeFiles/opencv_julia.dir/build.make:90: modules/julia/CMakeFiles/opencv_julia.dir/gen/autogen_cpp/cv_core.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:7512: modules/julia/CMakeFiles/opencv_julia.dir/all] Error 2 make: *** [Makefile:166: all] Error 2