Call engOpen in C code, launch functionnal matlab engine but hangs on C process

16 views (last 30 days)
Hello, I'm testing matlab engine library with engdemo.c exemple.
Compiling the code directly with gcc:
$ export LD_LIBRARY_PATH="matlabroot/bin/glnxa64"
$ mv matlabroot/sys/os/glnxa64/libstdc++.so.6 matlabroot/sys/os/glnxa64/libstdc++.so.6.old (get rid of the clunky matlabroot/sys/os/glnxa64/libstdc++.so.6 in a dirty way and use /usr/lib/x86_64-linux-gnu/libstdc++.so.6 instead)
$ gcc -o engdemo -L matlabroot/bin/glnxa64 -lmx -leng -lm -lmex -lmat engdemo.c -Imatlabroot/extern/include
But when I run the executable, it calls engOpen(), launch a matlab command window but then hang inside the function. If I manually quit the matlab command window engOpen release the process but return NULL.
Thanks for your help!
EDIT: explicit "get rid of the clunky matlabroot/sys/os/glnxa64/libstdc++.so.6 in a dirty way and use /usr/lib/x86_64-linux-gnu/libstdc++.so.6 instead" sentence with the command used.
  4 Comments
Yongjian Feng
Yongjian Feng on 9 Dec 2021
Again, not a good idea. You renamed the libstdc++ shipped with matlab to force the process to use the system libstdc++. This will force matlab to use that lib as well. It can cause trouble.

Sign in to comment.

Accepted Answer

Nathan Arbeid
Nathan Arbeid on 9 Dec 2021
My hang issue was resoleved by setting the environement variable $PATH
export PATH=matlabroot/bin:$PATH
But do not understand why.

More Answers (0)

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!