- activex can only be used on windows
- .net can only be used on windows
- memory() can only be used on windows
- toolboxes that are only available for windows do not become available on other operating systems by compiling them into an executable
- .dll and .mexw64 and .mexw32 and linking .lib can only be used on windows
- .so and .dyld and .mexmaci and .mexa64 cannot be used on windows
Is it not possible to run a dockerized .NET program developed in Windows, using the Matlab Runtime in a linux container?
14 次查看(过去 30 天)
显示 更早的评论
I have a .NET Core console program referencing MWArray.dll to be able to use a function that we developed with the MATLAB Compiler SDK (resulting in another DLL). On a Windows host with the MATLAB Runtime installed (9.6) there are no issues whatsoever and the program executes and performs as expected.
We want to run this program on a Linux machine, so we dockerized the program, installed the Linux MATLAB Runtime on it and run it. I also made a program with just the MWArray.dll and a call to MWMCR.IsMCRInitialized() to narrow the problem. This is the exception that throws everytime:
% System.TypeInitializationException: 'The type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception.'
% Inner Exceptions:
% TypeInitializationException: The type initializer for 'MathWorks.MATLAB.NET.Arrays.MWArray' threw an exception.
% DllNotFoundException: Unable to load shared library 'mclmcrrt9_6.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libmclmcrrt9_6.dll: cannot open shared object file: No such file or directory
It seems that the dotnet runtime can't access the MCR of the container even though is installed and the proper environment variables set. Is this because of the MWArray.dll of the Windows MATLAB Runtime inside our project maybe? I thought the Runtime was cross-platform. Is this not supported?
This is the Dockerfile (using a local MATLAB Runtime so it does not have to download it everytime):
FROM mcr.microsoft.com/dotnet/core/runtime:2.2-stretch-slim AS base
COPY ["MatlabDockerTest/MATLAB_Runtime_R2019a_Update_1_glnxa64.zip", "/mcr-install/"]
# Install MATLAB Runtime (MCR) silently
RUN apt-get -qq update && apt-get -qq install -y unzip && \
mkdir /opt/mcr && \
cd /mcr-install && \
unzip -q MATLAB_Runtime_R2019a_Update_1_glnxa64.zip && \
./install -mode silent -agreeToLicense yes -destinationFolder /opt/mcr && \
cd / && \
rm -rf mcr-install
# Configure environment variables for MCR
ENV LD_LIBRARY_PATH=/opt/mcr/v96/runtime/glnxa64:/opt/mcr/v96/bin/glnxa64:/opt/mcr/v96/sys/os/glnxa64:/opt/mcr/v96/extern/bin/glnxa64
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["MatlabDockerTest/MatlabDockerTest.csproj", "MatlabDockerTest/"]
RUN dotnet restore "MatlabDockerTest/MatlabDockerTest.csproj"
COPY . .
WORKDIR "/src/MatlabDockerTest"
RUN dotnet build "MatlabDockerTest.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "MatlabDockerTest.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MatlabDockerTest.dll"]
0 个评论
回答(1 个)
Walter Roberson
2019-5-20
The runtime is not cross platform. MCR is operating system specific and can only be used to run code that you could run in MATLAB for that operating system.
5 个评论
jeremy engelbrecht
2019-11-8
Thank for the answer, I am also having to do a work aroung I have now created a linux Vm on aws installed docker, built my image on the linux VM. I have also added the Matlab runtime in the docker image but still having the same error. So I am looking at other workarounds.
But thanks for the feedback
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with MATLAB Compiler SDK 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!