[Interest] Qt5 cross-compilation and installation, INSTALL_ROOT behavior

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Mon Jan 14 22:14:51 CET 2013


Hello,

I am one of the core developers of the Buildroot embedded Linux build
system, currently packaging Qt5. I have one issue, that I already had
with Qt4, so I'd like to see if there a way to solve it.

Usually, to cross-compile autotools-based packages, one do:

	./configure --prefix=/usr --host=arm-linux-gnueabi
	make
	make DESTDIR=/embedded/target install
	make DESTDIR=/embedded/staging install

You typically install things twice because in /embedded/target you want
to have only the files useful for execution, completely stripped, while
in /embedded/staging you want to keep all debugging symbols to help in
debugging. /embedded/target goes in your target embedded system,
while /embedded/staging is kept on your development machine, and is
used to build more applications and to do remote debugging.

Within Qt5, this could be translated as:

	./configure -prefix /usr -device <something>
	make
	make INSTALL_ROOT=/embedded/target install
	make INSTALL_ROOT=/embedded/staging install

But Qt5 has host utilities, not only tools for the target. And instead
of having to build Qt twice, it nicely allows to do the build of host
tools and target libraries in just one build, which is really nice. So,
one typically does:

	./configure -prefix /usr -hostprefix /embedded/host -device <something>
	make
	make INSTALL_ROOT=/embedded/target install
	make INSTALL_ROOT=/embedded/staging install

Unfortunately, the INSTALL_ROOT does not only impact target libraries,
but also the host utilities. So they end up
in /embedded/target/embedded/host which obviously isn't correct.

For the moment, I am solving this by doing:

	./configure -prefix /usr -hostprefix /embedded/host -sysroot /embedded/staging -device <something>
	make
	make install

So, it properly installs target libraries in /embedded/staging and host
utilities in /embedded/host. However, to install the libraries
in /embedded/target I need to manually copy them, since I can't use the
INSTALL_ROOT variable, or it would install things
in /embedded/target/embedded/staging if I did
INSTALL_ROOT=/embedded/target for example. Unfortunately, manually
copying the libraries is annoying because you don't know exactly what
each Qt5 module is installing in terms of libraries and plugins.

And once qmake is configured with the hardcoded sysroot, it also
affects the installation of qt5svg, qt5script and all other Qt5
modules, so we can't use INSTALL_ROOT for them as well.

Ideally, the host tools install should not be affected by INSTALL_ROOT.
INSTALL_ROOT should only modify the installation location of target
libraries, but host tools should be kept in the path given as the
-hostprefix argument during configuration.

What do you think?

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com



More information about the Interest mailing list