MATLAB Answers

Video processing model can't be compiled by real-time windows target

2 views (last 30 days)
Jan Kappen
Jan Kappen on 23 May 2013
Answered: Omar Crypps on 3 Jan 2017
Hello guys,
I've got a strange problem here. What I try to do is creating code for the real-time windows target from a model that use the "from video device" block (which is able to generate code, see http://www.mathworks.de/de/help/imaq/fromvideodevice.html), the "blob analysis" and the "optical flow" blocks.
The compiler error is:
...
### Processing Template Makefile: C:\Program Files\MATLAB\R2012b\toolbox\rtw\targets\rtwin\rtwin\rtwin.tmf
### Creating untitled2.mk from C:\Program Files\MATLAB\R2012b\toolbox\rtw\targets\rtwin\rtwin\rtwin.tmf
### Building untitled2: .\untitled2.bat
R:\MATLAB\untitled2_rtwin_win64>set MATLAB=C:\Program Files\MATLAB\R2012b
R:\MATLAB\untitled2_rtwin_win64>"C:\PROGRA~1\MATLAB\R2012b\bin\win64\gmake" -f untitled2.mk GENERATE_REPORT=0 EXTMODE_STATIC_ALLOC=0 EXTMODE_STATIC_ALLOC_SIZE=1000000 TMW_EXTMODE_TESTING=0
### Compiling untitled2.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "untitled2.obj" "untitled2.c"
### Compiling C:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/src/HostLib_rtw.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "HostLib_rtw.obj" "C:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/src/HostLib_rtw.c"
### Compiling C:/PROGRA~1/MATLAB/R2012b/toolbox/vision/extern/vipopticalflow/opticalflow_hs_z_rt.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "opticalflow_hs_z_rt.obj" "C:/PROGRA~1/MATLAB/R2012b/toolbox/vision/extern/vipopticalflow/opticalflow_hs_z_rt.c"
### Compiling rtGetInf.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "rtGetInf.obj" "rtGetInf.c"
### Compiling rtGetNaN.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "rtGetNaN.obj" "rtGetNaN.c"
### Compiling rt_nonfinite.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "rt_nonfinite.obj" "rt_nonfinite.c"
### Compiling C:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include/simaqcodegen.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "simaqcodegen.obj" "C:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include/simaqcodegen.c"
### Compiling C:/PROGRA~1/MATLAB/R2012b/toolbox/vision/extern/vipopticalflow/sobelderivative_hs_d_rt.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "sobelderivative_hs_d_rt.obj" "C:/PROGRA~1/MATLAB/R2012b/toolbox/vision/extern/vipopticalflow/sobelderivative_hs_d_rt.c"
### Compiling untitled2_data.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "untitled2_data.obj" "untitled2_data.c"
### Compiling C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src/rtwin_main.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "rtwin_main.obj" "C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src/rtwin_main.c"
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src/rtwin_main.c:119:9: warning: 'EXTERN_C' macro redefined
#define EXTERN_C
^
C:\Program Files\Microsoft SDKs\Windows\v7.1\\include\winnt.h:549:13: note: previous definition is here
#define EXTERN_C extern
^
1 warning generated.
### Compiling C:/PROGRA~1/MATLAB/R2012b/rtw/c/src/rt_sim.c
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/clang -m64 -emit-llvm -c -O4 -Wno-switch-enum -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/include -I. -I.. -IC:/PROGRA~1/MATLAB/R2012b/simulink/include -IC:/PROGRA~1/MATLAB/R2012b/extern/include -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2012b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/src -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dspblks/extern/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/imaq/imaqblks/include -IC:/PROGRA~1/MATLAB/R2012b/toolbox/shared/dsp/vision/matlab/include -IR:/MATLAB/untitled2_rtwin_win64 -IR:/MATLAB -IC:/PROGRA~1/MATLAB/R2012b/toolbox/vision/include -DEXT_MODE -DUSE_RTMODEL -DMODEL=untitled2 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__STDC__ -U_MSC_VER -o "rt_sim.obj" "C:/PROGRA~1/MATLAB/R2012b/rtw/c/src/rt_sim.c"
### Created Real-Time Windows Target module untitled2.rxw64
C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/llvm/bin/llvm-ld -b untitled2.bc -o untitled2.tmp untitled2.obj HostLib_rtw.obj opticalflow_hs_z_rt.obj rtGetInf.obj rtGetNaN.obj rt_nonfinite.obj simaqcodegen.obj sobelderivative_hs_d_rt.obj untitled2_data.obj rtwin_main.obj rt_sim.obj ext_svr.obj updown_rtwin.obj C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/win64/imports.obj C:/PROGRA~1/MATLAB/R2012b/toolbox/rtw/targets/rtwin/lib/win64/rtwinmod.lib
llvm-ld: error: Cannot link file 'HostLib_rtw.obj': Linking globals named '_InterlockedAdd': symbol multiply defined!
gmake: *** [../untitled2.rxw64] Error 1
### Build procedure for model: 'untitled2' aborted due to an error.
so it seems there is only a problem with the linker due to multiple definitions in the blocks' s-functions. But I don't know in which files and whether i can modify them.. I recognized, that if I remove one (random) block of the three the model compiles.
Any help is appreciated ;)
Thank you, Jan
  1 Comment
Kaustubha Govind
Kaustubha Govind on 23 May 2013
I wonder if this is a bug. You could try sending your model to MathWorks Support to see if they are able to provide a resolution.

Sign in to comment.

Answers (2)

Jan Houska
Jan Houska on 27 May 2013
It is not possible to use the "From Video Device" block with Real-Time Windows Target. Although this block generates code, the generated code depends on Win32 API that is not present in the Real-Time Windows Target real-time kernel.
An alternative could be to use Real-Time Windows Target in Normal Mode and to run the model uncompiled. This way there will be no problems with using the block if the performance of Normal Mode is enough for your model.
  4 Comments
Jan Houska
Jan Houska on 28 May 2013
Normal Mode models run synchronously with real time when you place the Real-Time Synchronization block into the model. This feature is available starting with MATLAB R2012a.
So the Real-Time Synchronization block may be all you need.

Sign in to comment.


Omar Crypps
Omar Crypps on 3 Jan 2017
Hi everyone,
I'm actually trying to use Simulink Real Time video blocks to get the video on the target computer using a Logitech webcam, the link between the host and the target computer is already done and works fine.
The problem that I faced is that I got errors when trying to see the video on the target monitor. Here are the two errors :
- Video device is not found (even if the Logitech Webcam appears in the USB Video Device List).
- No UDP channel free or UDP error.
I will add the model that I made in the attached file, hoping to have some help from the mathworks community.

Community Treasure Hunt

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

Start Hunting!