Linking 32 bit .o file in Verdin iMX8M Mini

Hi Team,

I am using Verdin iMX8M Mini. I need compile 32 bit library in project. How to do this? I am using torizoncore builder . Here how to use multilib option in torizoncore builder.

I tried in dockerfile

Enable 32-bit (armhf) libraries for running or linking

RUN dpkg --add-architecture armhf &&
apt-get update &&
apt-get install -y --no-install-recommends
libc6:armhf
libstdc++6:armhf
libgcc-s1:armhf
gcc-arm-linux-gnueabihf
g+±arm-linux-gnueabihf &&
apt-get clean && rm -rf /var/lib/apt/lists/*

but its not working.

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello and thank you for your question!

You are correct that the Verdin iMX8M Mini is an ARM64 (aarch64) platform, but you can enable 32-bit (armhf) library support in containers running on Torizon OS.

Enabling 32-bit (armhf) Libraries in Your TorizonCore Container

To enable 32-bit library support in your Docker-based project, your steps in the Dockerfile are close, but you’ll also need to ensure you select a container base image that supports multi-architecture (arm64 + armhf) for Debian packages.

Here’s how you can proceed:

1. Start with the Official Torizon Debian Base Image

For the highest compatibility, it’s recommended to use the official Torizon Debian base images designed for aarch64:

FROM torizon/debian:bookworm

2. Add the 32-bit Architecture and Install Needed Packages

Extend your Dockerfile as follows:

RUN dpkg --add-architecture armhf && \
    apt-get update && \
    apt-get install -y --no-install-recommends \
        libc6:armhf \
        libstdc++6:armhf \
        libgcc-s1:armhf \
        gcc-arm-linux-gnueabihf \
        g++-arm-linux-gnueabihf && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

This adds armhf as a supported architecture and installs both the runtime libraries and the cross-compilers for armhf.

3. Cross-Compile 32-bit Libraries

If you want to build (not run) 32-bit binaries inside the container, your Dockerfile above is correct. Use gcc-arm-linux-gnueabihf and g++-arm-linux-gnueabihf to compile your code targeting armhf.

Example compilation inside the container:

arm-linux-gnueabihf-gcc -o mylib32.so mylib.c

4. Running 32-bit ARM Binaries

If you need to run armhf binaries on the board, multiarch support provided in the steps above allows this. The 64-bit Linux kernel on i.MX8M Mini can run arm32 userland binaries as long as corresponding 32-bit libraries are installed.

Usage in TorizonCore Builder

TorizonCore Builder is primarily for OS-level customization: adding kernel modules, device trees, and full packages at the OS layer. For container dependencies, continue to use the Dockerfile as above. TorizonCore Builder itself does not have a direct “multilib” flag for containers—multilib support is managed at the Debian packaging and container level as shown here.

For more details, refer to the documentation:

Troubleshooting

  • If installation fails, ensure your base image really is 64-bit. Some older images or custom images might not have all the needed dpkg and apt hooks for multiarch.
  • All runtime library dependencies for your 32-bit binary must also be installed using the :armhf tag.

Let me know if you encountered a specific error message, and I can assist further!

Best regards,
Toradex AI Assistant.

Hey @Jai8877!

Can you tell me a bit more about your setup? Are you developing your project using our IDE Extension or are you building your container and binary directly inside the board?

Also, you said your Dockerfile is not working. Also, is your Dockerfile exactly as you wrote it here? The new lines should be escaped with the “\” character. Can you tell me the error message you get when you try to build your image? Or does it fail silently? What tells you that it’s not working?

If you provide these details I can try reproducing the problem to help you further.

Best regards,

Hi Costa,

I would like know Torizon OS 32bit is available for IMX8M mini? and I am trying run using task runner with run-container-torizon-release-arm64.

My docker file contains:

build ------------------------------------------------------------------------
FROM commontorizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} AS build

ARG APP_ROOT
ARG IMAGE_ARCH=aarch64

RUN dpkg --add-architecture armhf &&
apt-get update &&
apt-get install -y --no-install-recommends
libc6:armhf
libstdc++6:armhf
libgcc-s1:armhf
gcc-arm-linux-gnueabihf
g+±arm-linux-gnueabihf &&
apt-get clean && rm -rf /var/lib/apt/lists/*

#deps
RUN apt-get -q -y update &&
apt-get -q -y install
#DO NOT REMOVE THIS LABEL: this is used for VS Code automation
#torizon_packages_build_start
#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/*
#deps
COPY ./includes ${APP_ROOT}
COPY . ${APP_ROOT}
USER root
WORKDIR ${APP_ROOT}

#Remove the code from the debug builds, inside this container, to build the
release version from a clean build
RUN rm -rf ${APP_ROOT}/build-${IMAGE_ARCH}

#Compile the application
RUN if [ “$IMAGE_ARCH” = “arm64” ] ; then
make ARCH=${IMAGE_ARCH} CC=aarch64-linux-gnu-g++ CXXFLAGS=“-DEC_ARCH=EC_ARCH_ARM64” ;
elif [ “$IMAGE_ARCH” = “arm” ] ; then
make ARCH=${IMAGE_ARCH} CC=arm-linux-gnueabihf-g++ ;
elif [ “$IMAGE_ARCH” = “amd64” ] ; then
make ARCH=${IMAGE_ARCH} CC=x86_64-linux-gnu-g++ ;
fi

build ------------------------------------------------------------------------

deploy -----------------------------------------------------------------------
FROM --platform=linux/${IMAGE_ARCH} commontorizon/debian:${BASE_VERSION} AS deploy

ARG IMAGE_ARCH
ARG APP_ROOT

RUN apt-get -y update && apt-get install -y --no-install-recommends
#DO NOT REMOVE THIS LABEL: this is used for VS Code automation
#torizon_packages_prod_start
#torizon_packages_prod_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/*

in my makefile its like:

Compiler and flags
CC := g++
CCFLAGS := -I/includes -std=c++14
#CXXFLAGS := -DEC_ARCH=EC_ARCH_ARM64
CXXFLAGS := -DEC_ARCH=EC_ARCH_ARM64
DBGFLAGS := -g
LDFLAGS := -Lsrc/SDK/LIB/Linux/aarch32
-l:libMaster.a
-l:libRasSrv.a

libMaster.a 32bit library
libRasSrv.a 32bit library

Output:

-Lsrc/SDK/LIB/Linux/aarch32 -l:libMaster.a -l:libRasSrv.a
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible src/SDK/LIB/Linux/aarch32/libMaster.a when searching for -l:libMaster.a
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible src/SDK/LIB/Linux/aarch32/libMaster.a when searching for -l:libMaster.a
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: cannot find -l:libMaster.a: No such file or directory
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible src/SDK/LIB/Linux/aarch32/libMaster.a when searching for -l:libMaster.a
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible src/SDK/LIB/Linux/aarch32/libMaster.a when searching for -l:libMaster.a
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible src/SDK/LIB/Linux/aarch32/libRasSrv.a when searching for -l:libRasSrv.a
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible src/SDK/LIB/Linux/aarch32/libRasSrv.a when searching for -l:libRasSrv.a
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: cannot find -l:libRasSrv.a: No such file or directory
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible src/SDK/LIB/Linux/aarch64/libARasSrv.a when searching for -l:libRasSrv.a
91.19 /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld: skipping incompatible src/SDK/LIB/Linux/aarch32/libRasSrv.a when searching for -l:libRasSrv.a

How to compile this 32bit library?

Hi, @Jai8877,

I saw that you opened the same issue here. I’ll be closing this thread since the other one is cleaner. I’m investigating your issue currently.

Best regards,

João Victor Couto de Oliveira Martins, Jul 18, 2025, 09:32

This request was closed and merged into request #37978 “Linking 32 bit .o lib file in Ve…”.