4
$\begingroup$

Following the instructions in the MATLink website I am posting my issue when compiling MEngine on a Linux machine. I have checked that csh, g++ and libuuid are properly installed. I am trying to link Mathematica 13.0.0 with MATLAB R2018a. According to the documentation, the compiler supported is gcc 6.3.x. I have tried gcc version 6.4.0 20180424 (Ubuntu 6.4.0-17ubuntu1) and gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) (I have been unable to download any lower version), and both throw the same error. Here are the details:

In[2]:= MATLink`Developer`GetInfo[]

MATLink 1.1 for Unix (Fri 15 Aug 2014)

13.0.0 for Linux x86 (64-bit) (December 3, 2021)

csh:
/bin/csh

g++:
/usr/bin/g++

MATLAB:
/usr/local/MATLAB/R2018a/bin

libuuid:
    libuuid.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libuuid.so.1
    libuuid.so.1 (libc6) => /lib/i386-linux-gnu/libuuid.so.1
    libuuid.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libuuid.so

System PATH:
/usr/local/Wolfram/Mathematica/13.0/Executables
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/usr/local/MATLAB/R2018a/bin
/snap/bin
/home/apozas/mosek/8/tools/platform/linux64x86/bin

Error:

make -f Makefile.lin64
g++ -O -Wall -I/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions -I/usr/local/MATLAB/R2018a/bin/../extern/include -L/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions -L/usr/local/MATLAB/R2018a/bin/../bin/glnxa64 menginetm.cpp mengine.cpp set.cpp get.cpp main.cpp -Wl,-rpath-link,/usr/local/MATLAB/R2018a/bin/../bin/glnxa64/ -DMLINTERFACE=3 -lML64i3 -luuid -lmx -leng -o mengine
In file included from menginetm.cpp:9:
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:22: error: stray ‘\’ in program
  116 | /*\ syntax\ error\ */\ )
      |                      ^
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:24: error: expected unqualified-id before ‘)’ token
  116 | /*\ syntax\ error\ */\ )
      |                        ^
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:544:2: error: ‘wint’ does not name a type; did you mean ‘_wint’?
  544 |  wint low, hi;
      |  ^~~~
      |  _wint
In file included from mlp.h:11,
                 from mengine.h:11,
                 from mengine.cpp:8:
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:22: error: stray ‘\’ in program
  116 | /*\ syntax\ error\ */\ )
      |                      ^
In file included from mlp.h:11,
                 from mengine.h:11,
                 from mengine.cpp:8:
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:24: error: expected unqualified-id before ‘)’ token
  116 | /*\ syntax\ error\ */\ )
      |                        ^
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:544:2: error: ‘wint’ does not name a type; did you mean ‘_wint’?
  544 |  wint low, hi;
      |  ^~~~
      |  _wint
In file included from mlp.h:11,
                 from mengine.h:11,
                 from set.cpp:8:
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:22: error: stray ‘\’ in program
  116 | /*\ syntax\ error\ */\ )
      |                      ^
In file included from mlp.h:11,
                 from mengine.h:11,
                 from set.cpp:8:
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:24: error: expected unqualified-id before ‘)’ token
  116 | /*\ syntax\ error\ */\ )
      |                        ^
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:544:2: error: ‘wint’ does not name a type; did you mean ‘_wint’?
  544 |  wint low, hi;
      |  ^~~~
      |  _wint
In file included from /usr/include/c++/9/cassert:44,
                 from set.cpp:13:
set.cpp: In function ‘void eng_make_Struct()’:
set.cpp:192:39: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  192 |     assert(mxGetNumberOfElements(var) == len);
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
In file included from mlp.h:11,
                 from mengine.h:11,
                 from get.cpp:8:
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:22: error: stray ‘\’ in program
  116 | /*\ syntax\ error\ */\ )
      |                      ^
In file included from mlp.h:11,
                 from mengine.h:11,
                 from get.cpp:8:
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:24: error: expected unqualified-id before ‘)’ token
  116 | /*\ syntax\ error\ */\ )
      |                        ^
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:544:2: error: ‘wint’ does not name a type; did you mean ‘_wint’?
  544 |  wint low, hi;
      |  ^~~~
      |  _wint
In file included from mlp.h:11,
                 from mengine.h:11,
                 from main.cpp:8:
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:22: error: stray ‘\’ in program
  116 | /*\ syntax\ error\ */\ )
      |                      ^
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:116:24: error: expected unqualified-id before ‘)’ token
  116 | /*\ syntax\ error\ */\ )
      |                        ^
/usr/local/Wolfram/Mathematica/13.0/Executables/../SystemFiles/Links/MathLink/DeveloperKit/Linux-x86-64/CompilerAdditions/mathlink.h:544:2: error: ‘wint’ does not name a type; did you mean ‘_wint’?
  544 |  wint low, hi;
      |  ^~~~
      |  _wint
make: *** [Makefile.lin64:21: mengine] Error 1

The error is the same when using g++ 6 and 9. I also tried the solution suggested here, without success.

Thank you for the assistance.

$\endgroup$
2
  • $\begingroup$ I am able to build the binary with the following compiler flag: CFLAGS = -Wall -DMX_COMPAT_32 on RHEL 8.2, Lustre 2.12.6_ddn51 while using MMA 13 and Matlab 2021a. I get the same compiler errors without invoking the compiler flag. Nevertheless, the build lets crash Matlab, hence for my configuration MATLink is at the moment useless. Let me know if it works for Matlab R2018a. $\endgroup$ Commented Mar 1, 2022 at 12:21
  • $\begingroup$ This did not work for me. Adding the flag -DMX_COMPAT_32 did not change the error message in my case. $\endgroup$
    – Alex
    Commented Mar 1, 2022 at 14:58

1 Answer 1

1
$\begingroup$

After posting an issue on Github, I got the following guidance, which worked without problem.

szhorvat on Github:

Edit Makefile.lin64 and:

  • Add -DMX_COMPAT_32 to CFLAGS
  • Remove -DMLINTERFACE=3
  • Replace -lML64i3 by -lML64i4
$\endgroup$
2
  • $\begingroup$ Thanks for posting it! I didn't see the question here on SE. Unfortunately, we don't have a lot of time to work on MATLink anymore. $\endgroup$
    – Szabolcs
    Commented Mar 24, 2022 at 7:17
  • $\begingroup$ That makes your quick response even more valuable. Thank you very much for the assistance. Honestly, if you hadn't provided a solution, I would have downgraded my version of Mathematica. I'd rather keep using MATLink than have the latest MMA. So thanks also for the software. $\endgroup$
    – Alex
    Commented Mar 24, 2022 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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