Skip to content

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

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
hosiet opened this issue Jan 9, 2024 · 4 comments
Closed

Comments

@hosiet
Copy link
Contributor

hosiet commented Jan 9, 2024

zbar/configure.ac

Lines 664 to 683 in 6ea7392

AS_IF([test "x$with_qt" != "xno"],
[AS_IF([test "x$with_qt6" != "xno"],
PKG_CHECK_MODULES([QT],
[Qt6],
[MOC=`pkg-config Qt6 --variable=moc`
QT_VERSION=`$PKG_CONFIG Qt6 --modversion`
QT6_HEADERS=`pkg-config Qt6 --variable=headerdir`
CPPFLAGS="$CPPFLAGS -I$QT6_HEADERS -I$QT6_HEADERS/QtWidgets -I$QT6_HEADERS/QtCore -I$QT6_HEADERS/QtGui"
qt_pkgconfig_file="zbar-qt5.pc"
],
[with_qt6="no"]))
AS_IF([test "x$with_qt6" = "xno"],
PKG_CHECK_MODULES([QT],
[Qt5Core >= 5 Qt5Gui >= 5 Qt5Widgets >= 5.0 Qt5X11Extras >= 5.0],
[MOC=`pkg-config Qt5 --variable=moc`
QT_VERSION=`$PKG_CONFIG Qt5 --modversion`
qt_pkgconfig_file="zbar-qt5.pc"
],
[with_qt="no"]))
])

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
Copy link

jubalh commented Jan 22, 2024

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
Copy link
Owner

mchehab commented Jan 22, 2024

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:

  • a Qt5 pkg-config file is at /usr/lib64/pkgconfig/Qt5.pc (see qt5-qtbase-devel-5.15.11-7.fc39.x86_64);
  • a Qt6 pkg-config file is at /usr/lib64/pkgconfig/Qt6.pc (see qt6-qtbase-devel-6.6.0-6.fc39.x86_64).

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
Copy link
Owner

mchehab commented Jan 22, 2024

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 pushed a commit that referenced this issue Jan 22, 2024
Bug: #277
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
@mchehab
Copy link
Owner

mchehab commented Jan 22, 2024

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

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

3 participants