Issues Running MATLAB Compiled Program in Docker on ARM Mac
Hello,
I’m encountering an issue running a MATLAB compiled program using MCR (2021b) in a Docker container on an ARM-based Mac using Rosetta 2 for x86_64 emulation. The program fails to initialize with the following error:
"Error: Message Catalog has not been initialized by a successful call to MessageCatalog::MessageCatalogInit"
The compiled MATLAB program and MCR are for x86_64 architecture (amd64).
Environment:
Host: ARM-based Mac (Apple Silicon)
Docker with Rosetta 2 support for x86_64 emulation
Container OS: Ubuntu 18.04.6 LTS (x86_64)
MATLAB Compiler Runtime (MCR) version: R2021b (v9.11)
What I’ve tried:
Verified all required libraries are present and correctly linked (using ldd).
Confirmed MCR installation appears correct (directory structure and permissions).
Ran strace, which showed the process switching between 64-bit and x32 modes.
Checked disk space
Attempted to run both the compiled program directly and through its run script.
Additional Information:
The compiled MATLAB program and MCR are for x86_64 architecture.
Using VZ (Virtualization.framework) with Rosetta support, not QEMU.
glibc version in the container: 2.27 (compatible with MCR R2021b)
Docker file and docker commands, I used
FROM –platform=linux/amd64 containers.mathworks.com/matlab-runtime:r2021b
ENV DEBIAN_FRONTEND noninteractive
ENV MCR_ROOT /opt/matlabruntime/v911
ENV LD_LIBRARY_PATH ${MCR_ROOT}/runtime/glnxa64:${MCR_ROOT}/bin/glnxa64:${MCR_ROOT}/sys/os/glnxa64:${MCR_ROOT}/extern/bin/glnxa64
ENV XAPPLRESDIR /etc/X11/app-defaults
ENV MCR_CACHE_ROOT /tmp
ENV MCR_MASTER_PATH ${MCR_ROOT}
# Copy your compiled MATLAB script and any necessary files into the container
COPY matlab_scripts/matlab_compiled_app /app/matlab_compiled_app
COPY matlab_scripts/run_matlab_compiled_app.sh /app/run_matlab_compiled_app.sh
# Ensure the script is executable
RUN chmod +x /app/run_matlab_compiled_app
# Set the working directory
WORKDIR /app
# Command to run the script
#CMD ["./run_matlab_compiled_app.sh"]
I used the following command to build the container:
docker build –platform linux/amd64 -f Dockerfile-mcr-r2021b –no-cache –tag mydomain/matlab-runtime:r2021b .
and the following command to run the container :
docker run –platform linux/amd64 -it –rm -v ./my_data/:/app/my_data mydomain/matlab-runtime:r2021b /bin/bash
Questions:
Has anyone successfully run MATLAB compiled programs in a similar setup (Docker + Rosetta 2 on ARM Mac)?
Are there known issues or workarounds for running MCR-based applications under Rosetta emulation?
Could the architecture mismatch (x86_64 program on ARM host) be causing the initialization failure?
Are there specific Docker or Rosetta settings that need to be adjusted for proper MCR initialization?
Any insights, suggestions for further debugging, or potential solutions would be greatly appreciated. Thank you!Hello,
I’m encountering an issue running a MATLAB compiled program using MCR (2021b) in a Docker container on an ARM-based Mac using Rosetta 2 for x86_64 emulation. The program fails to initialize with the following error:
"Error: Message Catalog has not been initialized by a successful call to MessageCatalog::MessageCatalogInit"
The compiled MATLAB program and MCR are for x86_64 architecture (amd64).
Environment:
Host: ARM-based Mac (Apple Silicon)
Docker with Rosetta 2 support for x86_64 emulation
Container OS: Ubuntu 18.04.6 LTS (x86_64)
MATLAB Compiler Runtime (MCR) version: R2021b (v9.11)
What I’ve tried:
Verified all required libraries are present and correctly linked (using ldd).
Confirmed MCR installation appears correct (directory structure and permissions).
Ran strace, which showed the process switching between 64-bit and x32 modes.
Checked disk space
Attempted to run both the compiled program directly and through its run script.
Additional Information:
The compiled MATLAB program and MCR are for x86_64 architecture.
Using VZ (Virtualization.framework) with Rosetta support, not QEMU.
glibc version in the container: 2.27 (compatible with MCR R2021b)
Docker file and docker commands, I used
FROM –platform=linux/amd64 containers.mathworks.com/matlab-runtime:r2021b
ENV DEBIAN_FRONTEND noninteractive
ENV MCR_ROOT /opt/matlabruntime/v911
ENV LD_LIBRARY_PATH ${MCR_ROOT}/runtime/glnxa64:${MCR_ROOT}/bin/glnxa64:${MCR_ROOT}/sys/os/glnxa64:${MCR_ROOT}/extern/bin/glnxa64
ENV XAPPLRESDIR /etc/X11/app-defaults
ENV MCR_CACHE_ROOT /tmp
ENV MCR_MASTER_PATH ${MCR_ROOT}
# Copy your compiled MATLAB script and any necessary files into the container
COPY matlab_scripts/matlab_compiled_app /app/matlab_compiled_app
COPY matlab_scripts/run_matlab_compiled_app.sh /app/run_matlab_compiled_app.sh
# Ensure the script is executable
RUN chmod +x /app/run_matlab_compiled_app
# Set the working directory
WORKDIR /app
# Command to run the script
#CMD ["./run_matlab_compiled_app.sh"]
I used the following command to build the container:
docker build –platform linux/amd64 -f Dockerfile-mcr-r2021b –no-cache –tag mydomain/matlab-runtime:r2021b .
and the following command to run the container :
docker run –platform linux/amd64 -it –rm -v ./my_data/:/app/my_data mydomain/matlab-runtime:r2021b /bin/bash
Questions:
Has anyone successfully run MATLAB compiled programs in a similar setup (Docker + Rosetta 2 on ARM Mac)?
Are there known issues or workarounds for running MCR-based applications under Rosetta emulation?
Could the architecture mismatch (x86_64 program on ARM host) be causing the initialization failure?
Are there specific Docker or Rosetta settings that need to be adjusted for proper MCR initialization?
Any insights, suggestions for further debugging, or potential solutions would be greatly appreciated. Thank you! Hello,
I’m encountering an issue running a MATLAB compiled program using MCR (2021b) in a Docker container on an ARM-based Mac using Rosetta 2 for x86_64 emulation. The program fails to initialize with the following error:
"Error: Message Catalog has not been initialized by a successful call to MessageCatalog::MessageCatalogInit"
The compiled MATLAB program and MCR are for x86_64 architecture (amd64).
Environment:
Host: ARM-based Mac (Apple Silicon)
Docker with Rosetta 2 support for x86_64 emulation
Container OS: Ubuntu 18.04.6 LTS (x86_64)
MATLAB Compiler Runtime (MCR) version: R2021b (v9.11)
What I’ve tried:
Verified all required libraries are present and correctly linked (using ldd).
Confirmed MCR installation appears correct (directory structure and permissions).
Ran strace, which showed the process switching between 64-bit and x32 modes.
Checked disk space
Attempted to run both the compiled program directly and through its run script.
Additional Information:
The compiled MATLAB program and MCR are for x86_64 architecture.
Using VZ (Virtualization.framework) with Rosetta support, not QEMU.
glibc version in the container: 2.27 (compatible with MCR R2021b)
Docker file and docker commands, I used
FROM –platform=linux/amd64 containers.mathworks.com/matlab-runtime:r2021b
ENV DEBIAN_FRONTEND noninteractive
ENV MCR_ROOT /opt/matlabruntime/v911
ENV LD_LIBRARY_PATH ${MCR_ROOT}/runtime/glnxa64:${MCR_ROOT}/bin/glnxa64:${MCR_ROOT}/sys/os/glnxa64:${MCR_ROOT}/extern/bin/glnxa64
ENV XAPPLRESDIR /etc/X11/app-defaults
ENV MCR_CACHE_ROOT /tmp
ENV MCR_MASTER_PATH ${MCR_ROOT}
# Copy your compiled MATLAB script and any necessary files into the container
COPY matlab_scripts/matlab_compiled_app /app/matlab_compiled_app
COPY matlab_scripts/run_matlab_compiled_app.sh /app/run_matlab_compiled_app.sh
# Ensure the script is executable
RUN chmod +x /app/run_matlab_compiled_app
# Set the working directory
WORKDIR /app
# Command to run the script
#CMD ["./run_matlab_compiled_app.sh"]
I used the following command to build the container:
docker build –platform linux/amd64 -f Dockerfile-mcr-r2021b –no-cache –tag mydomain/matlab-runtime:r2021b .
and the following command to run the container :
docker run –platform linux/amd64 -it –rm -v ./my_data/:/app/my_data mydomain/matlab-runtime:r2021b /bin/bash
Questions:
Has anyone successfully run MATLAB compiled programs in a similar setup (Docker + Rosetta 2 on ARM Mac)?
Are there known issues or workarounds for running MCR-based applications under Rosetta emulation?
Could the architecture mismatch (x86_64 program on ARM host) be causing the initialization failure?
Are there specific Docker or Rosetta settings that need to be adjusted for proper MCR initialization?
Any insights, suggestions for further debugging, or potential solutions would be greatly appreciated. Thank you! mcr, container, docker, runtime, amd64, arm64, mac MATLAB Answers — New Questions