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

Installation error of OpenCV.jl with julia 1.10.2. #39

Closed
kyhps2 opened this issue Mar 25, 2024 · 21 comments
Closed

Installation error of OpenCV.jl with julia 1.10.2. #39

kyhps2 opened this issue Mar 25, 2024 · 21 comments

Comments

@kyhps2
Copy link

kyhps2 commented Mar 25, 2024

There is an installation error of OpenCV.jl with julia 1.10.2.
I got error message as follows.

(new_env) pkg> add OpenCV

 Updating `D:\Study_00_Programming\Julia\SourceCodes\new_env\Manifest.toml`
⌅ [1f15a43c] + CxxWrap v0.13.4
  [692b3bcd] + JLLWrappers v1.5.0
  [1914dd2f] + MacroTools v0.5.13
...
[83775a58] + Zlib_jll v1.2.13+1
[8e850ede] + nghttp2_jll v1.52.0+1
[3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Precompiling project...
  ✗ CxxWrap
  ✗ OpenCV_jll
  ✗ OpenCV
  0 dependencies successfully precompiled in 6 seconds. 43 already precompiled.
  3 dependencies errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

What's wrong with OpenCV.jl ?

@ashwanirathee
Copy link
Member

Hey, Images.jl is the standard package for image processing in Julia and OpenCV.jl is barely standing in older versions if even then.

@jgardona
Copy link

jgardona commented May 4, 2024

Guys are not maintaining julia packages. This issue is not only with this package, but many other. Don´t know whats happening with julia language. Its losing traction.

@marcoxa
Copy link

marcoxa commented May 24, 2024

Hey, Images.jl is the standard package for image processing in Julia and OpenCV.jl is barely standing in older versions if even then.

Hi

I am sorry, but this comment contradicts the statement that OpenCV is now part of JuliaImages.
But, even if that were not the case, we still have the problem of loading time for large .tif images with the vanilla JuliaImages library, even when using ImageMagik.

This seems a problem related to CxxWrap and its artifact. It'd be better stating that fact somewhere (and nag the CxxWrap maintainers).

All the best

Marco

PS No. I am a "luser", not a developer!

@marcoxa
Copy link

marcoxa commented May 24, 2024

Guys are not maintaining julia packages. This issue is not only with this package, but many other. Don´t know whats happening with julia language. Its losing traction.

Too much testosterone (and masochism) flowing towards crustaceans :)

@andrew-saydjari
Copy link

Looks like the simple fix is to bump the Cxx compat to include 0.16 (or anything higher than 0.15) rather than the 0.13 max that is currently there. Can someone with permissions do that? (see this thread JuliaInterop/CxxWrap.jl#424)

@likanzhan
Copy link

Is there an update on this problem?

@andrew-saydjari
Copy link

I think the solution I suggested could be an easy fix, though I don't have the permissions and/or time to fix. I ended up taking @ashwani-rathee's advice, which worked for my case.

I had installed a slightly old package, tried to use an image with it, and it return error messages asking me to add OpenCV.jl (and some other packages). However, ignoring those error message requests and just installing and using Images.jl (and some of the other modern images ecosystem like ImageIO.jl) fixed all of my problems. So it seems like maybe part of the problem is that the error messages are leading people to older packages rather that the newer ecosystem? In any case, you should give that a try, unless OpenCV.jl is an explicit dependency of a package you are trying to use.

@likanzhan
Copy link

@andrew-saydjari Thanks. But OpenCV.jl is The package I'm trying to use.

@ViralBShah
Copy link
Contributor

ViralBShah commented Oct 13, 2024

Attempting to see if we can get this package working and refreshed (even though Images.jl is the way to go). See #47. Help and maintainers appreciated.

CXXWrap has new versions and they seem to work fine when included in Project.toml. However at least on mac, the opencv binaries seem to be having some trouble:

Failed to precompile OpenCV [f878e3a2-a245-4720-8660-60795d644f2a] to "/Users/viral/.julia/compiled/v1.11/OpenCV/jl_D2QmTK".
ERROR: LoadError: InitError: could not load library "/Users/viral/.julia/artifacts/de765a133b59d07e526969499bb9ca2eb1ced0ae/lib/libopencv_julia.dylib"
dlopen(/Users/viral/.julia/artifacts/de765a133b59d07e526969499bb9ca2eb1ced0ae/lib/libopencv_julia.dylib, 0x0001): Symbol not found: _small_typeof
  Referenced from: <25F123D7-824D-3E50-B73E-DF5C0FFB8F95> /Users/viral/.julia/artifacts/de765a133b59d07e526969499bb9ca2eb1ced0ae/lib/libopencv_julia.dylib
  Expected in:     <40B6F0D0-DAB1-3208-86D2-4648FA0BEA0F> /Users/viral/.julia/juliaup/julia-1.11.0+0.aarch64.apple.darwin14/lib/libjulia.1.11.0.dylib

Attempting to build newer versions here JuliaPackaging/Yggdrasil#9602, but probably all the patches need to be checked again if still needed and re-applied to 4.10 if required.

@marcoxa
Copy link

marcoxa commented Oct 13, 2024 via email

@ViralBShah
Copy link
Contributor

ViralBShah commented Oct 13, 2024

It seems like what needs to be done is what is described in JuliaPackaging/Yggdrasil#8820 (comment). This actually feels tractable.

As a first step let's try to rebuild the Yggdrasil recipe with the latest opencv and the suggested modifications.

@ksil
Copy link

ksil commented Oct 13, 2024

Thanks for the help @ViralBShah. Facing the same issues and came across this timely thread! As another data point, I compiled libcxxwrap-julia (0.13.2) from source and successfully overrode the artifact (confirmed with CxxWrap.prefix_path(), julia 1.11.0, CxxWrap 0.16.0). I then built OpenCV from source (4.10.0) along with the julia module and ended up with this compiler error:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__algorithm/pop_heap.h:53:7: error: no matching function for call to '__sift_up'
      std::__sift_up<_AlgPolicy>(__first, __hole, __comp_ref, __hole - __first);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__algorithm/pop_heap.h:65:8: note: in instantiation of function template specialization 'std::__pop_heap<std::_ClassicAlgPolicy, std::less<cv::Point_<float>>, std::__wrap_iter<cv::Point_<float> *>>' requested here
  std::__pop_heap<_ClassicAlgPolicy>(std::move(__first), std::move(__last), __comp, __len);
       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/queue:1095:12: note: in instantiation of function template specialization 'std::pop_heap<std::__wrap_iter<cv::Point_<float> *>, std::less<cv::Point_<float>>>' requested here
    _VSTD::pop_heap(c.begin(), c.end(), comp);
           ^
/Users/kevin/repos/libcxxwrap-julia/include/jlcxx/stl.hpp:271:52: note: in instantiation of member function 'std::priority_queue<cv::Point_<float>>::pop' requested here
    wrapped.method("pq_pop!", [] (WrappedT& v) { v.pop(); });
                                                   ^
/Users/kevin/repos/libcxxwrap-julia/include/jlcxx/module.hpp:1225:5: note: in instantiation of function template specialization 'jlcxx::stl::WrapPriorityQueue::operator()<jlcxx::TypeWrapper<std::priority_queue<cv::Point_<float>>>>' requested here
    apply_ftor(TypeWrapper<AppliedT>(m_module, app_dt, app_box_dt));
    ^
/Users/kevin/repos/libcxxwrap-julia/include/jlcxx/module.hpp:1174:34: note: in instantiation of function template specialization 'jlcxx::TypeWrapper<jlcxx::Parametric<jlcxx::TypeVar<1>>>::apply_internal<std::priority_queue<cv::Point_<float>>, jlcxx::stl::WrapPriorityQueue>' requested here
    auto dummy = {this->template apply_internal<AppliedTypesT>(std::forward<FunctorT>(apply_ftor))...};
                                 ^
/Users/kevin/repos/libcxxwrap-julia/include/jlcxx/stl.hpp:387:63: note: (skipping 8 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
    TypeWrapper1(mod, StlWrappers::instance().priority_queue).apply<std::priority_queue<T>>(WrapPriorityQueue());
                                                              ^
/Users/kevin/repos/libcxxwrap-julia/include/jlcxx/module.hpp:241:6: note: in instantiation of function template specialization 'jlcxx::create_if_not_exists<std::vector<cv::Point_<float>> &>' requested here
    (create_if_not_exists<Args>(), ...);
     ^
/Users/kevin/repos/libcxxwrap-julia/include/jlcxx/module.hpp:779:29: note: in instantiation of member function 'jlcxx::FunctionWrapper<void, cv::Subdiv2D &, std::vector<cv::Point_<float>> &>::FunctionWrapper' requested here
    auto* new_wrapper = new FunctionWrapper<R, Args...>(this, f);
                            ^
/Users/kevin/repos/libcxxwrap-julia/include/jlcxx/module.hpp:773:12: note: in instantiation of function template specialization 'jlcxx::Module::method_helper<void, cv::Subdiv2D &, std::vector<cv::Point_<float>> &>' requested here
    return method_helper(name, std::function<R(ArgsT...)>(std::forward<LambdaT>(lambda)), std::move(extraData));
           ^
/Users/kevin/repos/libcxxwrap-julia/include/jlcxx/module.hpp:614:12: note: in instantiation of function template specialization 'jlcxx::Module::lambda_helper<void, (lambda at /Users/kevin/repos/opencv/build/modules/julia/gen/autogen_cpp/cv_core.cpp:433:63), cv::Subdiv2D &, std::vector<cv::Point_<float>> &>' requested here
    return lambda_helper(name, std::forward<LambdaT>(lambda), &LambdaT::operator(), std::move(extraData));
           ^
/Users/kevin/repos/opencv/build/modules/julia/gen/autogen_cpp/cv_core.cpp:433:9: note: in instantiation of function template specialization 'jlcxx::Module::method<(lambda at /Users/kevin/repos/opencv/build/modules/julia/gen/autogen_cpp/cv_core.cpp:433:63), true>' requested here
    mod.method("jlopencv_cv_cv_Subdiv2D_cv_Subdiv2D_insert",  [](cv::Subdiv2D& cobj, vector<Point2f>& ptvec) { cobj.insert(ptvec);  ;});
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/c++/v1/__algorithm/push_heap.h:32:6: note: candidate template ignored: substitution failure [with _AlgPolicy = std::_ClassicAlgPolicy, _Compare = std::less<cv::Point_<float>> &, _RandomAccessIterator = std::__wrap_iter<cv::Point_<float> *>]
void __sift_up(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp,

I'm on an intel macbook pro running Sonoma 14.2.1.

So there's some weirdness happening with the OpenCV module in addition to the artifacts potentially... Let me know if I can help guinea pig anything. I may try building with older versions of everything involved.

@ViralBShah
Copy link
Contributor

Where is this compiler error? I assume this is in the building of the C++ bindings. I think the first step might be to try with Julia 1.10, since 1.11 does need some updates based on the comments in the Yggdrasil PR.

cc @barche

@ViralBShah
Copy link
Contributor

It would also be nice to start getting a PR going on Yggdrasil for others to try this out.

@ksil
Copy link

ksil commented Oct 14, 2024

Yeah, sorry, this is indeed in the building of the C++ bindings in the OpenCV repo. Will try that out...

@barche
Copy link

barche commented Oct 15, 2024

The particular error above may actually be related to added STL support in libcxxwrap, which seems problematic on some apple compilers. I think it's best to try to build using binarybuilder, maybe in a draft PR on Yggdrasil.

@barche
Copy link

barche commented Oct 20, 2024

I updated PR JuliaPackaging/Yggdrasil#8820 and created an opencv_contrib branch with the changes here: https://github.com/barche/opencv_contrib/tree/julia-fixes

@ViralBShah
Copy link
Contributor

@ksil Could you try out the binaries from the Yggdrasil PR?

@barche
Copy link

barche commented Oct 22, 2024

I tried them and they don't work with the error that C++ type float is not mapped to Julia (❓). The reason isn't immediately obvious, so I'll need to do some debugging on this.

@ViralBShah
Copy link
Contributor

Very close to running again: #47

@ViralBShah
Copy link
Contributor

Would be nice if you can try the dev version and verify.

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

No branches or pull requests

9 participants