Yggdrasil icon indicating copy to clipboard operation
Yggdrasil copied to clipboard

Add comment to OpenCV to force rebuild

Open cdsousa opened this issue 1 year ago • 6 comments

OpenCV.jl is not working in Julia 1.10 (https://github.com/JuliaImages/OpenCV.jl/issues/36). It seems to have something to do with OpenCV_jll, something like it not being compiled against the newest CxxWrap and libjulia. Trying a rebuild.

cdsousa avatar Jan 12 '24 16:01 cdsousa

Looks like upstream opencv needs to update the Julia modules because the Julia API has changed. The errors being thrown on the 1.11 build are:

[17:45:27] In file included from /workspace/srcdir/build/modules/julia/gen/autogen_cpp/cv_core.cpp:6:
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:192:66: error: too few arguments provided to function-like macro invocation
[17:45:27]     return iterator(static_cast<julia_t*>(jl_array_data(wrapped())));
[17:45:27]                                                                  ^
[17:45:27] /workspace/destdir/include/julia/julia.h:1132:9: note: macro 'jl_array_data' defined here
[17:45:27] #define jl_array_data(a,t) ((t*)((jl_array_t*)(a))->ref.ptr_or_offset)
[17:45:27]         ^
[17:45:27] In file included from /workspace/srcdir/build/modules/julia/gen/autogen_cpp/cv_core.cpp:6:
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:197:72: error: too few arguments provided to function-like macro invocation
[17:45:27]     return const_iterator(static_cast<julia_t*>(jl_array_data(wrapped())));
[17:45:27]                                                                        ^
[17:45:27] /workspace/destdir/include/julia/julia.h:1132:9: note: macro 'jl_array_data' defined here
[17:45:27] #define jl_array_data(a,t) ((t*)((jl_array_t*)(a))->ref.ptr_or_offset)
[17:45:27]         ^
[17:45:27] In file included from /workspace/srcdir/build/modules/julia/gen/autogen_cpp/cv_core.cpp:6:
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:202:66: error: too few arguments provided to function-like macro invocation
[17:45:27]     return iterator(static_cast<julia_t*>(jl_array_data(wrapped())) + jl_array_len(wrapped()));
[17:45:27]                                                                  ^
[17:45:27] /workspace/destdir/include/julia/julia.h:1132:9: note: macro 'jl_array_data' defined here
[17:45:27] #define jl_array_data(a,t) ((t*)((jl_array_t*)(a))->ref.ptr_or_offset)
[17:45:27]         ^
[17:45:27] In file included from /workspace/srcdir/build/modules/julia/gen/autogen_cpp/cv_core.cpp:6:
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:207:72: error: too few arguments provided to function-like macro invocation
[17:45:27]     return const_iterator(static_cast<julia_t*>(jl_array_data(wrapped())) + jl_array_len(wrapped()));
[17:45:27]                                                                        ^
[17:45:27] /workspace/destdir/include/julia/julia.h:1132:9: note: macro 'jl_array_data' defined here
[17:45:27] #define jl_array_data(a,t) ((t*)((jl_array_t*)(a))->ref.ptr_or_offset)
[17:45:27]         ^
[17:45:27] In file included from /workspace/srcdir/build/modules/julia/gen/autogen_cpp/cv_core.cpp:6:
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:224:45: error: too few arguments provided to function-like macro invocation
[17:45:27]     return (julia_t*)jl_array_data(wrapped());
[17:45:27]                                             ^
[17:45:27] /workspace/destdir/include/julia/julia.h:1132:9: note: macro 'jl_array_data' defined here
[17:45:27] #define jl_array_data(a,t) ((t*)((jl_array_t*)(a))->ref.ptr_or_offset)
[17:45:27]         ^
[17:45:27] In file included from /workspace/srcdir/build/modules/julia/gen/autogen_cpp/cv_core.cpp:6:
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:229:45: error: too few arguments provided to function-like macro invocation
[17:45:27]     return (julia_t*)jl_array_data(wrapped());
[17:45:27]                                             ^
[17:45:27] /workspace/destdir/include/julia/julia.h:1132:9: note: macro 'jl_array_data' defined here
[17:45:27] #define jl_array_data(a,t) ((t*)((jl_array_t*)(a))->ref.ptr_or_offset)
[17:45:27]         ^
[17:45:27] In file included from /workspace/srcdir/build/modules/julia/gen/autogen_cpp/cv_core.cpp:6:
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:192:43: error: use of undeclared identifier 'jl_array_data'
[17:45:27]     return iterator(static_cast<julia_t*>(jl_array_data(wrapped())));
[17:45:27]                                           ^
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:197:49: error: use of undeclared identifier 'jl_array_data'
[17:45:27]     return const_iterator(static_cast<julia_t*>(jl_array_data(wrapped())));
[17:45:27]                                                 ^
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:202:43: error: use of undeclared identifier 'jl_array_data'
[17:45:27]     return iterator(static_cast<julia_t*>(jl_array_data(wrapped())) + jl_array_len(wrapped()));
[17:45:27]                                           ^
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:207:49: error: use of undeclared identifier 'jl_array_data'
[17:45:27]     return const_iterator(static_cast<julia_t*>(jl_array_data(wrapped())) + jl_array_len(wrapped()));
[17:45:27]                                                 ^
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:224:22: error: use of undeclared identifier 'jl_array_data'
[17:45:27]     return (julia_t*)jl_array_data(wrapped());
[17:45:27]                      ^
[17:45:27] /workspace/srcdir/build/modules/julia/gen/autogen_cpp/jlcxx/array.hpp:229:22: error: use of undeclared identifier 'jl_array_data'
[17:45:27]     return (julia_t*)jl_array_data(wrapped());
[17:45:27]                      ^

The FreeBSD builds are failing because the headers have changed, and so it needs another include statement added to the file:

[16:43:59] /workspace/srcdir/build/3rdparty/ippicv/ippicv_lnx/iw/src/iw_own.c:84:12: error: call to undeclared library function 'memalign' with type 'void *(unsigned long, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
[16:43:59]     return memalign(iAlign, iSize);
[16:43:59]            ^
[16:43:59] /workspace/srcdir/build/3rdparty/ippicv/ippicv_lnx/iw/src/iw_own.c:84:12: note: include the header <malloc.h> or explicitly provide a declaration for 'memalign'

imciner2 avatar Jan 12 '24 22:01 imciner2

I can confirm that using the new artifact OpenCV.v4.6.0.x86_64-linux-gnu-cxx11-julia_version+1.10.0.tar.gz and OpenCV.jl from https://github.com/JuliaImages/OpenCV.jl/pull/28 seems to fix the issue reported at https://github.com/JuliaImages/OpenCV.jl/issues/36, although it gives an error during precompilation:

  1 dependency had output during precompilation:
┌ OpenCV
│  ┌ Error: Calling `@wrapmodule` with the path of the library to load is no longer supported.
│  │ Pass the name of a function returning the path instead, e.g. use `libfoo_jll.get_libfoo_path` instead of `libfoo_jll.libfoo`.
│  └ @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/5IZvn/src/CxxWrap.jl:729
└

cdsousa avatar Jan 13 '24 09:01 cdsousa

Any update on this?

marcoxa avatar May 31 '24 15:05 marcoxa

Any update on this? OpenCV throws a precompilation error on my machine for Julia 1.10. I've read in another thread that downgrading Julia 1.9 works but I'd hate to do that if a fix is coming soon.

brianguenter avatar Jul 28 '24 22:07 brianguenter

If no one resolves the issues discussed above, no.

giordano avatar Jul 28 '24 22:07 giordano

Hi

I explored the issue a bit. AFAIU you must "fix" the binding generation in OpenCV, which is a major (time wise) undertaking, given the - ahem - less than optimal way the OpenCV headers are munched and their representation spewed up. Plus you need knowledge of all the way Julia binds to C++.

All the best

Marco

marcoxa avatar Jul 29 '24 06:07 marcoxa