Coder.ceval - Linking problem during compilation
3 views (last 30 days)
Show older comments
Hi,
I am trying to build a standalone C application using matlab coder. The final application will make use of a Matlab engine to give the option executing some user Matlab scripts if there is a licence available, and so I'm trying to use a small block of existing C which calls the engine, and include it.
The block of C I have usually compiles like this....
gcc -I/usr/local/MATLAB/R2015b/extern/include -I/usr/include/openmpi-x86_64 -O0 -g3 -Wall -c -fmessage-length=0 -o src/matlabCallFun.o ../src/matlabCallFun.c
gcc -L/usr/local/MATLAB/R2015b/bin/glnxa64 -Xlinker -rpath -Xlinker /usr/local/MATLAB/R2015b/bin/glnxa64 -o matlabEngine_demo src/matlabCallFun.o src/matlabEngine_demo.o -leng -lmx
So, I've been trying to replicate this in matlab as follows...
path = '/home/arwel/Documents/coding/cevalTests/mlEng';
incPath1 = '/usr/local/MATLAB/R2015b/extern/include';
incPath2 = '/usr/include/openmpi';
linkPath1 = '/usr/local/MATLAB/R2015b/bin/glnxa64';
linkFile1 = 'eng';
linkFile2 = 'mx';
source1 = 'matlabCallFun.c';
source2 = 'matlabEngine_demo.h';
coder.cinclude(source2);
coder.updateBuildInfo('addSourceFiles', source1);
coder.updateBuildInfo('addSourcePaths',path);
coder.updateBuildInfo('addIncludePaths',incPath1,incPath2);
coder.updateBuildInfo('addLinkObjects',linkFile1,linkPath1,'linkonly','true');
coder.updateBuildInfo('addLinkObjects',linkFile2,linkPath1,'linkonly','true');
end
However, then at the command line I get...
>> codegen engTest -o engTest_mex
??? Failed to apply the 'addLinkObjects' method to the BuildInfo: Incorrect arguments have been passed
to:
RTW.BuildInfo.addLinkObjects
Please refer to the help on this method for more information.
Error in ==> engTest Line: 29 Column: 1
Code generation failed: View Error Report
Error using codegen
So, obviously I've done something wrong here. How should the coder.xxxx's be properly set up to match the calls to gcc?
Many Thanks,
Arwel
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!