How to correctly run a .NET Core Application on Ubuntu 22.04 in MATLAB R2022a?

2 Ansichten (letzte 30 Tage)
I am trying to follow the "Create a .NET Core Application That Runs on Linux and macOS" MATLAB R2022a documentation example:
However, I receive the following error messages when I run the .NET core application from my Ubuntu 22.04.3 LTS machine using MATLAB R2022a Compiler Runtime (MCR):
./MyDotNetCoreApp 3
libpath: /usr/local/MATLAB/MATLAB_Runtime/v912/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v912/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v912/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v912/extern/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v912/sys/opengl/lib/glnxa64
Error: System.EntryPointNotFoundException: Unable to find an entry point named 'memcpy_proxy' in shared library 'mclmcrrt9_12.dll'.
   at MathWorks.MATLAB.NET.Utility.MWMarshal.memcpy(IntPtr source, IntPtr destination, IntPtr size)
   at MathWorks.MATLAB.NET.Utility.MWMarshal.MarshalManagedColumnMajorToUnmanagedColumnMajor(Array managedSrc, Double* destPtr)
   at MathWorks.MATLAB.NET.Arrays.MWNumericArray.FastBuildNumericArray(Array realData, Array imaginaryData, Boolean makeDouble, Boolean rowMajorData)
   at MathWorks.MATLAB.NET.Arrays.MWNumericArray..ctor(Array array)
   at MathWorks.MATLAB.NET.Arrays.MWArray.GetMWArrayFromArrayType(Array arrIn, String arrType)
   at MathWorks.MATLAB.NET.Arrays.MWArray.ConvertObjectToMWArray(Object objIn)
   at MathWorks.MATLAB.NET.Utility.MWMCR.UnpackArgArray(Object[] argArray)
   at MathWorks.MATLAB.NET.Utility.MWMCR.EvaluateFunction(Int32 numArgsOut, String functionName, Object[] argsIn)
These error messages do not appear when using MATLAB R2023a, however, it is necessary for me to use MATLAB R2022a, as the final target version of Linux uses Centos Version 7. I have checked that the "LD_LIBRARY_PATH" environment variable targets the MCR correctly. I have also checked that I am running 64-bit applications. However, neither of these steps has helped to remove the error messages above.
Is there a workaround to prevent these error messages from appearing?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 2 Okt. 2023
To avoid these errors, you can create a MWNumericArray with casting instead of using a constructor. Casting also has better performance when a large array is created. For example, instead of the following example MATLAB code:
MWNumericArray n = new MWNumericArray(new double[] { 2, 3 });
Do the following:
MWNumericArray n = (MWNumericArray)(new double[] { 2, 3 });

Weitere Antworten (0)

Kategorien

Mehr zu Deploy to .NET Applications Using MWArray API finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by