Clear Filters
Clear Filters

Coder.ceval - Linking problem during compilation

3 views (last 30 days)
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.updateBuildInfo('addSourceFiles', source1);
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
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,

Answers (0)


Find more on MATLAB Code Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!