On Wed, Jul 13, 2016 at 04:16:08PM -0400, Scott Kostyshak wrote: > On Tue, Jul 05, 2016 at 12:02:20PM +0200, Jean-Marc Lasgouttes wrote: > > commit d044986724e98921510c95adecb61d2688b1f598 > > Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> > > Date: Mon Jul 4 16:22:57 2016 +0200 > > > > Autoconf : Try to select the correct Qt tools by using the -qt option > > > > With this change, it is now possible to configure with --enable-qt5 > > and have make use "moc -qt=qt5" automatically. > > > > This is done when the command qtchooser is available nd the desired Qt > > version (qt4/qt5) is available. > > > > This means that it is now possible to have qt4 and qt5 builds easily > > on a same linux system. > > I get an error now with my autotools build script. However, I do not > claim that my build script is correct. I have a setup that is atypical: > I have a custom-compiled Qt that I only want to use to compile LyX and > when I compile other software I do not want that software to find it (I > want them to use the stable Qt dev libraries I have installed). Because > of this atypical setup, I'm guessing I did something wrong that I got > away with before. In any case, here are my findings: > > The following works before this commit: > > export PKG_CONFIG_PATH="/usr/BUILD/BuildQt5-dev/qtbase/lib/pkgconfig/" > export PATH="/usr/BUILD/BuildQt5-dev/qtbase/bin:${PATH}" > ./autogen.sh && ./configure --enable-qt5 && make > > Starting with this commit, the error I get is the following: > > GEN moc_Compare.cpp > Unknown options: q, t, =, q, t, 5. > Makefile:3362: recipe for target 'moc_Compare.cpp' failed > make[2]: *** [moc_Compare.cpp] Error 1
This is because the code first checks for the existence of qtchooser and then assumes that moc & company understand the -qt=qt5 option. Given that you first set the correct PATH, the moc in /usr/BUILD/BuildQt5-dev/qtbase/bin is actually executed, and it doesn't understand that option. Essentially, this occurs because the full path to the qt tools is not retained anymore. I have a setup similar to yours and incurred in a similar problem which I tried to correct at f0aa1299. The solution is using the --with-qt-dir option, without setting PATH and PKG_CONFIG_PATH. This should work: export MYQTDIR=/usr/BUILD/BuildQt5-dev/qtbase ./autogen.sh && ./configure --enable-qt5 --with-qt-dir=$MYQTDIR && make > The following command also does not work with this commit: > > ./autogen.sh && ./configure --enable-qt5 && make > > It gives the following error: > > configure: error: cannot compile a simple Qt executable. Check you have > the right $QTDIR. Strange, this should work and use the Qt5 from the system. > But something I don't understand (and I provide in case it is a clue to > what problem I have in my setup) is that the following does lead to a > complete build: > > ( export PKG_CONFIG_PATH="/usr/BUILD/BuildQt5-dev/qtbase/lib/pkgconfig/" > export PATH="/usr/BUILD/BuildQt5-dev/qtbase/bin:${PATH}" > ./autogen.sh && ./configure --enable-qt5 ) && make This works because the changes to PATH and PKG_CONFIG_PATH are not seen by make, so the qt tools that are actually used are the system ones. However, you should also get a warning after the configure step, because at that point when checking for the moc version, the one found in /usr/BUILD/BuildQt5-dev/qtbase/bin is used, and it doesn't understand the option -qt=qt5. In this way, the right Qt5 is used but the moc and uic from system are actually used. This might work or not, depending on the way moc and uic change from version to version. However, I agree that setting PATH and PKG_CONFIG_PATH as you do it has to work. Please try the attached patch. -- Enrico
diff --git a/config/qt4.m4 b/config/qt4.m4 index f39c0ed..7e6cbb8 100644 --- a/config/qt4.m4 +++ b/config/qt4.m4 @@ -75,7 +75,13 @@ AC_DEFUN([QT_FIND_TOOL], if test -n "$qt_cv_bin" ; then AC_PATH_PROGS($1, [$2], [], $qt_cv_bin) elif qtchooser -l 2>/dev/null | grep -q ^$qt_ext\$ >/dev/null ; then - AC_CHECK_PROG($1, $2, [$2 -qt=$qt_ext],, [$PATH]) + AC_PATH_PROG(qtc_path, qtchooser, [], [$PATH]) + AC_PATH_PROG(moc_path, moc, [], [$PATH]) + qtc_path=$(dirname $qtc_path) + moc_path=$(dirname $moc_path) + if test "$qtc_path" = "$moc_path" ; then + AC_CHECK_PROG($1, $2, [$2 -qt=$qt_ext],, [$PATH]) + fi fi if test -z "$$1"; then AC_CHECK_PROGS($1, [$2-$qt_ext $2],[],$PATH)