Linking 32 bit .o lib file in Verdin iMX8M Mini

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! Thank you for your detailed question regarding compiling 32-bit libraries on the Verdin iMX8M Mini with TorizonCore. Let’s address your main queries step by step:


1. Is there a 32-bit Torizon OS image for Verdin iMX8M Mini?

No, there is no dedicated 32-bit (Armv7) Torizon OS image for the Verdin iMX8M Mini. The Torizon OS for this module is 64-bit (aarch64/arm64) only, as per the architecture capabilities and official releases:
Torizon OS Downloads

However, the hardware (Cortex-A53) does support running and executing 32-bit Arm (armhf/armv7) user space binaries.


2. Can I compile and run 32-bit binaries/libraries on 64-bit Torizon OS?

Yes, you can. This is typically achieved via multilib support and running 32-bit (armhf) applications inside containers on a 64-bit (aarch64) operating system.


3. Why does your current build fail?

Your compilation is failing because you are using a 64-bit cross-compiler (aarch64-linux-gnu-g++) to link 32-bit libraries (libEcMaster.a, libAtemRasSrv.a). These libraries are compiled for 32-bit (armhf), so you must use a 32-bit cross-toolchain (arm-linux-gnueabihf-g++) for both compilation and linking.


4. How to build 32-bit binaries inside a container?

You can do this by ensuring that:

  • The container platform is set to linux/arm/v7.
  • You use the appropriate 32-bit (armhf) toolchain.
  • Your Makefile and Dockerfile are set up to use the right compiler.

Minimal Example Dockerfile Segment

FROM --platform=linux/arm/v7 debian:bullseye

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

ENV CC=arm-linux-gnueabihf-gcc
ENV CXX=arm-linux-gnueabihf-g++

# Continue with your build steps

You should also ensure your Makefile uses the correct compiler:

CC := arm-linux-gnueabihf-gcc
CXX := arm-linux-gnueabihf-g++

5. How to run 32-bit applications on the Verdin iMX8M Mini?

The 64-bit Torizon OS kernel supports running 32-bit (armhf) containers. Here is an example of running a 32-bit Debian Bullseye container:

docker run --rm -it --platform linux/arm/v7 arm32v7/debian:bullseye

To build your 32-bit application for deployment, use --platform=linux/arm/v7 in your Dockerfile and build command.


6. Does TorizonCore Builder support multilib?

TorizonCore Builder itself is not directly related to cross-compiling user applications, but rather to customizing Torizon OS images (for overlays, container pre-provisioning, etc.) (More info).
So, the multilib support must be handled within your application container’s Dockerfile, not via TorizonCore Builder options.


Summary of Steps

  • Use --platform=linux/arm/v7 in your Docker commands to ensure a 32-bit (armhf) environment.
  • Use armhf toolchains (arm-linux-gnueabihf-g++) throughout your build.
  • The Makefile and Dockerfile must consistently use the armhf toolchain and base images.
  • No need for a 32-bit Torizon OS—your 64-bit Torizon OS can run 32-bit containers.

If you follow these steps, you should be able to build and run your 32-bit applications and libraries smoothly on the Verdin iMX8M Mini.

For more resources, please check:

If you have further questions about the Dockerfiles or Makefile setup, let me know!

Best regards,
Toradex AI Assistant.