Experimental cross compiling Qt in Debian packages


[Some time ago we the Qt/KDE team were contacted by [Helmut Grohne. He was trying to cross compile Debian packages in general thanks to Ubuntu/Debian's multi-arch support, and he was having problems with Qt-based ones.]{style="background-color: white;"}]{style="font-family: inherit;"}
[[
]{style="background-color: white;"}]{style="font-family: inherit;"}[[As far as we understand Qt upstreams only support cross compiling by having a toolchain for each pair of architectures involved. In Debian terms, and only considering current official architectures, that would mean building 90 cross toolchains. It clearly doesn't scale.]{style="background-color: white;"}]{style="font-family: inherit;"}
[[
]{style="background-color: white;"}]{style="font-family: inherit;"}[[So we set up to discuss if somehow we could use multiarch to let debian packages using Qt to cross compile.]{style="background-color: white;"}]{style="font-family: inherit;"}
[[
]{style="background-color: white;"}]{style="font-family: inherit;"}[[In the meantime Enrico Zini had the same idea. He wrote a nice summary of the situation at that time in his blog.]{style="background-color: white;"}]{style="font-family: inherit;"}
[[
]{style="background-color: white;"}]{style="font-family: inherit;"}[After many thinking some ideas were tested and we've got to the point of solving/hacking the issue. As this is not something directly supported by upstream you should take care, and file bugs whenever necessary.]{style="background-color: white;"}
[
]{style="background-color: white;"}[Dmitry Schachnev from our team's side and Helmut from the debian-cross side worked a lot on it, and I would like to present what they have done. To be fair it's mostly described in our team's gobby qt-cross page, but I would like to give it some publicity in order to let people know about it and why not, find and help solving bugs.]{style="background-color: white;"}
[[
]{.underline}]{style="background-color: white;"}[General stuff]{style="background-color: white;"}
[
]{style="background-color: white;"}[The first thing that was done was to move Qt binaries from their (Debian original) multi-arch path to a non multi-arch one, providing symlinks for compatibility. In this way the path of the binaries is the same for any arch (why they were not there is a long story, but nothing to worry now).]{style="background-color: white;"}

This move needed some other touches, like qtchooser being updated with the new paths.

The other changes where related to how we do our packaging:

  • All packages containing binaries are now M-A:foreign.
  • Some packages (qt3d, qtwayland) had binaries split to allow that.
  • qttools5-dev-tools now depends on libqt5sql5-sqlite (not uploaded yet)
**qmake related changes**
We also needed to address qmake. To begin with we splitted the package containing it into qt5-qmake-bin (M-A:foreign) and qt5-qmake (M-A:same). The first one has the binaries and the second the relevant mkspecs for some arch.
The rest of the "magic" comes from debhelper. It generates a qt.conf file with the right paths for each cross compilation and also passes cross QMAKE\_CC and QMAKE\_CXX to qmake when needed.

[[
]{style="background-color: white;"}]{style="font-family: inherit;"}[[autotools]{style="background-color: white;"}]{style="font-family: inherit;"}
[[
]{style="background-color: white;"}]{style="font-family: inherit;"}qt5-qmake will ship /usr/bin/\$(DEB_HOST_GNU_TYPE)-qmake executable for use with AC_CHECK_TOOL (not uploaded yet).

There is still work to be done, but so far we have been able to cross compile packages using for example sbuild.

Edit 20171129 11:43 ARST: You should really look at the new Enrico's post.

Comments


There are no comments yet.

Add a Comment

You can use the Markdown syntax to format your comment.

Comment Atom Feed