MATLAB: Simscape multibody internal compiler error (directFee​dthroughMa​trix): Failed to generate all binary outputs

compilercompiler errormin gwSimscapeSimscape Multibody

Good morning,
I've installed the suggested compiler Min GW w64 (which I have already used for other models with success):
>> mex -setup
MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
Warning: The MATLAB C and Fortran API has changed to support MATLAB
variables with more than 2^32-1 elements. You will be required
to update your code to utilize the new API.
You can find more information about this at:
https://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
I'm trying to run in Rapid Accelerator Mode my Simscape multibody model but an error occurs while compiling:
### Generating code for Physical Networks associated with solver block 'BS_MBD_2/Solver Configuration' ...
done.
### Building the rapid accelerator target for model: BS_MBD_2
"C:\PROGRA~3\MATLAB\SUPPOR~1\R2018b\3P778C~1.INS\MINGW_~1.INS\bin/gcc" -c -pedantic -Wno-long-long -fwrapv -m64 -O0 -DCLASSIC_INTERFACE=1 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=0 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DTID01EQ=1 -DTGTCONN -DON_TARGET_WAIT_FOR_START=0 -DMODEL=BS_MBD_2 -DNUMST=2 -DNCSTATES=862 -DHAVESTDIO -DNRT -DRSIM_PARAMETER_LOADING -DRSIM_WITH_SL_SOLVER -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IE:/ONEDRI~3/Progetti/BALLSC~1/Simulink/3ANNO~1/BSMBD~1 -IE:/ONEDRI~3/Progetti/BALLSC~1/Simulink/3ANNO~1/BSMBD~1/slprj/raccel/BS_MBD_2 -IC:/PROGRA~1/MATLAB/R2018b/extern/include -IC:/PROGRA~1/MATLAB/R2018b/simulink/include -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/rapid -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/raccel -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/rtiostream/rtiostreamtcpip -IC:/PROGRA~1/MATLAB/R2018b/toolbox/coder/rtiostream/src/utils -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/sm/ssci/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/sm/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/pm_math/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/simscape/engine/sli/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/simscape/engine/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/simscape/compiler/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/network_engine/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/common/math/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/common/lang/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/common/external/library/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/common/foundation/core/c/win64 @BS_MBD_2_comp.rsp -o "BS_MBD_2_a2136d1a_1.obj" "BS_MBD_2_a2136d1a_1.c"
"C:\PROGRA~3\MATLAB\SUPPOR~1\R2018b\3P778C~1.INS\MINGW_~1.INS\bin/gcc" -c -pedantic -Wno-long-long -fwrapv -m64 -O0 -DCLASSIC_INTERFACE=1 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=0 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DTID01EQ=1 -DTGTCONN -DON_TARGET_WAIT_FOR_START=0 -DMODEL=BS_MBD_2 -DNUMST=2 -DNCSTATES=862 -DHAVESTDIO -DNRT -DRSIM_PARAMETER_LOADING -DRSIM_WITH_SL_SOLVER -DENABLE_SLEXEC_SSBRIDGE=1 -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IE:/ONEDRI~3/Progetti/BALLSC~1/Simulink/3ANNO~1/BSMBD~1 -IE:/ONEDRI~3/Progetti/BALLSC~1/Simulink/3ANNO~1/BSMBD~1/slprj/raccel/BS_MBD_2 -IC:/PROGRA~1/MATLAB/R2018b/extern/include -IC:/PROGRA~1/MATLAB/R2018b/simulink/include -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/rapid -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/raccel -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2018b/rtw/c/src/rtiostream/rtiostreamtcpip -IC:/PROGRA~1/MATLAB/R2018b/toolbox/coder/rtiostream/src/utils -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/sm/ssci/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/sm/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/pm_math/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/simscape/engine/sli/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/simscape/engine/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/simscape/compiler/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/network_engine/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/common/math/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/common/lang/core/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/common/external/library/c/win64 -IC:/PROGRA~1/MATLAB/R2018b/toolbox/physmod/common/foundation/core/c/win64 @BS_MBD_2_comp.rsp -o "BS_MBD_2_a2136d1a_1_create.obj" "BS_MBD_2_a2136d1a_1_create.c"
BS_MBD_2_a2136d1a_1_create.c: In function 'initDirectFeedthrough':
BS_MBD_2_a2136d1a_1_create.c:2293401:0: internal compiler error: Segmentation fault
directFeedthroughMatrix , 21708060 * sizeof ( boolean_T ) ) ; } } static void
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://sourceforge.net/projects/mingw-w64> for instructions.
gmake: *** [BS_MBD_2_a2136d1a_1_create.obj] Error 1
The make command returned an error of 2
"An_error_occurred_during_the_call_to_make" non è riconosciuto come comando interno o esterno,
un programma eseguibile o un file batch.
### Build procedure for model: 'BS_MBD_2' aborted due to an error.
Unable to build a standalone executable to simulate the model 'BS_MBD_2' in rapid accelerator mode.
Caused by:
Error(s) encountered while building "BS_MBD_2":
### : Failed to generate all binary outputs.
Can anyone tell me how to solve this issue? This is the first time I encounter this type of error message.
Thank you!

Best Answer

If you can share the model, we can debug it more thoroughly. Any diagnostic with "Direct Feedthrough" in it makes me think you have an algebraic loop, which you should address as that will often cause problems. A Unit Delay for fixed-step simulation or a filter (transfer function) for variable-step simulation is recommended.
--Steve
Related Question