Specifically how do you get a successful compilation of mengine? I tried the following:

sudo make -f Makefile.lin64

and got the following output:

g++ -O -Wall -I/usr/local/Wolfram/Mathematica/11.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions -I/usr/local/MATLAB/R2016a/bin/../extern/include -L/usr/local/Wolfram/Mathematica/11.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions -L/usr/local/MATLAB/R2016a/bin/../bin/glnxa64 menginetm.cpp mengine.cpp set.cpp get.cpp main.cpp -Wl,-rpath-link,/usr/local/MATLAB/R2016a/bin/../bin/glnxa64/ -DMLINTERFACE=3 -lML64i3 -luuid -lmx -leng -o mengine
set.cpp: In function ‘void eng_make_String(const short unsigned int*, int)’:
set.cpp:160:31: warning: narrowing conversion of ‘len’ from ‘int’ to ‘mwSize {aka long unsigned int}’ inside { } is ill-formed in C++11 [-Wnarrowing]
     mwSize mbDims[2] = {1, len};
In file included from /usr/include/c++/4.9.2/cassert:43:0,
                 from set.cpp:13:
set.cpp: In function ‘void eng_make_Struct()’:
set.cpp:192:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     assert(mxGetNumberOfElements(var) == len);
/bin/ld: cannot find -luuid
collect2: error: ld returned 1 exit status
Makefile.lin64:21: recipe for target 'mengine' failed
make: *** [mengine] Error 1
  • $\begingroup$ Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – user9660 Sep 19 '16 at 8:41
  • $\begingroup$ Don't use sudo for this, it should not be necessary. Even though in this case I could see what was wrong without additional information, please always give the following information with future requests: MATLAB version, Linux distro & version, gcc version, and the output of MATLink`Developer`GetInfo[]. $\endgroup$ – Szabolcs Sep 19 '16 at 8:55

When something goes wrong with MATLink, the first thing to do is to go to its troubleshooting page:

There, under the Linux heading, you'll find a reminder of the basic requirements for MATLink to compile/work. Among them,

  • Ensure that development libraries for libuuid are installed. On Ubuntu, use apt-get install uuid-dev

Additionally (just in case this comes up later), it is important to use a C compiler compatible with your version of MATLAB. The compiler requirements are listed by MathWorks for each MATLAB version. You'll find them here for R2016b (click "Linux" at the top): it is gcc 4.9.x. For R2016a it is gcc 4.8.x. Older gcc will not work.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.