Cross-compiled Qt6 libraries are huge!
-
I'm attempting to deploy a Qt Quick app to an embedded target with limited resources. Building the application is fine, but getting the Qt libraries on to the target is proving very challenging!
I'm using a Linux x86_64 machine to build, because that's what the vendor toolchain (Digi Embedded Yocto,
arm-dey-linux-gnueabi) supports. After setting up the cross compilation environment, my latest attempt configures like so:../qt-everywhere-src-6.8.3/configure -release -opengl es2 -nomake examples -nomake tests -skip qtquick3d -skip qtgraphs -skip qtquick3dphysics -skip qtwebview -skip qtwebengine -skip qtdoc -skip qtopcua -skip qtremoteobjects -skip qtscxml -skip qtwebchannel -skip qtspeech -qt-host-path /opt/Qt/6.8.3/gcc_64 -extprefix /path/to/local/install -prefix /opt/QtThe resulting libraries are huge:

Everywhere else I see these libraries they are 10MB or less. Even in the vendor provided images! Alas there's no pre-built image with Qt5Compat, so I'm DIYing it.
I've been experimenting with variations of
-ltcg -reduce-exportsand-skipbut at 4 hours per iteration is slow going. My next attempt will be with-static. But I'm worried I'm barking up the wrong tree. Perhaps there's a fundamental limitation with yocto toolchains? -
Hi @liteyear,
Are these libraries stripped? (You can test with the
filecommand). My guess is they still contain debug symbols.Regards
@aha_1980 OMG you're right!
$ file ../qt-install/lib/libQt6Core.so.6.8.3 ../qt-install/lib/libQt6Core.so.6.8.3: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=ae13d6cd44f2f88e7f2be51eab194d12fed14f20, with debug_info, not strippedWhat part of "release build" results in debug symbols? FWIW, here's the top of
config.summary:Building for: linux-g++ (arm, CPU features: neon) Compiler: gcc 13.4.0 Build options: Mode ................................... release Optimize release build for size ........ no Fully optimize release builds (-O3) .... no Building shared libraries .............. yes Using ccache ........................... no Unity Build ............................ no Using new DTAGS ........................ yes Relocatable ............................ yes Using precompiled headers .............. yes Using Link Time Optimization (LTCG) .... yesI've looked all over the Internet for configure/build settings to reduce size, and haven't found any mention of debug symbols. Even "stripping" has resulted in deadends. Can I remove them?
-
@aha_1980 OMG you're right!
$ file ../qt-install/lib/libQt6Core.so.6.8.3 ../qt-install/lib/libQt6Core.so.6.8.3: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=ae13d6cd44f2f88e7f2be51eab194d12fed14f20, with debug_info, not strippedWhat part of "release build" results in debug symbols? FWIW, here's the top of
config.summary:Building for: linux-g++ (arm, CPU features: neon) Compiler: gcc 13.4.0 Build options: Mode ................................... release Optimize release build for size ........ no Fully optimize release builds (-O3) .... no Building shared libraries .............. yes Using ccache ........................... no Unity Build ............................ no Using new DTAGS ........................ yes Relocatable ............................ yes Using precompiled headers .............. yes Using Link Time Optimization (LTCG) .... yesI've looked all over the Internet for configure/build settings to reduce size, and haven't found any mention of debug symbols. Even "stripping" has resulted in deadends. Can I remove them?
Well I did the most basic thing I could think of:
arm-dey-linux-gnueabi-strip --strip-unneeded lib/*.so.6.8.3 lib/*.aAnd whaddya know:

Why was that step necessary? I can't find mention of it anywhere, even in the Building Optimized Qt page.