How do I create a C++ Shared Object using MATLAB 2017b (i.e. 9.3)?

20 visualizaciones (últimos 30 días)
Mohinder Dick
Mohinder Dick el 9 de Nov. de 2018
Editada: Mohinder Dick el 9 de Nov. de 2018
I am trying to compile a MATLAB script as a shared object on Ubuntu with MATLAB 2017b installed and 9.3 of the run-time as well. I followed the instruction here . But I get an error telling me that matlab.h is missing. I cannot find that file when searching for it manually. I also cannot resolve the errors I get if a do not include matlab.h.
Please point me to an updated set of instructions or let me know how to otherwise resolve this issue.
I have MATLAB, the runtime and the compiler installed on Windows as well. I did not find matlab.h there either. I pasted the error I get below:
mdick@ubuntu-server-databank01:~/projects/scarp/test$ mbuild adderwrap.c -L./ -I./ -lAdder -v Verbose mode is on. No MEX options file identified; looking for an implicit selection. ... Looking for compiler 'gcc' ... ... Executing command 'which gcc' ...Yes ('/usr/bin/gcc'). ... Executing command 'gcc -print-file-name=libstdc++.so' ...Yes ('/usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.so'). Found installed compiler 'gcc'. Options file details ------------------------------------------------------------------- Compiler location: /usr/bin/gcc Options file: /usr/local/MATLAB/R2017b/bin/glnxa64/mexopts/gcc_glnxa64.xml CMDLINE1 : /usr/bin/gcc -c -DMX_COMPAT_64 -DUSE_MEX_CMD -D_GNU_SOURCE -DUNIX -DX11 -I"." -I"/usr/local/MATLAB/R2017b/extern/include" -I"/usr/local/MATLAB/R2017b/simulink/include" -ansi -pthread -O -DNDEBUG "/home/mdick/projects/scarp/test/adderwrap.c" -o /tmp/mex_2126057211523715_33481/adderwrap.o CMDLINE2 : /usr/bin/gcc -pthread -Wl,-rpath-link,/usr/local/MATLAB/R2017b/bin/glnxa64 -O /tmp/mex_2126057211523715_33481/adderwrap.o -lAdder -L. "/usr/local/MATLAB/R2017b/sys/os/glnxa64/libstdc++.so.6" -L"/usr/local/MATLAB/R2017b/runtime/glnxa64" -lm -lmwmclmcrrt -o adderwrap CC : /usr/bin/gcc DEFINES : -DMX_COMPAT_64 -DUSE_MEX_CMD -D_GNU_SOURCE -DUNIX -DX11 MATLABMEX : CFLAGS : -ansi -pthread INCLUDE : -I"." -I"/usr/local/MATLAB/R2017b/extern/include" -I"/usr/local/MATLAB/R2017b/simulink/include" COPTIMFLAGS : -O -DNDEBUG CDEBUGFLAGS : -g LD : /usr/bin/gcc LDFLAGS : -pthread -Wl,-rpath-link,/usr/local/MATLAB/R2017b/bin/glnxa64 LDTYPE : FUNCTIONMAP : "/usr/local/MATLAB/R2017b/extern/lib/glnxa64/mexFunction.map" VERSIONMAP : "/usr/local/MATLAB/R2017b/extern/lib/glnxa64/c_exportsmexfileversion.map" LINKEXPORT : LINKEXPORTVER : LINKLIBS : -lAdder -L. "/usr/local/MATLAB/R2017b/sys/os/glnxa64/libstdc++.so.6" -L"/usr/local/MATLAB/R2017b/runtime/glnxa64" -lm -lmwmclmcrrt LDOPTIMFLAGS : -O LDDEBUGFLAGS : -g MWCPPLIB : "/usr/local/MATLAB/R2017b/sys/os/glnxa64/libstdc++.so.6" OBJEXT : .o LDEXT : SETENV : CC="/usr/bin/gcc" CXX="g++" CFLAGS="-ansi -pthread -DMX_COMPAT_64 -DUSE_MEX_CMD -D_GNU_SOURCE -DUNIX -DX11" CXXFLAGS="-ansi -pthread -std=c++11 -DMX_COMPAT_64 -DUSE_MEX_CMD -D_GNU_SOURCE -DUNIX -DX11" COPTIMFLAGS="-O -DNDEBUG" CXXOPTIMFLAGS="-O -DNDEBUG" CDEBUGFLAGS="-g" CXXDEBUGFLAGS="-g" LD="/usr/bin/gcc" LDXX="g++" LDFLAGS="-pthread -Wl,-rpath-link,/usr/local/MATLAB/R2017b/bin/glnxa64 -lAdder -L. "/usr/local/MATLAB/R2017b/sys/os/glnxa64/libstdc++.so.6" -L"/usr/local/MATLAB/R2017b/runtime/glnxa64" -lm -lmwmclmcrrt " LDDEBUGFLAGS="-g" GCC : /usr/bin/gcc CPPLIBS : /usr/lib/gcc/x86_64-linux-gnu/5/libstdc++.so MATLABROOT : /usr/local/MATLAB/R2017b ARCH : glnxa64 SRC : "/home/mdick/projects/scarp/test/adderwrap.c" OBJ : /tmp/mex_2126057211523715_33481/adderwrap.o OBJS : /tmp/mex_2126057211523715_33481/adderwrap.o SRCROOT : /home/mdick/projects/scarp/test/adderwrap DEF : /tmp/mex_2126057211523715_33481/adderwrap.def EXP : adderwrap.exp LIB : adderwrap.lib EXE : adderwrap ILK : adderwrap.ilk MANIFEST : adderwrap.manifest TEMPNAME : adderwrap EXEDIR : EXENAME : adderwrap OPTIM : -O -DNDEBUG LINKOPTIM : -O ------------------------------------------------------------------- Building with 'gcc'. Warning: You are using gcc version '5.4.0'. The version of gcc is not supported. The version currently supported with MEX is '4.9.x'. For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release. /usr/bin/gcc -c -DMX_COMPAT_64 -DUSE_MEX_CMD -D_GNU_SOURCE -DUNIX -DX11 -I"." -I"/usr/local/MATLAB/R2017b/extern/include" -I"/usr/local/MATLAB/R2017b/simulink/include" -ansi -pthread -O -DNDEBUG "/home/mdick/projects/scarp/test/adderwrap.c" -o /tmp/mex_2126057211523715_33481/adderwrap.o /home/mdick/projects/scarp/test/adderwrap.c:7:21: fatal error: matlab.h: No such file or directory compilation terminated.

Respuestas (0)

Categorías

Más información sobre Get Started with MATLAB Compiler SDK en Help Center y File Exchange.

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by