opencv / opencv/opencv-python

OpenCV custom Linux built whl doesn't include Qt libraries

Open
#1,020 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

I'm building OpenCV with Qt support for Linux. Resulting whl file doesn't include Qt libraries as expected (whl from the pypi.org has no such problem, all libs (Qt and others) are included there).

Steps to reproduce.

Run Ubuntu in docker container:

docker run -it --rm -v /tmp/out:/out ubuntu:20.04

Run inside docker container:

# Prepare system
apt update && apt upgrade -y
DEBIAN_FRONTEND=noninteractive apt install -y python3-pip build-essential patchelf libgl1-mesa-glx libglib2.0-0 python3 python3-dev qt5-default git unzip

# Build and install opencv-python
git clone --recursive https://github.com/opencv/opencv-python.git

cd opencv-python/

export CMAKE_BUILD_PARALLEL_LEVEL=8
export CMAKE_ARGS="-DWITH_QT=ON"

pip wheel . --verbose

# Unpack and check resulting file:
mkdir test
cd test
cp ../opencv_python*whl out.zip
unzip out.zip

find . | grep -i qt # No Qt library is included
ldd cv2/cv2.abi3.so  | grep -i qt # cv2 so has Qt dependency

How can I build package with all libraries included?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the build in the Ubuntu 20.04 Docker container using the listed apt packages, CMAKE_ARGS, and pip wheel command. Inspect the unpacked wheel and cv2/cv2.abi3.so with find and ldd, then compare them with the PyPI wheel. Done means the custom wheel includes the required Qt libraries and its Qt dependencies resolve correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, docker, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.