Problems with libdbus-1-dev in Rust container

Hi all,

I’m struggling getting a rust container with Bluer to work. Bluer requires libdbus-1-dev to be installed, but this is where I am running into problems. I used the rust template from the TorizonIDE, but when trying to install the packages libdbus-1-dev:arm64 and pkg-config:arm64 (via apt-get), I get

2.396 E: Unable to locate package pkg-config:arm64
2.396 E: Unable to locate package libdbus-1-dev:arm64

When installing these packages in other applications it was no problem, so I suspect something with the base image, since this is the main difference… Can anyone help me out here?

Dockerfile.sdk
# ARGUMENTS --------------------------------------------------------------------
##
# Board architecture
##
ARG IMAGE_ARCH=

##
# Base container version
##
ARG SDK_BASE_VERSION=1.84-bookworm

##
# Directory of the application inside container
##
ARG APP_ROOT=

# BUILD ------------------------------------------------------------------------
##
FROM rust:${SDK_BASE_VERSION}

ARG APP_ROOT
ARG IMAGE_ARCH

RUN apt-get -q -y update && \
    apt-get -q -y install \
    gcc-arm-linux-gnueabihf \
    gcc-aarch64-linux-gnu \
    # ADD YOUR PACKAGES HERE
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
    # __torizon_packages_build_start__
	    pkg-config:arm64 \
	    libdbus-1-dev:arm64 \
    # __torizon_packages_build_end__
# DO NOT REMOVE THIS LABEL: this is used for VS Code automation
    && \
    apt-get clean && apt-get autoremove && \
    rm -rf /var/lib/apt/lists/*

RUN rustup target add aarch64-unknown-linux-gnu && \
    rustup target add armv7-unknown-linux-gnueabihf

ARG UNAME=torizon
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME

USER $UNAME

WORKDIR ${APP_ROOT}

Cheers
Tim

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Tim,

Thank you for reaching out with your question. It seems like you’re encountering issues with installing libdbus-1-dev and pkg-config for the ARM64 architecture in your Rust container. This is likely due to the way the packages are specified in your Dockerfile.

Here are some steps you can take to resolve this:

  1. Remove Architecture Suffixes: In your Dockerfile, try removing the architecture-specific suffixes from the package names. Instead of pkg-config:arm64 and libdbus-1-dev:arm64, simply use pkg-config and libdbus-1-dev. The package manager should automatically handle the architecture based on the environment.

  2. Verify Base Image Compatibility: Ensure that the base image you are using (rust:${SDK_BASE_VERSION}) supports the ARM64 architecture. If it doesn’t, consider using a multi-architecture base image or a Torizon base image that is already configured for ARM64.

  3. Check Package Availability: Make sure that the packages you are trying to install are available for the ARM64 architecture in the Debian repositories. You can verify this by checking the package lists or using a tool like apt-cache.

By following these steps, you should be able to resolve the package installation issues in your Rust container. If you have any further questions, feel free to ask.

Best regards,
Toradex AI Assistant

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

What images to use for wayland with GPU support for verdin imx8mp?.

Greetings @TimSiegrist,

The issue here is that the base image is not configured to find and install packages from other architectures. The base image here is coming from the official rust container image. In the base images that come from Toradex we run RUN dpkg --add-architecture ${CROSS_TARGET_ARCH} when building the container like so: torizon-containers/cross-toolchain/base/Dockerfile at stable · torizon/torizon-containers · GitHub

This allows the following apt commands to locate and install packages for other architectures. Try adding this to your SDK Dockerfile before the apt commands and it should work when installing arm64 packages.

Best Regards,
Jeremias

Hi @jeremias.tx

Thanks a lot, Problem solved!

Best Regards
Tim

Perfect glad I could help!

Best Regards,
Jeremias