Clear Filters
Clear Filters

Invalid MEX-file '/filepath​/filename.​mexa64': Gateway function is missing

8 views (last 30 days)
Hello everyone! I am trying to implement a Matlab wrapper for Graph Cuts (can be found here if it helps: http://www.wisdom.weizmann.ac.il/~bagon/matlab.html), but even though the MEX completes successfully, I get the error: "Invalid MEX-file '/home/agapi/Desktop/GCmex2.0/GraphCut.mexa64': Gateway function is missing".
I am using Ubuntu 18.04 and Matlab R2019b.
I found some similar posts, but nothing helped me. Any help would be appreciated!
Here's the output from MEX in verbose mode (I also tried mex -v -R2017b):
>> mex -v -R2018a /home/agapi/Desktop/GCmex2.0/GraphCut.cpp
Verbose mode is on.
... Looking for compiler 'g++' ...
... Executing command 'which g++' ...Yes ('/usr/bin/g++').
... Executing command 'g++ -print-file-name=libstdc++.so' ...Yes ('/usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.so').
... Executing command 'g++ -dumpversion' ...Yes ('7').
... Executing command 'which g++' ...Yes ('/usr/bin/g++').
... Looking for folder '/usr' ...Yes.
... Executing command 'g++ -dumpmachine' ...Yes ('x86_64-linux-gnu').
Found installed compiler 'g++'.
Set INCLUDE = /usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/include/c++/7;/usr/include/c++/7/x86_64-linux-gnu;/usr/include/c++/7/backward;/usr/lib/gcc/x86_64-linux-gnu/7/include;/usr/include/c++/7;/usr/include/c++/7/x86_64-linux-gnu;/usr/include/c++/7/backward;
Options file details
-------------------------------------------------------------------
Compiler location: /usr/bin/g++
Options file: /home/agapi/.matlab/R2019b/mex_C++_glnxa64.xml
CMDLINE2 : /usr/bin/g++ -pthread -Wl,--no-undefined -shared -O -Wl,--version-script,"/usr/local/MATLAB/R2019b/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_8362525622774_7001/GraphCut.o /tmp/mex_8362525622774_7001/cpp_mexapi_version.o -Wl,--as-needed -Wl,-rpath-link,/usr/local/MATLAB/R2019b/bin/glnxa64 -L"/usr/local/MATLAB/R2019b/bin/glnxa64" -Wl,-rpath-link,/usr/local/MATLAB/R2019b/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2019b/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lstdc++ -o GraphCut.mexa64
CXX : /usr/bin/g++
DEFINES : -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE
MATLABMEX : -DMATLAB_MEX_FILE
CFLAGS : -fexceptions -fPIC -fno-omit-frame-pointer -pthread
CXXFLAGS : -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11
INCLUDE : -I"/usr/local/MATLAB/R2019b/extern/include" -I"/usr/local/MATLAB/R2019b/simulink/include"
CXXOPTIMFLAGS : -O2 -fwrapv -DNDEBUG
CXXDEBUGFLAGS : -g
LDXX : /usr/bin/g++
LDFLAGS : -pthread -Wl,--no-undefined
LDTYPE : -shared
LINKEXPORT : -Wl,--version-script,"/usr/local/MATLAB/R2019b/extern/lib/glnxa64/mexFunction.map"
LINKEXPORTVER : -Wl,--version-script,"/usr/local/MATLAB/R2019b/extern/lib/glnxa64/c_exportsmexfileversion.map"
LINKLIBS : -Wl,--as-needed -Wl,-rpath-link,/usr/local/MATLAB/R2019b/bin/glnxa64 -L"/usr/local/MATLAB/R2019b/bin/glnxa64" -Wl,-rpath-link,/usr/local/MATLAB/R2019b/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2019b/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lstdc++
LDOPTIMFLAGS : -O
LDDEBUGFLAGS : -g
MWCPPLIB : "/usr/local/MATLAB/R2019b/sys/os/glnxa64/libstdc++.so.6"
OBJEXT : .o
LDEXT : .mexa64
SETENV : CC="gcc"
CXX="/usr/bin/g++"
CFLAGS="-fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE "
CXXFLAGS="-fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE "
COPTIMFLAGS="-O2 -fwrapv -DNDEBUG"
CXXOPTIMFLAGS="-O2 -fwrapv -DNDEBUG"
CDEBUGFLAGS="-g"
CXXDEBUGFLAGS="-g"
LD="gcc"
LDXX="/usr/bin/g++"
LDFLAGS="-pthread -Wl,--no-undefined -shared -Wl,--as-needed -Wl,-rpath-link,/usr/local/MATLAB/R2019b/bin/glnxa64 -L"/usr/local/MATLAB/R2019b/bin/glnxa64" -Wl,-rpath-link,/usr/local/MATLAB/R2019b/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2019b/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lstdc++ -Wl,--version-script,"/usr/local/MATLAB/R2019b/extern/lib/glnxa64/mexFunction.map""
LDDEBUGFLAGS="-g"
GCC : /usr/bin/g++
CPPLIB_DIR : /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.so
VER : 7
GCCDIR : /usr
GCC_TARGET : x86_64-linux-gnu
MATLABROOT : /usr/local/MATLAB/R2019b
ARCH : glnxa64
SRC : "/home/agapi/Desktop/GCmex2.0/GraphCut.cpp";"/usr/local/MATLAB/R2019b/extern/version/cpp_mexapi_version.cpp"
OBJ : /tmp/mex_8362525622774_7001/GraphCut.o;/tmp/mex_8362525622774_7001/cpp_mexapi_version.o
OBJS : /tmp/mex_8362525622774_7001/GraphCut.o /tmp/mex_8362525622774_7001/cpp_mexapi_version.o
SRCROOT : /home/agapi/Desktop/GCmex2.0/GraphCut
DEF : /tmp/mex_8362525622774_7001/GraphCut.def
EXP : "GraphCut.exp"
LIB : "GraphCut.lib"
EXE : GraphCut.mexa64
ILK : "GraphCut.ilk"
MANIFEST : "GraphCut.mexa64.manifest"
TEMPNAME : GraphCut
EXEDIR :
EXENAME : GraphCut
OPTIM : -O2 -fwrapv -DNDEBUG
LINKOPTIM : -O
CMDLINE1_0 : /usr/bin/g++ -c -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2019b/extern/include" -I"/usr/local/MATLAB/R2019b/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O2 -fwrapv -DNDEBUG "/home/agapi/Desktop/GCmex2.0/GraphCut.cpp" -o /tmp/mex_8362525622774_7001/GraphCut.o
CMDLINE1_1 : /usr/bin/g++ -c -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2019b/extern/include" -I"/usr/local/MATLAB/R2019b/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O2 -fwrapv -DNDEBUG "/usr/local/MATLAB/R2019b/extern/version/cpp_mexapi_version.cpp" -o /tmp/mex_8362525622774_7001/cpp_mexapi_version.o
-------------------------------------------------------------------
Building with 'g++'.
Warning: You are using gcc version '7.4.0'. The version of gcc is not supported. The version currently supported with MEX is
'6.3.x'. For a list of currently supported compilers see: https://www.mathworks.com/support/compilers/current_release.
/usr/bin/g++ -c -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2019b/extern/include" -I"/usr/local/MATLAB/R2019b/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O2 -fwrapv -DNDEBUG "/home/agapi/Desktop/GCmex2.0/GraphCut.cpp" -o /tmp/mex_8362525622774_7001/GraphCut.o
/usr/bin/g++ -c -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -D_GNU_SOURCE -DMATLAB_MEX_FILE -I"/usr/local/MATLAB/R2019b/extern/include" -I"/usr/local/MATLAB/R2019b/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++11 -O2 -fwrapv -DNDEBUG "/usr/local/MATLAB/R2019b/extern/version/cpp_mexapi_version.cpp" -o /tmp/mex_8362525622774_7001/cpp_mexapi_version.o
/usr/bin/g++ -pthread -Wl,--no-undefined -shared -O -Wl,--version-script,"/usr/local/MATLAB/R2019b/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_8362525622774_7001/GraphCut.o /tmp/mex_8362525622774_7001/cpp_mexapi_version.o -Wl,--as-needed -Wl,-rpath-link,/usr/local/MATLAB/R2019b/bin/glnxa64 -L"/usr/local/MATLAB/R2019b/bin/glnxa64" -Wl,-rpath-link,/usr/local/MATLAB/R2019b/extern/bin/glnxa64 -L"/usr/local/MATLAB/R2019b/extern/bin/glnxa64" -lMatlabDataArray -lmx -lmex -lmat -lm -lstdc++ -o GraphCut.mexa64
MEX completed successfully.
>> GraphCut
Invalid MEX-file '/home/agapi/Desktop/GCmex2.0/GraphCut.mexa64': Gateway function is missing
  1 Comment
Jiajia
Jiajia on 14 Feb 2020
I have a similar problem when using ubuntu 18 and Matllab R2018a. Was anyone able to figure out a solution to this problem?

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Compiler 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!