gmake: *** Error 1 when attempting to run Simulink with embedded Matlab Function

25 次查看(过去 30 天)
I am trying to run a Simulink model that has an embedded matlab function using the Pwelch function. However I get this error during the make process and I have no idea what the cause of the error is. Can you help?
Making simulation target "PCDS_SoI_Search_Process_Control_test1_sfun", ...
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include PCDS_SoI_Search_Process_Control_test1_sfun.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include PCDS_SoI_Search_Process_Control_test1_sfun_registry.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include c1_PCDS_SoI_Search_Process_Control_test1.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include c2_PCDS_SoI_Search_Process_Control_test1.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include c3_PCDS_SoI_Search_Process_Control_test1.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include c4_PCDS_SoI_Search_Process_Control_test1.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include c5_PCDS_SoI_Search_Process_Control_test1.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include c6_PCDS_SoI_Search_Process_Control_test1.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include c7_PCDS_SoI_Search_Process_Control_test1.c
/usr/local/matlab_2012b/bin/mex -c -O -DMATLAB_MEX_FILE -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../simulink/include -I/usr/local/matlab_2012b/toolbox/stateflow/stateflow/../../../extern/include -I/usr/local/matlab_2012b/stateflow/c/mex/include -I/usr/local/matlab_2012b/stateflow/c/debugger/include c8_PCDS_SoI_Search_Process_Control_test1.c
/usr/local/matlab_2012b/bin/mex -silent LDFLAGS="\$LDFLAGS " -output PCDS_SoI_Search_Process_Control_test1_sfun.mexa64 PCDS_SoI_Search_Process_Control_test1_sfun.o PCDS_SoI_Search_Process_Control_test1_sfun_registry.o c1_PCDS_SoI_Search_Process_Control_test1.o c2_PCDS_SoI_Search_Process_Control_test1.o c3_PCDS_SoI_Search_Process_Control_test1.o c4_PCDS_SoI_Search_Process_Control_test1.o c5_PCDS_SoI_Search_Process_Control_test1.o c6_PCDS_SoI_Search_Process_Control_test1.o c7_PCDS_SoI_Search_Process_Control_test1.o c8_PCDS_SoI_Search_Process_Control_test1.o /usr/local/matlab_2012b/stateflow/c/mex/lib/glnxa64/sfc_mex.a /usr/local/matlab_2012b/stateflow/c/debugger/lib/glnxa64/sfc_debug.a -L/usr/local/matlab_2012b/bin/glnxa64 -lfixedpoint -lut -lmwmathutil -lemlrt -lmwblascompat32 -L/usr/local/matlab_2012b/bin/glnxa64 -lippmwipt
c5_PCDS_SoI_Search_Process_Control_test1.o: In function `c5_d_sf_marshallOut':
c5_PCDS_SoI_Search_Process_Control_test1.c:(.text+0x104b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c5_PCDS_SoI_Search_Process_Control_test1.c:(.text+0x1079): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c5_PCDS_SoI_Search_Process_Control_test1.c:(.text+0x1080): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c5_PCDS_SoI_Search_Process_Control_test1.c:(.text+0x10dc): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c5_PCDS_SoI_Search_Process_Control_test1.o: In function `c5_d_sf_marshallIn':
c5_PCDS_SoI_Search_Process_Control_test1.c:(.text+0x25b4): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c5_PCDS_SoI_Search_Process_Control_test1.c:(.text+0x25dc): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c5_PCDS_SoI_Search_Process_Control_test1.c:(.text+0x25e3): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c5_PCDS_SoI_Search_Process_Control_test1.c:(.text+0x2636): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c8_PCDS_SoI_Search_Process_Control_test1.o: In function `c8_b_emlrt_marshallIn':
c8_PCDS_SoI_Search_Process_Control_test1.c:(.text+0xa3d): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c8_PCDS_SoI_Search_Process_Control_test1.c:(.text+0xa56): relocation truncated to fit: R_X86_64_PC32 against `.bss'
c8_PCDS_SoI_Search_Process_Control_test1.o: In function `c8_sf_marshallOut':
c8_PCDS_SoI_Search_Process_Control_test1.c:(.text+0xc94): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
mex: link of ' "PCDS_SoI_Search_Process_Control_test1_sfun.mexa64"' failed.
gmake: *** [PCDS_SoI_Search_Process_Control_test1_sfun.mexa64] Error 1

采纳的回答

Chris
Chris 2013-3-6
The source of the problem was found to be size limitations placed on the port dimensions for some signals in 'Model Explorer'. In some cases these limitations were being exceeded. It is a real challenge working with Variable-size signals within a Simulink Model that uses embedded Matlab functions.
Code size was not an issue.

更多回答(2 个)

Walter Roberson
Walter Roberson 2013-2-7
I have not used Stateflow, but I am familiar with C.
The error being reported about .bss is about problems with static variables initialized to 0s. These would be variables outside the stack, and outside the heap too, as they would be statically sized in advance.
I do not know Simulink to give an example of what might be realistic in it, but an example more generally would be if code allocated a fixed-length buffer for input, perhaps as a global variable, then the buffer might be allocated to .bss .
The messages being given would correspond to there being a number of such variables being created in c5_d_sf_marshallOut and at least one of the variables is too large to represent. I do not know the details of the compiler you are using (Linux, isn't it?) so I cannot comment on what the limit might be. At least (4 Gigabytes minus 4 bytes) I would think.
You could try looking through the source for c5_d_sf_marshallOut and seeing if you can find any huge variables.
  1 个评论
Kaustubha Govind
Kaustubha Govind 2013-2-7
From a web search, I also found that this error usually occurs when the size of the code is very large (>2GB). I would recommend that you report this to MathWorks Technical Support, since the code being compiled is internally generated by the MATLAB Function block.

请先登录,再进行评论。


Andrea Pirlo
Andrea Pirlo 2021-3-31
You can solve such problem by installing MinGW-w64 compiler!

标签

Community Treasure Hunt

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

Start Hunting!

Translated by