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

Make libopencv independent of python version #364

Open
h-vetinari opened this issue Jun 6, 2023 · 4 comments · May be fixed by #365
Open

Make libopencv independent of python version #364

h-vetinari opened this issue Jun 6, 2023 · 4 comments · May be fixed by #365

Comments

@h-vetinari
Copy link
Member

h-vetinari commented Jun 6, 2023

Looking at the content of libopencv, it's essentially completely free of python, with the sole exception of:

lib/python3.<x>/site-packages/cv2.<abi-tag>.so

It should be possible to build libopencv once, then base the various python builds on top of that (which would then contain the stuff in $SP_DIR like the above cv2.<abi-tag>.so). This would also have the benefit of dividing our build matrix by ~6, as we're now looking at 136(!!!) jobs in #363.

We could also split off the binaries under some output-name. This is getting to be the "gold standard" as far as I understood the various discussions around this (can provide references if desired) and is being used in a few feedstocks (that do lib+bins[+py]) like thrift-cpp, sentencepiece, and probably a bunch more that I'm not familiar with.

@traversaro
Copy link
Contributor

Fortunatly it seems that there is support for building the python bindings on their own, see https://github.com/opencv/opencv/blob/af03e000c7efc29544d964c4601f0269c2c8950b/modules/python/CMakeLists.txt#L38 , so hopefully this does not require a lot of changes at the CMake level.

@hmaarrfk
Copy link
Contributor

hmaarrfk commented Jun 6, 2023

At the time of writing the recipe, it was pretty hard with conda machinery to make the recipe reuse a certain portion of itself.

For more historical details, see the comment in the recipe.

Improvements are always welcome!

Personally, i think it might be a good way to reduce the build matrix.

@h-vetinari
Copy link
Member Author

I've started on a branch, but looking at the logic Silvio linked, the standalone builds really want to find a file we're not currently shipping, and building that file with the libopencv looks like it might be persisting a bit more than I'd like, aside from the also annoying issue that then the python-less lib still needs a python to build. Haven't followed this thread to its conclusion yet.

@h-vetinari
Copy link
Member Author

It might be easiest to patch that file a bit so the bindings get built with python itself. That would IMO be a much saner model than (how I currently understand) standalone.cmake, which also hasn't been touched in ~4 years.

@h-vetinari h-vetinari linked a pull request Jun 25, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants