In our yocto-based embedded application, we now have several Golang binaries, which can become very large. For example, docker (from meta-virtualization) and related binaries weigh in with several 100 megabytes if uncompressed. Therefore, we created recipes to compress those binaries with upx. As an example, here is our docker-ce_git.bbappend:
do_install_append() {
/usr/bin/upx --brute ${D}/${bindir}/docker
/usr/bin/upx --brute ${D}/${bindir}/dockerd
/usr/bin/upx --brute ${D}/${bindir}/docker-proxy
}
This leads to the following error during the bake process:
ERROR: docker-ce-19.03.2-ce+git6a30dfca03664a0b6bf0646a7d389ee7d0318e6e-r0 do_package: QA Issue: File '/usr/bin/docker' from docker-ce was already stripped, this will prevent future debugging! [already-stripped]
ERROR: docker-ce-19.03.2-ce+git6a30dfca03664a0b6bf0646a7d389ee7d0318e6e-r0 do_package: QA Issue: File '/usr/bin/docker-proxy' from docker-ce was already stripped, this will prevent future debugging! [already-stripped]
ERROR: docker-ce-19.03.2-ce+git6a30dfca03664a0b6bf0646a7d389ee7d0318e6e-r0 do_package: QA Issue: File '/usr/bin/dockerd' from docker-ce was already stripped, this will prevent future debugging! [already-stripped]
OK, this makes sense. If we wanted to create a debug build, we wouldn't want to strip those binaries.
But: how do we do conditional stripping correctly? I guess there is some kind of stripping stage only executed for non-debug builds, which we could attach to with do_strip_append() or something similar, but so far, I have come up empty searching the documentation.