x86_64 errors on MacBook Pro M1 Chip

6 vues (au cours des 30 derniers jours)
Radhika
Radhika le 30 Nov 2022
Modifié(e) : Suvansh Arora le 2 Déc 2022
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?

Réponses (1)

Suvansh Arora
Suvansh Arora le 2 Déc 2022
Modifié(e) : Suvansh Arora le 2 Déc 2022
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.

Catégories

En savoir plus sur C Shared Library Integration dans Help Center et File Exchange

Tags

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by