Yocto: : does bitbake cleanall ,cleans dependencies as well - yocto

bitbake cleanall
Removes all output files, shared state cache, and downloaded source files for a target
It is not clear or documented if it cleans all build time dependencies as well

If you want to clean everything do,
bitbake world -c cleanall --continue
The --continue will ignore any dependency errors while cleaning. Continue as much as possible after an error.

No, cleanall does not clean dependencies. eg
bitbake -c cleanall core-image-minimal
only removes the output of that named recipe.
What i usually do to clean "everything" is running cleanall on the receipe "world":
bitbake -c cleanall world
If that fails because of unresolvable packages like that:
ERROR: Nothing PROVIDES 'sg3-utils' (but /home/blubb/meta-freescale/recipes-devtools/utp-com/utp-com_git.bb DEPENDS on or otherwise requires it).
I just add the packages temporary to the ASSUME_PROVIDED variable like this :
bitbake -c cleanall world --ignore-deps=python-nativedtc-native --ignore-deps=sg3-utils
If nothing provides this packages it is unlikely that they where ever build.

Please read the mega-manual section do_cleanall .
do_cleanall removes:
all output files
shared state (sstate) cache
and downloaded source files for a target (i.e. the contents of DL_DIR).
You can run this task using BitBake as follows:
$ bitbake -c cleanall <recipe-name>
If recipe name is not passed to cleanall task it does not work.

Removes all output files, shared state (sstate) cache, and downloaded source files for a target (i.e. the contents of DL_DIR). Essentially, the do_cleanall task is identical to the do_cleansstate task with the added removal of downloaded source files.
You can run this task using BitBake as follows:
$ bitbake -c cleanall recipe
Typically, you would not normally use the cleanall task. Do so only if you want to start fresh with the do_fetch task.

Other folks have already answered that bitbake does not automatically clean dependencies, but you can create an Inter-task dependency (https://www.yoctoproject.org/docs/3.1/bitbake-user-manual/bitbake-user-manual.html#inter-task-dependencies) to clean your dependencies if needed by adding a command to the recipe:
do_task[depends] = "recipe:task"
We've extended bitbake to build native recipes and automatically run unit tests during a build. In that case we need to clean the native recipe when cleaning the target so you could add:
do_clean[depends] = "${PN}-native:do_clean"
do_cleanall[depends] = "${PN}-native:do_cleanall"
do_cleansstate[depends] = "${PN}-native:do_cleansstate"
That solution falls a bit short because the native recipes will attempt to clean ${PN}-native-native, so you'll need a conditional to not apply if it's already native:
do_clean[depends] += "${#'' if bb.data.inherits_class('native', d) else '${PN}-native:do_clean'}"
do_cleanall[depends] += "${#'' if bb.data.inherits_class('native', d) else '${PN}-native:do_cleanall'}"
do_cleansstate[depends] += "${#'' if bb.data.inherits_class('native', d) else '${PN}-native:do_cleansstate'}"

Related

Yocto: Bitbake not honouring dependencies?

I'm having an issue with a new bitbake recipe. My recipe depends on files produced by a net-snmp recipe from openembedded, but net-snmp doesn't seem to be building before trying to compile my recipe.
In my .bb file, I have:
DEPENDS = " \
net-snmp \
...
EXTRA_OEMAKE += " \
BINDIR=${STAGING_BINDIR} \
...
do_compile() {
oe_runmake foo
}
Then my makefile includes
CFLAGS=`${BINDIR}/net-snmp-config --cflags` ...
When I run bitbake foo, do_compile throws the error
/bin/sh: [some-path-to-net-snmp-config]: No such file or directory
If I check the staging directory, net-snmp-config is indeed missing.
But if I then run bitbake -C compile net-snmp foo, foo builds successfully, and net-snmp-config is in the staging directory.
What am I doing wrong here?
Edit: I've just noticed that even if foo builds successfully, net-snmp is suspiciously absent from my final rootfs image.
If I add RDEPENDS="net-snmp" to my recipe, I get the error:
satisfy_dependencies_for: Cannot satisfy the following dependencies for packagegroup-core-boot:
| * net-snmp *
I think I found the solution.
Based on this blog entry, I added the line
do_compile[depends] += "net-snmp:do_install"
Now my recipe builds successfully every time.
I was also trying to use RDEPENDS incorrectly. Since net-snmp outputs several packages, I needed to specify the individual packages in RDEPENDS in order to include them in my final build.

How do I get a complex non-Yocto makefile-based project to cross-compile in a Yocto layer?

This follows on from
How do I strip and objcopy a built .so file in the Yocto bitbake compile step?
This leads back to considerable background information.
As mentioned in the previous question, I am seeking to build OCA, which I have
as a non-Yocto makefile-based project, in Yocto. The project, which builds
fine outside of Yocto, and even in Yocto, is quite complex. The issue is that it
is not cross-compiling for my target, which is aarch64 armv8-a. It is building
successfully, but for my host machine, which is x86-64. Then Yocto sensibly
refuses to package it, saying "Unable to recognise the format of the input
file".
I changed the compile flags in my makefile to -march=armv8-a, but got the error
"cc1plus: error: bad value ('armv8-a') for '-march=' switch" which seems to
mean that I can't use the host's installed gcc for cross-compiling, but rather a
cross-compiler is needed. I previously custom-added two additional layers, a
sample helloworld and mDNS (see previous questions for lots of background), and
they all cross-compiled fine, so I know that Yocto is basically set up to do it.
What is the method to get the cross-compilation to happen? Do I need to do a lot
of pervasive changes to my project's makefile system? It may not ever have been
designed with Yocto in mind.
I am looking into this: "cross-compile library recipe in yocto":
cross-compile library recipe in yocto
which seems to have some relevant information. Edit: it was only standard stuff that I had seen before; nothing about how cross-compilation gets invoked instead of the host machine's gcc.
Edit: My updated recipe, with the FILES_${PN} added and make changed to
oe_runmake.
DESCRIPTION = "OCA"
PRIORITY = "optional"
SECTION = "protocols"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://oca-1.2.7"
S = "${WORKDIR}/oca-1.2.7/Src"
# Need to override S because BitBake expects the source to be in a dir called
# oca-1.2.7 in the work dir, but it's actually additionally under Src/.
# Need a do_compile, since OCA has a makefile with a non-standard name,
# makefileOCA. Also needs non-standard flags, -f and linuxRelease.
do_compile() {
export CAP_HOME="${WORKDIR}/oca-1.2.7"
oe_runmake -f makefileOCA linuxRelease
}
do_install() {
install -d ${D}${libdir}
cp ../Obj/linuxApp/Release/OcaProtoController.so ${D}${libdir}/OcaProtoController.so
chmod 0755 ${D}${libdir}/OcaProtoController.so
}
FILES_${PN} += "${libdir}/OcaProtoController.so"
Edit: I found some info:
https://www.yoctoproject.org/docs/1.8.1/adt-manual/adt-manual.html
https://www.yoctoproject.org/docs/1.8.1/adt-manual/adt-manual.html#setting-up-the-cross-development-environment
I commented-out the setting of CC and LD in makeOCA.inc.
I did the cleaning actions of deleting the tmp folder from my build-wayland
build dir, and did "bitbake -c cleansstate oca". Then I did "time bitbake oca".
Now it looks like it is using the cross compiler.
The first error I got now is:
~/Yocto/imx-yocto-bsp/build-wayland/tmp/work/aarch64-poky-linux/oca/1.2.7-r0/oca-1.2.7/Obj/linuxApp/Release/OcaAgentProxies.a
aarch64-poky-linux-ld: cannot find crus: No such file or directory
So this is the next question: Can you tell me what "crus" means in "LDFLAGS = crus $#"?

how to make bitbake print options of do_configure

I'm having trouble cross compiling Qt5 for beaglebone using openembedded with bitbake. I think in step do_configure not everything is passed from my *.bbappend and no platform plugins are installed (I need 'linuxfb').
My question will be: how to make bitbake print list of arguments it passes to ./configure?
There's a few ways to get that info, I would suggest looking in the recipe work directory:
temp/log.do_configure contains the configure task log which should list exact ./configure-command
build/ contains the projects own build system artefacts
bitbake -e <recipe> | grep <VARIABLE> is very useful if you want to know what variable values end up as (check e.g. PACKAGECONFIG and PACKAGECONFIG_CONFARGS values if you're modifying packageconfig).

Bitbake: force one task of a recipe and all following

I want to force-recompile a package, like that:
bitbake -f -c compile mypackage
However, I also want all following tasks to be executed (like install, package, etc.), just as if I had called bitbake mypackage from a completely clean state. Can this be done in one step, rather than the following two?
bitbake -f -c compile mypackage
bitbake mypackage
Or as an alternative solution, can I somehow "taint" the compile-task, such that executing bitbake mypackage does everything from compilation onwards?
This is exactly what -C is for:
bitbake -C compile mypackage
This will run mypackage:do_build and force mypackage:do_compile to execute. Strictly speaking, it taints mypackage:do_compile (so that it has to execute) and then executes mypackage:do_build, which is exactly what you wanted.

Compile rygel for yocto with plugins

I'm using bitbake to compile rygel for yocto from the meta-openembedded layer, with the plugins mpris and gst-launch.
As per the PACKAGECONFIG docs, I created a bbappend file and added the following:
EXTRA_OECONF = "--disable-introspection \
--disable-tracker-plugin \
--with-media-engine=gstreamer \
--enable-mpris-plugin \
--enable-gst-launch-plugin"
PR = "r1"
It compiles and installs, but has no plugins.
The append shows up when I run bitbake-layers show-appends, so at least bitbake is finding it. After running bitbake the directory tmp/work/core2-64-poky-linux/rygel/0.26.1-r1/image/usr/lib/rygel-2.6/plugins/ is populated. Then when I run the image /usr/lib/rygel-2.6/ contains an engines dir and nothing else.
Any idea where I'm going wrong?
I don't think your read all the way down to "If you want to change an existing PACKAGECONFIG block, you can do so one of two ways:".
From a bbappend, just do
PACKAGECONFIG_append = " mpris gst-launch"
In the recipe do_install, they remove some of the engines and plugins files. This might be the reason you do not see them in your image.
do_install_append() {
# Remove .la files for loadable modules
rm -f ${D}/${libdir}/rygel-${LIBV}/engines/*.la
rm -f ${D}/${libdir}/rygel-${LIBV}/plugins/*.la
}
your compiling plugins successfully and not able to see in board(rootfs)? if yes please add below line in your .bbappend file. '
FILES_${PN} += "${libdir}/*"
this will add all your compiled plugins to your rootfs image.