Yocto Bitbake Remove or Disable .debug Folder Being Created - Stack Overflow

admin2025-04-16  3

In my bitbake yocto development environment, I'm trying to get the onnxruntime library to not add this .debug folder to our development images as its too large for our devices we're building for.

/usr/bin/onnxruntime-1.10.0/tests/.debug$ tree .
.
├── libcustom_op_library.so
├── onnxruntime_api_tests_without_env
├── onnxruntime_global_thread_pools_test
├── onnxruntime_mlas_test
├── onnxruntime_shared_lib_test
└── onnxruntime_test_all

0 directories, 6 files

Removing the onnxruntime-dev package, cleaning the cache and rebuilding doesn't seem to remove that .debug folder like you'd expect it to do.

I'm relatively new to the Bitbake and Yocto area, so maybe I'm missing a step to disable a packageconfig option that disables it from being added.

Is there a simpler way to remove that folder from the image using a bbappend file?

Any recommendations/help is much appreciated.

In my bitbake yocto development environment, I'm trying to get the onnxruntime library to not add this .debug folder to our development images as its too large for our devices we're building for.

/usr/bin/onnxruntime-1.10.0/tests/.debug$ tree .
.
├── libcustom_op_library.so
├── onnxruntime_api_tests_without_env
├── onnxruntime_global_thread_pools_test
├── onnxruntime_mlas_test
├── onnxruntime_shared_lib_test
└── onnxruntime_test_all

0 directories, 6 files

Removing the onnxruntime-dev package, cleaning the cache and rebuilding doesn't seem to remove that .debug folder like you'd expect it to do.

I'm relatively new to the Bitbake and Yocto area, so maybe I'm missing a step to disable a packageconfig option that disables it from being added.

Is there a simpler way to remove that folder from the image using a bbappend file?

Any recommendations/help is much appreciated.

Share Improve this question asked Feb 3 at 17:09 aoeuaoeu 1544 silver badges15 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

The contents of the .debug directories should be packaged separately into the onnxruntime-dbg package so whilst the build will be bigger, the on target install shouldn't be impacted unless you choose to install the -dbg package.

I'd therefore check firstly if it is being packaged separately and if not, why not. If it is, find out why the -dbg package is being installed into your image and stop that from happening.

Oddly enough, the onnxruntime package doesn't have any packageconfig, or package that specifies -dbg -dev or any other related package. This was thoroughly checked using various bitbake commands and other methods to try and disable these non-exsistent packages.

I've come to an odd solution. I'm posting it here in case anyone else needs to forcibly remove a specific directory for a package.

# This removes the python library added by the package
PACKAGECONFIG:remove = "python"
# Needed for forcing the installation of this package even though it doesn't use what it compiles

INSANE_SKIP:${PN} += "installed-vs-shipped"
ALLOW_EMPTY:${PN} = "1"

ROOTFS_POSTPROCESS_COMMAND += "remove_debug_dir;"
remove_debug_dir() {
    rm -rf ${IMAGE_ROOTFS}/usr/bin/${PN}
}

do_install:append() {
    rm -rf ${D}${bindir}/${BP}
}

rm_debug() {
    rm -rf ${D}/usr/bin/${PN}
}
do_package_qa[postfuncs] += "rm_debug"

If there is a better way of doing this, please let me know and I'll be happy to try it.

转载请注明原文地址:http://anycun.com/QandA/1744759243a87213.html