mchehab / zbar

ZBar is an open source software suite for reading bar codes from various sources, including webcams. As its development stopped in 2012, I took the task of keeping it updated with the V4L2 API. This is the main repository for it. There's a clone at at LinuxTV.org, and another one at gitlab.
https://linuxtv.org/downloads/zbar/
GNU Lesser General Public License v2.1
964 stars 202 forks source link

Regression: Broken configure.ac in zbar 0.23.93 release (Qt5 related) #277

Closed hosiet closed 8 months ago

hosiet commented 8 months ago

https://github.com/mchehab/zbar/blob/6ea7392beecac015f64ceea1ac11d33b83288e5f/configure.ac#L664-L683

The following issues (actually regressions) exist in this code block:

  1. Hardcoded pkg-config reappears. We should use $PKG_CONFIG whenever possible, as seen in zbar <= 0.23.92.
  2. The AS_IF() macro needs the [ and ] guarding for each of its parameter. In this code, the second parameter of AS_IF() has missing [] around the PKG_CHECK_MODULES() invocation.
  3. The Qt5 detection logic is now broken, compared with zbar 0.23.92. The configure result would be like this:
checking for Qt5Core >= 5 Qt5Gui >= 5 Qt5Widgets >= 5.0 Qt5X11Extras >= 5.0... yes
Package Qt5 was not found in the pkg-config search path.
Perhaps you should add the directory containing `Qt5.pc'
to the PKG_CONFIG_PATH environment variable
Package 'Qt5', required by 'virtual:world', not found
configure: using Qt version 
configure: using moc from 
checking for javac... no
checking for jikes... no

This is due to Qt5 (at least in Linux distributions) never shipped a Qt5.pc anywhere. As a result, the invocation of $PKG_CONFIG Qt5 will never succeed. Please revert to the old logic of detection $MOC and $QT_VERSION or seek other methods that correctly uses Qt5 pkg-config files.

jubalh commented 8 months ago

It appears you have already patches ready at https://salsa.debian.org/debian/zbar/-/tree/master/debian/patches Would you mind creating a PR?

mchehab commented 8 months ago

This is due to Qt5 (at least in Linux distributions) never shipped a Qt5.pc anywhere. As a result, the invocation of $PKG_CONFIG Qt5 will never succeed. Please revert to the old logic of detection $MOC and $QT_VERSION or seek other methods that correctly uses Qt5 pkg-config files.

On Fedora, we have:

Perhaps the logic needs to be changed to try first Qt5.pc, then Qt.pc. If not found, fail back to the old way.

mchehab commented 8 months ago

The upstream changes are there to better cope with installs were both Qt5 and Qt6 devel libs are installed. So, a simple solution like https://salsa.debian.org/debian/zbar/-/blob/master/debian/patches/0003-configure.ac-Use-old-way-to-detect-Qt5.patch may not be doing the right thing.

mchehab commented 8 months ago

Ok, tested applying both patches from Debian: no breakages on Fedora. I'll apply them both.