Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Help with cmake / Qt5 migration needed

667 views
Skip to first unread message

Andrey Rahmatullin

unread,
Oct 19, 2017, 10:20:02 AM10/19/17
to
On Thu, Oct 19, 2017 at 04:11:49PM +0200, Andreas Tille wrote:
> I'd like to package beads[1] which is Qt4 but since Qt4 will be droped
> soon my goal is to port it to Qt5. With my current packaging attempt[1]
> I get:
>
> CMake Error at src/CMakeLists.txt:4 (FIND_PACKAGE):
> Found package configuration file:
>
> /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake
>
> but it set Qt5_FOUND to FALSE so package "Qt5" is considered to be NOT
> FOUND. Reason given by package:
>
> The Qt5 package requires at least one component
>
>
> The FIND_PACKAGE line was patched by me where I naively did
>
> s/Qt4 REQUIRED/Qt5 REQUIRED/
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
or something.
This doesn't guarantee that the code will compile, of course.

> [1] https://anonscm.debian.org/git/debian-med/beads.git
No repositories found


--
WBR, wRAR
signature.asc

Andreas Tille

unread,
Oct 19, 2017, 10:20:02 AM10/19/17
to
Hi,

I'd like to package beads[1] which is Qt4 but since Qt4 will be droped
soon my goal is to port it to Qt5. With my current packaging attempt[1]
I get:

CMake Error at src/CMakeLists.txt:4 (FIND_PACKAGE):
Found package configuration file:

/usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake

but it set Qt5_FOUND to FALSE so package "Qt5" is considered to be NOT
FOUND. Reason given by package:

The Qt5 package requires at least one component


The FIND_PACKAGE line was patched by me where I naively did

s/Qt4 REQUIRED/Qt5 REQUIRED/

Any hint how to get this build is welcome.

Kind regards

Andreas.

[1] https://anonscm.debian.org/git/debian-med/beads.git

--
http://fam-tille.de

Andreas Tille

unread,
Oct 19, 2017, 1:00:02 PM10/19/17
to
Hi Andrey,

On Thu, Oct 19, 2017 at 07:16:47PM +0500, Andrey Rahmatullin wrote:
> On Thu, Oct 19, 2017 at 04:11:49PM +0200, Andreas Tille wrote:
> > The FIND_PACKAGE line was patched by me where I naively did
> >
> > s/Qt4 REQUIRED/Qt5 REQUIRED/
> find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
> or something.
> This doesn't guarantee that the code will compile, of course.

This helped me a but further I was also able to fix some more issues.

Now I'm struck by

CMake Error at src/qtbeads/CMakeLists.txt:83 (QT5_ADD_TRANSLATION):
Unknown CMake command "QT5_ADD_TRANSLATION".


here also my naive s/QT4_ADD_TRANSLATION/QT5_ADD_TRANSLATION/
did not worked an my web search was not successful. :-(

> > [1] https://anonscm.debian.org/git/debian-med/beads.git
> No repositories found

Strange. I was able to create a fresh clone from this URL.

Kind regards

Andreas.


--
http://fam-tille.de

Andreas Tille

unread,
Oct 19, 2017, 4:50:02 PM10/19/17
to
On Thu, Oct 19, 2017 at 07:18:45PM +0200, Wout B wrote:
> Have you added the LinguistTools component too? I think it depends on that.

Ahhh, another step forward and I fixed some more in [1].

Now the configuration seems to be finalised but I get:

...
cd /build/beads-1.1.13/obj-x86_64-linux-gnu/src && /usr/bin/c++ -DHAVE_PTHREAD_H -DQT_NO_DEBUG_OUTPUT -I/build/beads-1.1.13/src/X11_INCLUDE_DIR -g -O2 -fdebug-prefix-map=/build/beads-1.1.
In file included from /build/beads-1.1.13/src/beads.cpp:1:0:
/build/beads-1.1.13/src/beads.h:19:10: fatal error: QDebug: No such file or directory
#include <QDebug>
^~~~~~~~
compilation terminated.
src/CMakeFiles/beads.dir/build.make:65: recipe for target 'src/CMakeFiles/beads.dir/beads.cpp.o' failed
make[3]: *** [src/CMakeFiles/beads.dir/beads.cpp.o] Error 1
...


What next?

Thanks for all the helpful hints in any case

Andreas.


> > > [1] https://anonscm.debian.org/git/debian-med/beads.git
> > No repositories found
>
> Strange. I was able to create a fresh clone from this URL.
>
> Kind regards
>
> Andreas.
>
>
> --
> http://fam-tille.de

--
http://fam-tille.de

Wout B

unread,
Oct 20, 2017, 4:40:02 AM10/20/17
to
Shouldn't it be #include <QtCore/qdebug.h>? I may be wrong though.

Op 19 okt. 2017 10:41 p.m. schreef "Andreas Tille" <and...@an3as.eu>:

Andreas Tille

unread,
Oct 20, 2017, 5:10:03 AM10/20/17
to
Hi again,

On Fri, Oct 20, 2017 at 10:30:08AM +0200, Wout B wrote:
> Shouldn't it be #include <QtCore/qdebug.h>? I may be wrong though.

I replaced all instances of '#include <QDebug>' by
'#include <QtCore/qdebug.h>' and the error now occures in some other
file (not sure whether this is by chance due to parallel build):

cd /build/beads-1.1.13/obj-x86_64-linux-gnu/src/qtbeads && /usr/bin/c++ -DHAVE_PTHREAD_H -DQT_NO_DEBUG_OUTPUT -I/build/beads-1.1.13/src/X11_INCLUDE_DIR -I/build/beads-1.1.13/obj-x86_64-linux-gnu -g -O2 -fdebug-prefix-map=/build/beads-1.1.13=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -Wall -o CMakeFiles/qtbeads.dir/__/images/imageIntensity.cpp.o -c /build/beads-1.1.13/src/images/imageIntensity.cpp
In file included from /build/beads-1.1.13/src/images/imageIntensity.cpp:1:0:
/build/beads-1.1.13/src/images/imageIntensity.h:4:10: fatal error: QtCore/qdebug.h: No such file or directory
#include <QtCore/qdebug.h>
^~~~~~~~~~~~~~~~~
compilation terminated.


I verified that my chroot has

# find /usr/include -name qdebug.h
/usr/include/x86_64-linux-gnu/qt5/QtCore/qdebug.h


but I'm somehow missing some proper -I option to tell gcc where to seek
for the qt5 includes. I'm afraid that the cmake configuration was not
fully successful. Any further hints?

Kind regards

Andreas.
--
http://fam-tille.de

Wout B

unread,
Oct 20, 2017, 6:00:02 AM10/20/17
to
It looks like the initial #include <QDebug> was actually correct and that it indeed doesn't find it somehow. Manually adding Qt5::Core and Qt5::Widgets to target_link_libraries seems to work though. Then there's still some error (declaration of 'float t' shadows template parameter), but I don't know how to fix that one.

Op 20 okt. 2017 11:03 a.m. schreef "Andreas Tille" <and...@an3as.eu>:

Andreas Tille

unread,
Oct 20, 2017, 8:30:02 AM10/20/17
to
Hi again,

On Fri, Oct 20, 2017 at 11:55:22AM +0200, Wout B wrote:
> It looks like the initial #include <QDebug> was actually correct and that
> it indeed doesn't find it somehow. Manually adding Qt5::Core and
> Qt5::Widgets to target_link_libraries seems to work though.

I can confirm that this helps - thanks a lot!

> Then there's
> still some error (declaration of 'float t' shadows template parameter), but
> I don't know how to fix that one.

I think I fixed this by removing the code copy of CImg.h and using the
Debian packaged version instead. But the QDebug issue came back and
may be I need another trick to tweak src/qtbeads/CMakeLists.txt that
the -I directive is inserted properly:

...
cd /build/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads && /usr/bin/c++ -DHAVE_PTHREAD_H -DQT_NO_DEBUG_OUTPUT -I/build/beads-1.1.13+dfsg/src/X11_INCLUDE_DIR -I/build/beads-1.1.13+dfsg
In file included from /build/beads-1.1.13+dfsg/src/images/imageIntensity.cpp:1:0:
/build/beads-1.1.13+dfsg/src/images/imageIntensity.h:4:10: fatal error: QDebug: No such file or directory
#include <QDebug>
^~~~~~~~
compilation terminated.
src/qtbeads/CMakeFiles/qtbeads.dir/build.make:145: recipe for target 'src/qtbeads/CMakeFiles/qtbeads.dir/__/images/imageIntensity.cpp.o' failed
make[3]: *** [src/qtbeads/CMakeFiles/qtbeads.dir/__/images/imageIntensity.cpp.o] Error 1
...

I have the feeling that this might be the last hint I need. ;-)

Thanks for all your help

Juhani Numminen

unread,
Oct 20, 2017, 11:20:02 AM10/20/17
to
Andreas Tille kirjoitti 20.10.2017 klo 15:29:
> Hi again,
>
> On Fri, Oct 20, 2017 at 11:55:22AM +0200, Wout B wrote:
>> It looks like the initial #include <QDebug> was actually correct and
that
>> it indeed doesn't find it somehow. Manually adding Qt5::Core and
>> Qt5::Widgets to target_link_libraries seems to work though.
>
> I can confirm that this helps - thanks a lot!
>
>> Then there's
>> still some error (declaration of 'float t' shadows template
parameter), but
>> I don't know how to fix that one.
>
> I think I fixed this by removing the code copy of CImg.h and using the
> Debian packaged version instead. But the QDebug issue came back and
> may be I need another trick to tweak src/qtbeads/CMakeLists.txt that
> the -I directive is inserted properly:

Didn't test this, but it seems you have missed this required change in
src/qtbeads/CMakeLists.txt:

-TARGET_LINK_LIBRARIES( qtbeads ${QT_LIBRARIES} ...
+TARGET_LINK_LIBRARIES( qtbeads Qt::Widgets ...

I can't see that line in the patch at
> [1] https://anonscm.debian.org/git/debian-med/beads.git


Juhani

Andreas Tille

unread,
Oct 20, 2017, 11:50:02 AM10/20/17
to
Hi Juhani,

On Fri, Oct 20, 2017 at 06:14:02PM +0300, Juhani Numminen wrote:
> > I think I fixed this by removing the code copy of CImg.h and using the
> > Debian packaged version instead. But the QDebug issue came back and
> > may be I need another trick to tweak src/qtbeads/CMakeLists.txt that
> > the -I directive is inserted properly:
>
> Didn't test this, but it seems you have missed this required change in
> src/qtbeads/CMakeLists.txt:
>
> -TARGET_LINK_LIBRARIES( qtbeads ${QT_LIBRARIES} ...
> +TARGET_LINK_LIBRARIES( qtbeads Qt::Widgets ...
>
> I can't see that line in the patch at
> > [1] https://anonscm.debian.org/git/debian-med/beads.git

Its in line 86 now but does not help.

Juhani Numminen

unread,
Oct 20, 2017, 1:50:02 PM10/20/17
to
Hi Andreas,
My bad, it should have been Qt5::Widgets (not Qt but Qt5).

Fixing that gets us to a point where the compiler cannot find the header
<QPrinter>, which is a part of another Qt5 module: PrintSupport.

So we must add the component "PrintSupport" there:
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core LinguistTools Widgets)
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core LinguistTools PrintSupport
Widgets)

And Qt5::PrintSupport there:
TARGET_LINK_LIBRARIES( qtbeads Qt::Widgets ...
TARGET_LINK_LIBRARIES( qtbeads Qt5::Widgets Qt5::PrintSupport ...

I think that's the build system sorted, even though the compilation
still fails. Now you probably need to add some includes.


Juhani

Andreas Tille

unread,
Oct 21, 2017, 2:30:02 AM10/21/17
to
Hi Juhani,

thanks a lot for your help.

On Fri, Oct 20, 2017 at 08:41:35PM +0300, Juhani Numminen wrote:
>
> I think that's the build system sorted, even though the compilation still
> fails. Now you probably need to add some includes.

I was able to add the said includes but somehow this project is balky.
Now I get:


...
cd /home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads && /usr/bin/c++ -DHAVE_PTHREAD_H -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG
In file included from /usr/include/CImg.h:337:0,
from /home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/../../../src/qtbeads/../images/imageCode.h:7,
from /home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/../../../src/qtbeads/../images/imageIntensity.h:7,
from /home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/../../../src/qtbeads/properties.h:13,
from /home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/../../../src/qtbeads/main_window.h:17,
from /home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/moc_main_window.cpp:9:
/home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/moc_main_window.cpp:106:33: error: expected unqualified-id before ‘int’
QMetaType::Void, QMetaType::Bool, 10,
^
/home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/moc_main_window.cpp:106:33: error: expected ‘}’ before ‘int’
/home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/moc_main_window.cpp:118:1: error: expected declaration before ‘}’ token
};
^
src/qtbeads/CMakeFiles/qtbeads.dir/build.make:793: die Regel für Ziel „src/qtbeads/CMakeFiles/qtbeads.dir/moc_main_window.cpp.o“ scheiterte
...


somehow the file obj-x86_64-linux-gnu/src/qtbeads/moc_main_window.cpp is
autogenerated and I have no idea where to fix it. The suspicious line 106
looks like this (I added the line numbering to the context):

68 static const uint qt_meta_data_MainWindow[] = {
69
70 // content:
71 7, // revision
72 0, // classname
...
99 // slots: parameters
100 QMetaType::Void,
101 QMetaType::Void,
102 QMetaType::Void,
103 QMetaType::Void,
104 QMetaType::Void,
105 QMetaType::Void, 0x80000000 | 7, 8,
106 QMetaType::Void, QMetaType::Bool, 10,
107 QMetaType::Void,
108 QMetaType::Void,
109 QMetaType::Void,
110 QMetaType::Void,
111 QMetaType::Void,
112 QMetaType::Void,
113 QMetaType::Void, 0x80000000 | 18, 19,
114 QMetaType::Void, 0x80000000 | 18, 19,
115 QMetaType::Void, 0x80000000 | 18, 19,
116
117 0 // eod
118 };


Any hint how to fix this?

Juhani Numminen

unread,
Oct 21, 2017, 6:20:02 AM10/21/17
to
Hi Andreas,

Andreas Tille kirjoitti 21.10.2017 klo 09:22:
> Hi Juhani,
>
> thanks a lot for your help.

I'm happy to help you.

> On Fri, Oct 20, 2017 at 08:41:35PM +0300, Juhani Numminen wrote:
>>
>> I think that's the build system sorted, even though the compilation still
>> fails. Now you probably need to add some includes.
>
> I was able to add the said includes but somehow this project is balky.
> Now I get:
>
> ...
> /home/andreas/debian-maintain/alioth/debian-med_git/build-area/beads-1.1.13+dfsg/obj-x86_64-linux-gnu/src/qtbeads/moc_main_window.cpp:106:33: error: expected unqualified-id before ‘int’
> QMetaType::Void, QMetaType::Bool, 10,
> ^
>
> Any hint how to fix this?

I did some searching, and this has happened to others[1][2]. This stems
from Xlib.h that defines a preprocessor macro called "Bool", and the fix
is to #undef Bool.

Then there was link error: libX11.so.6: error adding symbols: DSO
missing, which I managed to fix with -lX11.

Please have a look at the git repo[3], branch qt5-patches, where I
pushed my fixes.


Juhani

[1] https://forum.qt.io/topic/41817/
[2] http://www.qcustomplot.com/index.php/support/forum/818
[3] https://github.com/jnumm/beads_debian
0 new messages