Qt/Cross-compile: different output size compared to included Yocto build


We have an C++/Qt application, let’s call it company-app.

If we cross compile this company-app on our Ubuntu dev machine with the meta-toolchain-qt5, we currently get a binary with about ~17MB.

We use the following script in our build pipeline:

. /usr/local/oecore-x86_64/environment-setup-cortexa9t2hf-neon-angstrom-linux-gnueabi
cd build
qmake ../../src/company-app.pro

Binaries from Qt Creator have the same size.

However, we also included the company-app into our yocto build layer. The compiled binary distributed with the rootfs has only 397.5KB.

To include the company-app into the linux image, we use the following recipe:

SUMMARY = "Company App"
PV = "3.4.0"

DEPENDS = "qtbase qtdeclarative qtserialport qtwebsockets"

SRCREV = "235390469084523543245"
SRC_URI = "git://example.com:22/project;protocol=ssh;branch=master"

S = "${WORKDIR}/git/src"

inherit qmake5 systemd

RDEPENDS_${PN} += "qtbase \
				   qtbase-plugins \
				   qtdeclarative \
				   qtdeclarative-plugins \
				   qtserialport \
				   qtwebsockets \
				   packagegroup-fonts-truetype \
				   sqlite3 \

do_install () {

SYSTEMD_SERVICE_${PN} = "company-app.service"

Now I am really interested, how can there be such a huge size difference?

The linux image and the company-app are both compiled on the same machine.

Maybe has it something to do with static/dynamic linking?


I guess that the bigger one is not stripped.
Run ‘file company-app’ on both and check the output.

You can use the crosstoolchain’s strip utility to remove the unneeded sections from your app.


Hi @max.tx

Thanks for the suggestion. You are right.

I didn’t even knew about this.

BR Christian

You are welcome.