Torizon-minimal: error when building librsvg

Hello,

I set up the Yocto environment for building torizon-minimal following this guide and successfully built the image.

After adding an own image based on the torizon-minimal I got an error when building the package librsvg:

ERROR: librsvg-2.52.7-r0 do_compile: ExecutionError('/home/gemac/oe-coreV6.3_torizon/build-torizon/tmp/work/cortexa53-mx8mm-tdx-linux/librsvg/2.52.7-r0/temp/run.do_compile.8254', 1, None, None)
ERROR: Logfile of failure stored in: /home/gemac/oe-coreV6.3_torizon/build-torizon/tmp/work/cortexa53-mx8mm-tdx-linux/librsvg/2.52.7-r0/temp/log.do_compile.8254
Log data follows:
| DEBUG: Executing python function autotools_aclocals
| DEBUG: SITE files ['endian-little', 'bit-64', 'arm-common', 'arm-64', 'common-linux', 'common-glibc', 'aarch64-linux', 'common']
| DEBUG: Python function autotools_aclocals finished
| DEBUG: Executing shell function do_compile
| cp: cannot stat '/home/gemac/oe-coreV6.6_torizon/build-torizon/tmp/work/cortexa53-mx8mm-tdx-linux/librsvg/2.52.7-r0/recipe-sysroot-native/usr/lib/rustlib/aarch64-tdx-linux.json': No such file or directory
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/gemac/oe-coreV6.3_torizon/build-torizon/conf/../../layers/openembedded-core/meta/recipes-gnome/librsvg/librsvg_2.52.7.bb:do_compile) failed with exit code '1'

I got this error with BSP 6.3 and following. With BSP 6.2 the build process finishes without problems. Here are the steps to reproduce:

cd ~
mkdir torizon
cd torizon
repo init -u git://git.toradex.com/toradex-manifest.git -b refs/tags/6.6.1 -m tdxref/default.xml
repo sync
MACHINE=verdin-imx8mm source setup-environment
bitbake librsvg

Best regards,
Markus

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Markus,

The error you’re encountering during the compilation of librsvg in the Torizon environment, specifically with BSP versions 6.3 and later, suggests an issue related to the Rust environment setup for cross-compilation. The missing aarch64-tdx-linux.json file is a target specification file for Rust, indicating that the Rust compiler’s configuration for the target architecture is not correctly set up or missing in your build environment.

This issue can arise due to changes in the Rust support or the way librsvg is built between BSP versions. Here are a few steps you can take to troubleshoot and potentially resolve this issue:

  1. Ensure Rust is Properly Installed and Configured:

    • Verify that Rust and its cross-compilation support are correctly installed in your build environment. You might need to install or update Rust and its components to ensure compatibility with the architecture you’re targeting.
  2. Check for Updates or Patches:

    • Look for any updates or patches to the librsvg recipe or related Rust recipes that might address this issue. It’s possible that this has been recognized and fixed in a later version or patch.
  3. Manual Addition of Target Specification File:

    • If you have a custom Rust setup or if the automatic configuration is failing, you might need to manually add or update the aarch64-tdx-linux.json target specification file in the expected directory. This file describes the target architecture for Rust, and its absence is what’s causing the build to fail.
  4. Review Changes Between BSP Versions:

    • Since the build succeeds with BSP 6.2 but fails with 6.3 and later, reviewing the changes made to the Rust environment, librsvg recipe, or related dependencies between these versions might provide insights into what’s causing the issue.
  5. Rust Configuration in Yocto:

    • Ensure that your Yocto environment is correctly set up for Rust cross-compilation. This includes checking the meta-rust layer or any other Rust-related configuration in your Yocto setup.
  6. Temporary Workaround:

    • As a temporary workaround, if a specific version of librsvg is not crucial, you could try reverting to a version of librsvg that is known to compile successfully with your current setup, while you investigate a more permanent solution.

Given the nature of this issue, it’s also beneficial to ensure that

Please, also check if these links can help you solve your problem:

Secure Boot on Torizon OS | Toradex Developer Center.

Greetings @Mowlwurf,

I think I have a theory of what might be wrong. I notice the recipe for librsvg uses rust to build and compile. Our remote-access client (rac) in Torizon also uses rust. However, it required a newer version of rust then what was available in openembedded-core. Therefore we back-ported a newer version of rust in our meta-layer: meta-toradex-torizon/recipes-devtools/rust at kirkstone-6.x.y · torizon/meta-toradex-torizon · GitHub

It might be the case that librsvg here does not work with the newer version of rust that we back-ported. This would match your observations because we backported the newer version of rust for the 6.3 release.

You could try removing the backport, or setting the rust version to the version available in openembedded-core kirkstone: meta-toradex-torizon/conf/distro/include/torizon.inc at kirkstone-6.x.y · torizon/meta-toradex-torizon · GitHub

But, then our remote-access client would fail to build most likely. Not sure if you care about this. Another idea is that you could try back-porting a newer version of libsrvg that is more compatible with the version of rust that we backported.

Best Regards,
Jeremias

Hello @jeremias.tx,

thank You for your answer, it was really helpful.
I added the version 2.56.3 of librsvg to my custom layer and now it’s compiling successfully.
recipes-gnome.zip (19.7 KB)

For my custom layer I have another question:
Whenever I start my build environment I have to call source setup-environment. This script creates a link in the conf-directory to layers/meta-toradex-torizon/conf/template/bblayers.conf even when this file already exists in the conf-directory.
How can I add my custom layer to conf/bblayers.conf permanently without changing the file in the meta-toradex-torizon-layer?

Best regards,
Markus

2 Likes

Perfect glad my theory was on the right track.

How can I add my custom layer to conf/bblayers.conf permanently without changing the file in the meta-toradex-torizon-layer?

Good question. So when you use the repo tool to initialize the build environment it symlinks the setup-environment script from meta-toradex-torizon as seen here: default.xml « torizoncore - toradex-manifest.git - Repo manifest for Toradex Embedded Linux TorizonCore and BSP layer setup for Yocto Project/Openembedded

You could create your own manifest and then instead symlink your own setup script. Anyways I’d imagine you’d want to add your custom meta-layer to a custom manifest anyways to make sure the correct version of it is cloned alongside all the other layers.

There’s probably other methods as well, but this was the most straightforward one that came to mind. It’s either that or you have a 2nd script of your own design that you execute after setup-environment that then tweaks the environment for your custom build.

Best Regards,
Jeremias