Skip to content

CMake build fail on macOS with QT5 "Not found: 'lib/qt/plugins/platforms/libqcocoa\.dylib'" #361

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

Closed
essandess opened this issue Jul 16, 2020 · 2 comments

Comments

@essandess
Copy link

I'm writing a MacPorts port of python-opencv and am hitting an issue with cmake failing because it can't find lib/qt/plugins/platforms/libqcocoa\.dylib.

I have QT5 installed—this lib file exists here:

/opt/local/libexec/qt5/plugins/platforms/libqcocoa.dylib

I tried modifying setup.py to point to this file, but am hitting the exact same error.

This looks like it should be a simply fix by either setting a CMake option or modifying setup.py. Any pointers would be appreciated.

https://github.com/skvark/opencv-python/blob/11e478ca7f5d65f12820c0146f3401bfc597fd32/setup.py#L151

:info:build Traceback (most recent call last):
:info:build   File "setup.py", line 439, in <module>
:info:build     main()
:info:build   File "setup.py", line 226, in main
:info:build     cmake_source_dir=cmake_source_dir,
:info:build   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/skbuild/setuptools_wrap.py", line 625, in setup
:info:build     cmake_source_dir, skbuild_kw['cmake_install_dir'])
:info:build   File "setup.py", line 339, in _classify_installed_files_override
:info:build     raise Exception("Not found: '%s'" % relpath_re)
:info:build Exception: Not found: 'libexec/qt5/plugins/platforms/libqcocoa\.dylib'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_ports_graphics_opencv4/py37-opencv/work/opencv-python-4.3.0.36" && /opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 setup.py --no-user-cfg bdist_wheel -j12

Related:

@skvark
Copy link
Member

skvark commented Jul 16, 2020

The current setup.py works reliably only on the very specific Travis macOS environment where the CI builds are run. Important part is this patch: https://github.com/skvark/opencv-python/blob/master/patches/patchQtPlugins

Unless you are creating a "universal" relocatable macOS wheel with delocate the platform plugin is not important. If you are, then you must modify that patch so that if copies the platform plugin correctly.

Note that I'm merging soon (probably during this week) proper sdist support to master branch which addresses many hard-coded things in setup.py and adds source distribution to PyPI. It will also add support for proper isolated builds with pip wheel command and pyproject.toml. That patch and plugin copying code will most likely be applied only to CI builds in this repo because they depend on the build environment so you might want to wait for those changes.

Current status here: https://github.com/skvark/opencv-python/tree/feat/sdist

@essandess
Copy link
Author

Thanks. I got this running, including with a fast LAPACK build, by modifying setup.py.

I believe that this line is a bug, and this is the fix:

https://github.com/macports/macports-ports/blob/c4e1fead718bcb7f257b2a33d53e7142771bf70b/graphics/opencv4/files/setup.py.patch#L8

For the macOS build commands and flags, see the Portfile in macports/macports-ports#6261

@skvark skvark closed this as completed Aug 9, 2020
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

2 participants