필터 지우기
필터 지우기

x86_64 errors on MacBook Pro M1 Chip

조회 수: 5 (최근 30일)
Radhika
Radhika 2022년 11월 30일
편집: Suvansh Arora 2022년 12월 2일
I'm running Matlab on MacBook Pro based on M1 chip. My program calls certain C functions. I am getting chip architecture errors.
How do I tackle the architecture x86_64 undefined symbols? Has anyone experienced the same issue using newer Macs and older x86 based code?

답변 (1개)

Suvansh Arora
Suvansh Arora 2022년 12월 2일
편집: Suvansh Arora 2022년 12월 2일
Compilers can cause unexpected behavior when compiling and executing MEX files. Refer to the following link for a list of supported compiler versions for your MATLAB version:
Switching to a supported compiler version may resolve the issue that you are facing. I would highly suggest taking this step before attempting further troubleshooting.
If the information mentioned above doesn’t solve the issue, altering some of your environment variable settings might do.
You may want to look at the following page for a detailed explanation on the build process,
but to test whether things work on your platform as expected, please follow the procedure mentioned below:
  • ‘mex compiler setup: In order to setup the mex compiler, just execute the following at your MATLAB command window:
>> mex -setup % List of supported compilers is available at https://www.mathworks.com/support/compilers.html, (please hit on the Mac tab)
  • Use ‘mex to build the engine application: In order to build the engine application, use mex as follows:
>> mex -v -client engine <file_name>.c % Please note that the "engine" keyword after "-client" is required https://www.mathworks.com/help/matlab/matlab_external/build-unix-engine-example.html
In the above command, you will see verbose compiler/linker options used to build the application and customize according to your need.
>> !file_name
If the information mentioned above doesn’t solve the issue, please follow the procedure mentioned below for further assistance:
  • This error might occur because of the options file which gets carried over to a newer release. To fix this issue, you can follow the following steps:
Delete the options file named "mex_C++_maci64.xml" from the Preferences Directory "prefdir".
You can know the "prefdir" for any release using the MATLAB by executing the following command.
>> prefdir
MEX, starting 15a, does not require “-setup”. Mex will find a compiler for you and compile the C/C++ file.
>> mex -v -client engine <file_name>.cpp
  • If the above step does not resolve the issue, then the issue can be related to some missing libraries. The error in this case might be due to not selecting the engine client, a faulty options file or faulty processing of the options file. In this case, one workaround could be to explicitly specify the libraries while compiling using MEX function. For instance,
>> mex -v -client engine <file_name>.cpp -lMatlabDataArray –lMatlabEngine
I hope the above information helps you.

카테고리

Help CenterFile Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by