필터 지우기
필터 지우기

load mex library error on Linux

조회 수: 6 (최근 30일)
Jose Gutierrez de la Concha
Jose Gutierrez de la Concha 2021년 10월 14일
답변: Nihal 2024년 8월 16일 10:09
Hi,
I getting this error while trying to load a mex library on Ubuntu 20.04
>> loadlibrary('ice', @iceproto)
Error using message/getString
In 'MATLAB:loadlibrary:ErrorRunningFromCommandLine', parameter {0} must be a real scalar.
Error in loadlibrary
I have build a mex, proto and thunk files
ice.mexa64 iceproto.m icethunk.so
Cheers,
Jose

답변 (1개)

Nihal
Nihal 2024년 8월 16일 10:09
Hi Jose,
The error you're encountering suggests that there might be an issue with how the loadlibrary function is being called or with the files involved. Here are some steps to help troubleshoot and resolve the issue:
  1. Check File Paths: Ensure that the files ice.mexa64, iceproto.m, and icethunk.so are in the current working directory or provide the full path to these files when calling loadlibrary.
  2. Verify Function Signatures: Make sure that the iceproto.m file correctly defines the function signatures expected by the ice library. This file should contain the necessary prototype information for MATLAB to interface with the library.
  3. Correct Usage of loadlibrary: The loadlibrary function typically requires the name of the shared library and the prototype file. Ensure your command is structured correctly
  4. Check MATLAB Version Compatibility: Ensure that the MATLAB version you are using is compatible with the compiled MEX file. Sometimes, MEX files need to be compiled with specific MATLAB versions to ensure compatibility.
  5. Library Dependencies: Check if the ice library has any dependencies that are not met. You can use tools like ldd on the ice.mexa64 file to check for missing dependencies
  6. Recompile the MEX File: If the above steps don't resolve the issue, consider recompiling the MEX file. Make sure to use the correct compiler settings and MATLAB's mex function
  7. Check for Errors in Prototype File: Double-check the iceproto.m file for any syntax errors or incorrect function declarations that might prevent loadlibrary from executing properly.

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by