Why is MEX function not defined when run in a Docker microservice container?

3 views (last 30 days)

I would like to deploy my MATLAB R2024b function to a Docker microservice using the "compiler.package.microserviceDockerImage" workflow. I am compiling on Windows, and the resulting container is running Ubuntu. The function works as intended on Windows and Ubuntu machines, but throws the following error when run in the container:

Method '<METHOD_NAME>' is not defined for class '<NAMESPACE_NAME>' or is removed from MATLAB's search path.
For context, "<METHOD_NAME>" is a custom MEX function within a namespace called "<NAMESPACE_NAME>". I have compiled MEX files for Windows and Linux, and they are both on my MATLAB path at the appropriate namespace location. I have also manually included the Linux MEX file in the container using the "AdditionalFiles" argument, as I realize the Windows MEX file will not work on Linux. How can I resolve this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Mar 2025
Unfortunately, functions that make use of MEX files must be deployed on the same operating system as the target container. Thus, please recompile your Docker microservice image on a Linux machine using the same steps you described above.
Once you build your Docker image on Linux, however, you should be able to run it on Windows machines without issue.

More Answers (0)

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!