Matlab Crash: Illegal instruction on M1 Mac

Hi :wave:

While running an example of Acados in Matlab using Mac after compiling Mex successfully it crashes immediately. I guess it is being crashed while executing the below function.
%% create ocp solver
ocp = acados_ocp(ocp_model, ocp_opts);
Please find the below crash report.


--------------------------------------------------------------------------------
           Illegal instruction detected at 2022-10-25 10:22:15 +0530
--------------------------------------------------------------------------------

Configuration:
  Crash Decoding           : Disabled - No sandbox or build area path
  Crash Mode               : continue (default)
  Default Encoding         : UTF-8
  Deployed                 : false
  Graphics Driver          : Uninitialized hardware 
  Java Version             : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  MATLAB Architecture      : maci64
  MATLAB Entitlement ID    : 870270
  MATLAB Root              : /Applications/MATLAB_R2022b.app
  MATLAB Version           : 9.13.0.2049777 (R2022b)
  OpenGL                   : hardware
  Operating System         : Mac OS Version 12.6 (Build 21G115)
  Process ID               : 43136
  Processor ID             : x86 Family 6 Model 44 Stepping 0, GenuineIntel
  Session Key              : cd20b708-ea5a-47f7-aa5a-613aff5392b9
  Window System            : Quartz

Fault Count: 1


Abnormal termination:
Illegal instruction

Current Thread: 'MCR 0 interpreter thread' id 0x30fa9e000

Register State (from fault):
  RAX = 00007fa561c32200  RBX = 00007fa561c58000
  RCX = 00007fa55e75c860  RDX = 00007fa561c32200
  RSP = 000000030fa99b58  RBP = 000000030fa99c30
  RSI = 000000030fa99be0  RDI = 0000000000000004

   R8 = 000000030fa99be8   R9 = 00007fa561c58000
  R10 = 000000030fa99be0  R11 = 000000030fa99be8
  R12 = 00007fa561c58000  R13 = 00007fa55e75c860
  R14 = 0000000000000004  R15 = 00007fa561c58000

  RIP = 00000001b2e72104  RFL = 0000000000000246

   CS = 000000000000002b   FS = 0000000000000000   GS = 0000000000000000

Stack Trace (from fault):
[  0] 0x000000010fba4b94 /Applications/MATLAB_R2022b.app/bin/maci64/libmwfl.dylib+00007060 _ZN10foundation4core4diag15stacktrace_base7captureERKNS1_14thread_contextEm+00000052
[  1] 0x000000010fba905a /Applications/MATLAB_R2022b.app/bin/maci64/libmwfl.dylib+00024666 _ZN10foundation4core4test17terminate_handledERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE+00006778
[  2] 0x000000010fba72e5 /Applications/MATLAB_R2022b.app/bin/maci64/libmwfl.dylib+00017125 _ZN10foundation4core4diag13terminate_logEPKcPK17__darwin_ucontext+00000149
[  3] 0x000000011a8d43fc /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00521212 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00011884
[  4] 0x000000011a8d2483 /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00513155 _Z19mnPrintErrorMessageRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+00003827
[  5] 0x000000011a8cfd35 /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00503093 mnFatalSignalHandler+00000149
[  6] 0x00007ff81d7b6dfd           /usr/lib/system/libsystem_platform.dylib+00015869 _sigtramp+00000029
[  7] 0x00000002052b9fed                                   <unknown-module>+00000000
[  8] 0x00000001adae8f5d /Applications/MATLAB_R2022b.app/bin/maci64/libacados.dylib+00040797 ocp_nlp_approximate_qp_matrices+00000205
[  9] 0x00000001adafd35b /Applications/MATLAB_R2022b.app/bin/maci64/libacados.dylib+00123739 ocp_nlp_sqp+00000571
[ 10] 0x00000001adb308ab /Applications/MATLAB_R2022b.app/bin/maci64/libacados.dylib+00333995 ocp_nlp_solve+00000043
[ 11] 0x000000011f0a6851 /Applications/MATLAB_R2022b.app/bin/maci64/libmex.dylib+00378961 _ZNK18C_DispatchStrategy8dispatchEiPP11mxArray_tagiS2_+00000305
[ 12] 0x000000011f0a6770 /Applications/MATLAB_R2022b.app/bin/maci64/libmex.dylib+00378736 _ZNK18C_DispatchStrategy8dispatchEiPP11mxArray_tagiS2_+00000080
[ 13] 0x000000011f0a715d /Applications/MATLAB_R2022b.app/bin/maci64/libmex.dylib+00381277 _ZNK24SCCompatDispatchStrategy8dispatchEiPP11mxArray_tagiS2_+00000061
[ 14] 0x000000011f0a65d6 /Applications/MATLAB_R2022b.app/bin/maci64/libmex.dylib+00378326 _ZN7Mfh_mex30dispatch_file_with_protectionsEiPP11mxArray_tagiS2_+00000470
[ 15] 0x000000011f08dae6 /Applications/MATLAB_R2022b.app/bin/maci64/libmex.dylib+00277222 _ZN7Mfh_mex13dispatch_fileEiPP11mxArray_tagiS2_+00000150
[ 16] 0x000000011acda173 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_dispatcher.dylib+00762227 _ZN8Mfh_file8dispatchEiPNSt3__110unique_ptrI11mxArray_tagN6matrix6detail17mxDestroy_deleterEEEiPPS2_+00000387
[ 17] 0x000000011f67f7d6 /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+00501718 _ZN9MathWorks3lxe13LxeDispatcher12apply_handleEP13Mfh_MATLAB_fnmPNS0_6xvalueEmPKS4_RKNS0_12LxeTypesBaseENS0_9ApplyTypeE+00001206
[ 18] 0x0000000123e41ea0 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+05615264 _ZN9MathWorks3lxe16ans_apply_handleEPvNS_2ts4TypeEPKvS1_S1_+00000256
[ 19] 0x0000000123d7350e /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+04769038 _ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_16ans_apply_handleEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2_+00000014
[ 20] 0x0000000123b2b9cc /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02378188 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8_+00000588
[ 21] 0x0000000123b29f95 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02371477 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001429
[ 22] 0x0000000123b2833c /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02364220 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000076
[ 23] 0x0000000123b3c6ab /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02447019 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000187
[ 24] 0x0000000123b28090 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02363536 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4_+00000192
[ 25] 0x0000000123b27f7c /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02363260 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000108
[ 26] 0x0000000123c58e40 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+03612224 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00005584
[ 27] 0x0000000123c5e09e /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+03633310 _ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6_+00000302
[ 28] 0x000000011f7c4175 /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+01831285 _ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6_+00000101
[ 29] 0x000000011f6767fe /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+00464894 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction14DispatchScriptEiPP11mxArray_tagiS4_+00000318
[ 30] 0x000000011f676c40 /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+00465984 _ZN9MathWorks3lxe27FileBasedMatlabCodeFunction12DispatchFileEiPP11mxArray_tagiS4_b+00000096
[ 31] 0x000000011acda173 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_dispatcher.dylib+00762227 _ZN8Mfh_file8dispatchEiPNSt3__110unique_ptrI11mxArray_tagN6matrix6detail17mxDestroy_deleterEEEiPPS2_+00000387
[ 32] 0x000000011f67f7d6 /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+00501718 _ZN9MathWorks3lxe13LxeDispatcher12apply_handleEP13Mfh_MATLAB_fnmPNS0_6xvalueEmPKS4_RKNS0_12LxeTypesBaseENS0_9ApplyTypeE+00001206
[ 33] 0x0000000123e41ea0 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+05615264 _ZN9MathWorks3lxe16ans_apply_handleEPvNS_2ts4TypeEPKvS1_S1_+00000256
[ 34] 0x0000000123d7350e /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+04769038 _ZN9MathWorks3lxe38cpp_primitive_template_fn_with_contextIXadL_ZNS0_16ans_apply_handleEPvNS_2ts4TypeEPKvS2_S2_EEEEbS2_S4_S6_S2_S2_+00000014
[ 35] 0x0000000123b2b9cc /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02378188 _ZN9MathWorks3lxe13IrInterpreter17ApplyCppPrimitiveEPN2ir4termES4_RKNS_2ts4TypeES8_+00000588
[ 36] 0x0000000123b29f95 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02371477 _ZN9MathWorks3lxe13IrInterpreter31process_application_of_constantEPN2ir4termE+00001429
[ 37] 0x0000000123b2833c /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02364220 _ZN9MathWorks3lxe13IrInterpreter13applyConstantEPN2ir4termE+00000076
[ 38] 0x0000000123b3c6ab /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02447019 _ZN9MathWorks3lxe12IRTreeWalker11getNextIRPCENS0_9irpc_typeE+00000187
[ 39] 0x0000000123b28090 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02363536 _ZN9MathWorks3lxe13IrInterpreter9tree_walkERKNS0_9irpc_typeES4_+00000192
[ 40] 0x0000000123b27f7c /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+02363260 _ZN9MathWorks3lxe13IrInterpreter9InterpretEv+00000108
[ 41] 0x0000000123c58e40 /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+03612224 _ZN9MathWorks3lxe15ExecutionDriver9ThreadRunEv+00005584
[ 42] 0x0000000123c5e09e /Applications/MATLAB_R2022b.app/bin/maci64/libmwm_lxe.dylib+03633310 _ZN9MathWorks3lxe12IrEngineImpl5ApplyERKN2ir4termEPvS6_+00000302
[ 43] 0x000000011f7c4175 /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+01831285 _ZN9MathWorks3lxe17IrEngineDecorator5ApplyERKN2ir4termEPvS6_+00000101
[ 44] 0x000000011f6ce14a /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+00823626 _ZN9MathWorks3lxe9Evaluator15ApplyStatementsERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEERKN2ir4termERNS0_18IEvaluationContextE+00000602
[ 45] 0x000000011f6d1e28 /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+00839208 _ZN9MathWorks3lxe9Evaluator17EvalStatementImplERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEERNS0_18IEvaluationContextE+00000408
[ 46] 0x000000011f777f3e /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+01519422 _ZN9MathWorks3lxe9LxeBridge7EvalCmdERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEbNS0_10EvalSourceE+00000318
[ 47] 0x000000011f777db5 /Applications/MATLAB_R2022b.app/bin/maci64/libmwlxemainservices.dylib+01519029 _ZN9MathWorks3lxe9LxeBridge22EvalCmdWithLocalReturnERKNSt3__112basic_stringIDsNS2_11char_traitsIDsEENS2_9allocatorIDsEEEEPibNS0_10EvalSourceE+00000053
[ 48] 0x000000011a55e1ff /Applications/MATLAB_R2022b.app/bin/maci64/libmwiqm.dylib+00520703 _ZN3iqm14UserEvalPlugin7executeEP15inWorkSpace_tag+00000607
[ 49] 0x000000011a5355c6 /Applications/MATLAB_R2022b.app/bin/maci64/libmwiqm.dylib+00353734 _ZN3iqm17DefaultPacketInfo7executeEP15inWorkSpace_tagRKN7mwboost10shared_ptrINS_22IntermediatePacketInfoEEEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueE+00001382
[ 50] 0x000000011a4eac6e /Applications/MATLAB_R2022b.app/bin/maci64/libmwiqm.dylib+00048238 _ZN3iqm10DefaultIqm7dequeueERKN7mwboost8optionalIKP15inWorkSpace_tagEEN14cmddistributor11IqmStreamIDERKNS1_9function2IN6mlutil14cmddistributor17inExecutionStatusERKNSt3__112basic_stringIDsNSF_11char_traitsIDsEENSF_9allocatorIDsEEEES5_EE+00003918
[ 51] 0x000000011ee817da /Applications/MATLAB_R2022b.app/bin/maci64/libmwbridge.dylib+00059354 _Z10ioReadLinebP7__sFILERKN7mwboost8optionalIKP15inWorkSpace_tagEEbRbRKNS1_9function2IN6mlutil14cmddistributor17inExecutionStatusERKNSt3__112basic_stringIDsNSE_11char_traitsIDsEENSE_9allocatorIDsEEEES5_EE+00000218
[ 52] 0x000000011eea0672 /Applications/MATLAB_R2022b.app/bin/maci64/libmwbridge.dylib+00185970 _Z22mnGetCommandLineBufferbRbN7mwboost8optionalIKP15inWorkSpace_tagEEbRKNS0_9function2IN6mlutil14cmddistributor17inExecutionStatusERKNSt3__112basic_stringIDsNSA_11char_traitsIDsEENSA_9allocatorIDsEEEES4_EE+00000274
[ 53] 0x000000011eea0c1a /Applications/MATLAB_R2022b.app/bin/maci64/libmwbridge.dylib+00187418 _Z8mnParserv+00000362
[ 54] 0x000000011a892098 /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00250008 _ZN3mcr7runtime13initializeIqmERKN6mlutil10contextmgr5McrIDE+00002296
[ 55] 0x000000011a876375 /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00136053 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000869
[ 56] 0x000000011a87629b /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00135835 _ZN14cmddistributor15PackagedTaskIIP13getTypeStringIvEENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEv+00000651
[ 57] 0x000000011a5597ca /Applications/MATLAB_R2022b.app/bin/maci64/libmwiqm.dylib+00501706 _ZN3iqm18PackagedTaskPlugin7executeEP15inWorkSpace_tag+00000074
[ 58] 0x000000011a88f7a7 /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00239527 _Z15mcr_initialize0PKDsPS0_RKN7mwboost10shared_ptrIN10foundation7msg_svc8eventmgr8EventMgrEEEN6mlutil10contextmgr5MvmIDE+00019799
[ 59] 0x000000011a5355c6 /Applications/MATLAB_R2022b.app/bin/maci64/libmwiqm.dylib+00353734 _ZN3iqm17DefaultPacketInfo7executeEP15inWorkSpace_tagRKN7mwboost10shared_ptrINS_22IntermediatePacketInfoEEEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueE+00001382
[ 60] 0x000000011a4f9533 /Applications/MATLAB_R2022b.app/bin/maci64/libmwiqm.dylib+00107827 _ZN3iqm10DefaultIqm13dequeueHelperEN7mwboost8optionalImEERKNSt3__112basic_stringIDsNS4_11char_traitsIDsEENS4_9allocatorIDsEEEEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueERKNS4_8functionIFbRKNS4_5tupleIJSG_NS1_10shared_ptrINS_22IntermediatePacketInfoEEESA_SA_NS4_10shared_ptrIN14cmddistributor16CoalesceableDataEEEEEEEEE+00001315
[ 61] 0x000000011a4ec442 /Applications/MATLAB_R2022b.app/bin/maci64/libmwiqm.dylib+00054338 _ZN3iqm10DefaultIqm7dequeueEN6mlutil14cmddistributor13WhenToDequeue13WhenToDequeueEN7mwboost8optionalImEE+00000434
[ 62] 0x000000011a88027e /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00176766 _ZN3mcr7runtime22InterpreterThreadMulti14process_eventsEv+00000254
[ 63] 0x000000011a880ada /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00178906 _ZN3mcr7runtime22InterpreterThreadMulti10threadMainENSt3__18functionIFvvEEENS2_7promiseIvEE+00000394
[ 64] 0x000000011a881e61 /Applications/MATLAB_R2022b.app/bin/maci64/libmwmcr.dylib+00183905 _ZN3mcr7runtime22InterpreterThreadMulti10threadMainENSt3__18functionIFvvEEENS2_7promiseIvEE+00005393
[ 65] 0x000000010dadfba8 /Applications/MATLAB_R2022b.app/bin/maci64/libmwboost_thread.dylib+00011176 _ZN7mwboost6thread21start_thread_noexceptEv+00000312
[ 66] 0x00007ff81d7a14e1            /usr/lib/system/libsystem_pthread.dylib+00025825 _pthread_start+00000125
[ 67] 0x00007ff81d79cf6b            /usr/lib/system/libsystem_pthread.dylib+00008043 thread_start+00000015


This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.

I am using macOS 12.6 with MATLABR2022a and Xcode 14.

Thanks and Regards
Raghu Boppana

Hi Raghu,

I guess this is related to this: Error using mex_Undefined symbols for architecture x86_64:
Are you using the x86 “emulated” version?
from this line:

  Processor ID             : x86 Family 6 Model 44 Stepping 0, GenuineIntel

It seems like this would be the expected one in Matlab.

Hello Frey,

Thank you for your reply. Yes, I am using the x86_64 emulated version on my Mac because of this error:https://discourse.acados.org/t/error-using-mex-undefined-symbols-for-architecture-x86-64/830:
So as suggested I have set the CMake_OSX_architecture to x86_64 to resolve the above error. But as I understand now MATLAB is crashing because of this emulated version. So could you please suggest to me what can I do to run successfully because I am totally lost here?

I see in CMakeCache.txt that the OSX is as below:

/Preformatted text/Build architectures for OSX
CMAKE_OSX_ARCHITECTURES:STRING=x86_64

Thanks and Regards
Raghu Boppana

Hi,

So it seems that Matlab is running in the emulated environment and you are on the right track. See https://www.mathworks.com/matlabcentral/answers/641925-is-matlab-supported-on-apple-silicon-macs
(I briefly thought it could be the other way, i.e. Matlab being an M1 native binary).

Can you check your BLASFEO and HPIPM targets, via CMake?
I hope that they are not set to GENERIC yet, and in this case I would try setting them as GENERIC.

Good luck! :crossed_fingers:

Hello Frey,

Thank you for your quick response. I assume you are referring to the BLASFEO and HPIPM targets in the CMakeLists.txt file. As shown below they are currently set to x64_automatic. Based on your response I am setting it to GENERIC. Let me know if this is the right way to do so.

Even after setting them to GENERIC, MATLAB still crashes. Don’t know what I am missing here?

set(ACADOS_INSTALL_DIR "${PROJECT_SOURCE_DIR}" CACHE PATH  "Installation path to PROJECT_SOURCE_DIR")
if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
  set(BLASFEO_TARGET "ARMV8A_ARM_CORTEX_A57" CACHE STRING "BLASFEO Target architecture")
else()
  set(BLASFEO_TARGET "X64_AUTOMATIC" CACHE STRING "BLASFEO Target architecture")
endif()
set(HPIPM_TARGET "X64_AUTOMATIC" CACHE STRING "HPIPM Target architecture")
set(LA "HIGH_PERFORMANCE" CACHE STRING "Linear algebra optimization level")

Thanks and Regards
Raghu Boppana

If you build acados after removing the build folder, you should see the HPIPM and BLASFEO targets in the CMake output.
Are they correctly set to GENERIC?

The lines you quoted should just set the default value.

Hi,

I have removed the existing build folder from acados root folder and generated build cmake with GENERIC targets as shown below. But still, it crashes.

CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type is Release
-- ACADOS_WITH_OPENMP: OFF
CMake Deprecation Warning at external/blasfeo/CMakeLists.txt:36 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Using linear algebra: HIGH_PERFORMANCE
-- Using matrix format: PANELMAJ
-- Using external BLAS: 0
-- Testing target GENERIC: assembly compilation [success]
-- Testing target GENERIC: assembly run [success]
-- Testing target GENERIC: intrinsic compilation [success]
-- Testing target GENERIC: intrinsic run [success]
-- Compiling for target: GENERIC
CMake Deprecation Warning at external/hpipm/CMakeLists.txt:36 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Using BLASFEO path: 
-- Installation directory: /Users/raghuboppana/acados
--  
-- Target: BLASFEO is GENERIC, HPIPM is GENERIC
-- Linear algebra: HIGH_PERFORMANCE
-- Matlab MEX (OFF)
-- Octave MEX (OFF)
-- Octave Templates (OFF)
-- System name:version Darwin:21.6.0
-- Build type is Release
-- Installation directory is /Users/raghuboppana/acados
-- OpenMP parallelization is OFF
--  
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/raghuboppana/acados

This is what I set in Cmakelists.txt

if(CMAKE_MAKE_PROGRAM)
    file(TO_CMAKE_PATH ${CMAKE_MAKE_PROGRAM} CMAKE_MAKE_PROGRAM)
    find_program(CMAKE_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM})
endif()

project(acados LANGUAGES C CXX)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)

### Defaults

set(ACADOS_INSTALL_DIR "${PROJECT_SOURCE_DIR}" CACHE PATH  "Installation path to PROJECT_SOURCE_DIR")
if ("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
  set(BLASFEO_TARGET "GENERIC" CACHE STRING "BLASFEO Target architecture")
else()
  set(BLASFEO_TARGET "GENERIC" CACHE STRING "BLASFEO Target architecture")
endif()
set(HPIPM_TARGET "GENERIC" CACHE STRING "HPIPM Target architecture")
set(LA "HIGH_PERFORMANCE" CACHE STRING "Linear algebra optimization level")

Hi,

sorry, I am don’t have more to check right now.
The cmake output seems correct.

I also tried to check the Matlab crash report again more carefully.
But didn’t get more out of it than the crash is happening somewhere in ocp_nlp_approximate_qp_matrices.
Maybe the crash report gets more detailed when adding setting -DCMAKE_BUILD_TYPE=Debug.

Unfortunately, I don’t know what to try next here.