Simulink CompVision Embedded Coder Generation Bug: HostLib_rtw.c cannot open library: libmwfrommmfile.so with g++ compiler

2 views (last 30 days)
Hi,
The model I used is vipcodec_color.mdl in Computer Vision System Toolbox in Simulink. And I generated the Video source block to C++ block using ert.tlc. It compiles fine with g++ compiler, but at run-time, it failed with no correct output. I dig into it a bit and found out that the generated code has external linkage of HostLib_rtw.c which is from the toolbox lib of glnx86. And in HostLib_rtw.c, it tries to do dlopen("libmwfrommmfile.so", RTLD_NOW | RTLD_LOCAL). It fails by returning null. I tried with both setting LD_LIBRARY_PATH and absolute path in the string of dlopen(), it both failed.
As a comparison, when I generated the code to C (using GCC to link), rather than C++, everything worked fine and dlopen works correctly. But if I added -lstdc++ to the compiling argument of linkage of GCC, same symptom occurred as above.
So, it seems to me that it all comes to the stdc++ linker option.
I'd like to attach some source code and makefile, but not sure how to.
Thank you for your help. Jiaxing
Some basic information:
OS: Linux 32-bit Product: MATLAB R2011b 32bit Environment: Simulink Computer Vision system Toolbox Model: vipcodec_coler.mdl Code Generation Target: ert.tlc
Linking commands: 1. G++ compiler: g++ -m32 -lm -ldl -o ../Video -lm HostLib_MMFile.o HostLib_Multimedia.o HostLib_rtw.o Video.o ert_main.o
Res: dlopen failed
2. GCC compiler: gcc -m32 -lm -ldl -o ../Video -lm HostLib_MMFile.o HostLib_Multimedia.o HostLib_rtw.o Video.o ert_main.o
Res: dlopen succeeded
3. GCC compiler with C++ flag: gcc -m32 -lm -ldl -o ../Video -lm HostLib_MMFile.o HostLib_Multimedia.o HostLib_rtw.o Video.o ert_main.o -lstdc++
Res: dlopen failed

Answers (0)

Community Treasure Hunt

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

Start Hunting!