SDK: Install recipe dependencies only
Hi,
Here is one of frequent scenarios. There is a custom image (say image-custom.bb) including an application (my-app.bb). For application development, the Standard SDK can be built by bitbake image-custom -c populate_sdk. Produced SDK contains all libraries necessary for application development, and the application itself. This suffers from multiple issues, though.
1. The SDK only contains libraries that are being used by the current version of my-app. If a future (i.e. currently unused) dependency is added to DEPENDS in my-app.bb, it does not propagate to the SDK.
2. If the application is not buildable, the SDK is neither buildable.
3. The SDK contains my-app which is generally not desirable.
I was looking for a mechanism to exclude my-app from SDK generation (e.g. PACKAGE_EXCLUDE), but haven't found how to keep all its dependencies.
I have end up with an inc file (my-app.inc), included by both my-app.bb and image-custom.bb:
```
DEPENDS_NATIVE = "tool1-native tool2-native"
DEPENDS_TARGET = "lib1 lib2"
# consumed by my-app
DEPENDS:class-target = "${DEPENDS_NATIVE} ${DEPENDS_TARGET}"
# consumed by image-custom
TOOLCHAIN_HOST_TASK:append = "${@native2sdk(DEPENDS_NATIVE)}"
TOOLCHAIN_TARGET_TASK:append = "${DEPENDS_TARGET}"
# changes the native packages to nativesdk, e.g. 'foo-native' -> 'nativesdk-foo'
def native2sdk(pkgs):
import re
return re.sub(r'([\w-]+)\-native', r'nativesdk-\1', pkgs)
```This works somehow, but:
1. Dependencies are not defined right in my-app.bb, where they belong.
2. Runtime dependencies of my-app are not installed in SDK and need to be further explicitly specified in TOOLCHAIN_TARGET_TASK.
3. Native dependencies conversion is cumbersome.
Am I overlooking a mechanism how to identify and install all dependencies of a package without actually building that package? It is clear that automatic runtime dependencies resolution couldn't be performed but perhaps all provided packages (with some exceptions) could be installed. I mean, if for example harfbuzz is in DEPENDS, all provided packages including harfbuzz-icu can be installed.
Best Regards,
Petr Kubiznak
Quoted 8 lines · Petr Kubizňák
This works somehow, but:
1. Dependencies are not defined right in my-app.bb, where they belong.
2. Runtime dependencies of my-app are not installed in SDK and need to be further explicitly specified inTOOLCHAIN_TARGET_TASK.
3. Native dependencies conversion is cumbersome.Am I overlooking a mechanism how to identify and install all dependencies of a package without actually building that package? It is clear that automatic runtime dependencies resolution couldn't be performed but perhaps all provided packages (with some exceptions) could be installed. I mean, if for example
harfbuzzis inDEPENDS, all provided packages includingharfbuzz-icucan be installed.
This might not be suitable for your situation, but I strongly recommend you look into 'direct SDK' workflow if your yocto is recent enough. It was implemented exactly to fulfil the need for an SDK environment that is accessible directly from a yocto build (with all the possibilities of updating and rebuilding, and adding more dependencies etc.).
Alex
Hi Alex,
Thanks for your suggestion. I am aware of the direct SDK workflow, but this is limited to the Extensible SDK. That is sadly no option for us, my question relates to the Standard SDK.
Petr
________________________________
From: Alexander Kanavin <[email protected]>
Sent: Tuesday, February 6, 2024 3:46 PM
To: [email protected] <[email protected]>; Petr Kubizňák - 2N <[email protected]>
Subject: Re: [yocto] SDK: Install recipe dependencies only
Quoted 8 lines · Petr Kubizňák
This works somehow, but:
1. Dependencies are not defined right in my-app.bb, where they belong.
2. Runtime dependencies of my-app are not installed in SDK and need to be further explicitly specified inTOOLCHAIN_TARGET_TASK.
3. Native dependencies conversion is cumbersome.Am I overlooking a mechanism how to identify and install all dependencies of a package without actually building that package? It is clear that automatic runtime dependencies resolution couldn't be performed but perhaps all provided packages (with some exceptions) could be installed. I mean, if for example
harfbuzzis inDEPENDS, all provided packages includingharfbuzz-icucan be installed.
This might not be suitable for your situation, but I strongly recommend you look into 'direct SDK' workflow if your yocto is recent enough. It was implemented exactly to fulfil the need for an SDK environment that is accessible directly from a yocto build (with all the possibilities of updating and rebuilding, and adding more dependencies etc.).
Alex
Quoted 18 lines · Alexander Kanavin
Quoted 8 lines · Petr Kubizňák
This works somehow, but:
1. Dependencies are not defined right in my-app.bb, where they belong.
2. Runtime dependencies of my-app are not installed in SDK and need to be further explicitly specified inTOOLCHAIN_TARGET_TASK.
3. Native dependencies conversion is cumbersome.Quoted 8 lines
Am I overlooking a mechanism how to identify and install all dependencies of a package without actually building that package? It is clear that automatic runtime dependencies resolution couldn't be performed but perhaps all provided packages (with some exceptions) could be installed. I mean, if for example
harfbuzzis inDEPENDS, all provided packages includingharfbuzz-icucan be installed.
Quoted 6 lines
This might not be suitable for your situation, but I strongly recommend you look into 'direct SDK' workflow if your yocto is recent enough. It was implemented exactly to fulfil the need for an SDK environment that is accessible directly from a yocto build (with all the possibilities of updating and rebuilding, and adding more dependencies etc.).
This patch series tries to address this with a more general approach:
https://lists.openembedded.org/g/openembedded-core/message/194149
It supports two types of SDKs: The devtool modify workflow (Modified mode) as well as the Direct SDK workflow (Shared sysroots mode) as already mentioned by Alex.
It allows to quickly re-generate the SDK with updated dependencies of the recipes.
See also the docs patch:
https://lists.openembedded.org/g/openembedded-core/message/194158
Some patches are already on master. The big one which brings the new features is not yet accepted.
Regards,
Adrian
Quoted 14 lines
Alex
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#62405):
https://lists.yoctoproject.org/g/yocto/message/62405
Mute This Topic: https://lists.yoctoproject.org/mt/104198675/4454582
Group Owner: [email protected] Unsubscribe:
https://lists.yoctoproject.org/g/yocto/unsub [[email protected]
]
-=-=-=-=-=-=-=-=-=-=-=-