Torizon debian-cross-toolchain cannot install needed gstreamer libraries

My setup looks like this:

ARG IMAGE_TAG=2-bullseye
ARG TOOLCHAIN_ARCH=aarch64
ARG PKG_ARCH=arm64
ARG IMAGE_ARCH=linux/arm64

FROM torizon/debian-cross-toolchain-arm64:2-bullseye

ARG PKG_ARCH
ARG TOOLCHAIN_ARCH

RUN echo "dpkg --add-architecture $PKG_ARCH"
RUN dpkg --add-architecture "$PKG_ARCH"

RUN apt-get -y update && apt-get install -y --fix-missing \
    cmake \
    python-dev \
    gcc \
    make \
    gcc \
    binutils \
    build-essential \
    wget \
    pkg-config \
    libseccomp-dev:$PKG_ARCH \
    libasound2-dev:$PKG_ARCH \
    libsystemd-dev:$PKG_ARCH \
    libssl-dev:$PKG_ARCH \
    zlib1g-dev:$PKG_ARCH \
    libgpiod-dev:$PKG_ARCH \
    libgpiod2:$PKG_ARCH \
    libspeex-dev:$PKG_ARCH \
    libspeexdsp-dev:$PKG_ARCH \
    libsrtp2-dev:$PKG_ARCH \
    libgsm1-dev:$PKG_ARCH \
    libsnmp-dev:$PKG_ARCH \
    libgstreamer1.0-dev:$PKG_ARCH \
    libgstreamer-plugins-base1.0-dev:$PKG_ARCH \
    libgstreamer-plugins-bad1.0-dev:$PKG_ARCH \
    libwebsockets-dev:$PKG_ARCH \
    libgstrtspserver-1.0-dev:$PKG_ARCH \
    libgstreamermm-1.0-dev:$PKG_ARCH \
    && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*

Here’s the build output:

Step 10/20 : RUN apt-get -y update && apt-get install -y --fix-missing     cmake     python-dev     gcc     make     gcc     binutils     build-essential     wget     pkg-config     libseccomp-dev:$PKG_ARCH     libasound2-dev:$PKG_ARCH     libsystemd-dev:$PKG_ARCH     libssl-dev:$PKG_ARCH     zlib1g-dev:$PKG_ARCH     libgpiod-dev:$PKG_ARCH     libgpiod2:$PKG_ARCH     libspeex-dev:$PKG_ARCH     libspeexdsp-dev:$PKG_ARCH     libsrtp2-dev:$PKG_ARCH     libgsm1-dev:$PKG_ARCH     libsnmp-dev:$PKG_ARCH     libgstreamer1.0-dev:$PKG_ARCH     libgstreamer-plugins-base1.0-dev:$PKG_ARCH     libgstreamer-plugins-bad1.0-dev:$PKG_ARCH     libwebsockets-dev:$PKG_ARCH     libgstrtspserver-1.0-dev:$PKG_ARCH     libgstreamermm-1.0-dev:$PKG_ARCH     && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
 ---> Running in 94f55da5c0dd
Get:1 http://snapshot.debian.org/archive/debian/20200908T070000Z bullseye InRelease [116 kB]
Get:2 http://snapshot.debian.org/archive/debian/20200908T070000Z bullseye-updates InRelease [38.8 kB]
Get:3 http://snapshot.debian.org/archive/debian-security/20200908T070000Z bullseye-security InRelease [44.1 kB]
Get:4 http://snapshot.debian.org/archive/debian/20200908T070000Z bullseye/main amd64 Packages [7683 kB]
Get:5 https://feeds.toradex.com/debian testing InRelease [14.9 kB]
Get:6 https://feeds.toradex.com/debian testing/non-free arm64 Packages [9481 B]
Get:7 https://feeds.toradex.com/debian testing/main arm64 Packages [111 kB]
Get:8 http://snapshot.debian.org/archive/debian/20200908T070000Z bullseye/main arm64 Packages [7572 kB]
Fetched 15.6 MB in 14s (1129 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
binutils is already the newest version (2.35-2).
binutils set to manually installed.
build-essential is already the newest version (12.8).
build-essential set to manually installed.
gcc is already the newest version (4:10.1.0-1).
gcc set to manually installed.
make is already the newest version (4.3-4).
make set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libopencv4.2-java : Depends: libopencv4.2-jni (>= 4.2.0+dfsg-6+toradex2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I’ve tried installing libopencv4.2-jni but still get the error. Is this a problem with debian-cross-toolchain-arm64:2-bullseye?

Greetings @tprins,

I was able to reproduce this on my own setup. On further investigation I can see that the libopencv4.2-jni is attempting to be sourced from the toradex feed that we add in our Debian containers. The reason for this special feed/packages is because certain things like opencv require special support to run on i.MX hardware properly.

So in this case it seems that the reason the depdencies fail to be met is because most/all the packages from the toradex feed including libopencv4.2-jni are arm-based. Which is problematic since the debian-cross-toolchain-arm64:2-bullseye container image itself is amd64 based.

I believe this architecture issue to be the problem here. But allow me to check internally with the team first, regarding this issue.

Best Regards,
Jeremias