Segmentation Fault when using MATLAB Engine with RHEL or CentOS Linux

45 ビュー (過去 30 日間)
When I run this simple script using MATLAB Engine for Python on RHEL (or Centos) Linux, I get a Segmentation Fault.
import matlab.engine
Sometimes, instead of a Segmentation fault, I get the following type of error.
" undefined symbol: __cxa_thread_atexit_impl"
How can I fix these errors when using MATLAB Engine with RHEL 7 (or Centos 7) Linux?


MathWorks Support Team
MathWorks Support Team 2022 年 9 月 29 日
There can be an incompatibility of the C runtime for MATLAB Engine on some RedHat and CentOS Linux operating systems. If that is the case, forcing Python Engine to load the shim library will fix the issue. Follow the steps below to preload the shim library.
On the Linux machine:
Find the path to the MATLAB root folder. This path can be displayed by typing the following command in the MATLAB Command Window.
>> matlabroot
Substitute this path for matlabroot  in the commands below.
In a Linux terminal, determine the name of the shim library
ls matlabroot/bin/glnxa64/glibc-*
Determine the name of the shim library
ls matlabroot/bin/glnxa64/glibc-*
Determine which type of terminal is being used.
echo $0
For a csh/tcsh terminal, execute the following command (this example assumes 2.17 version of the shim library)
setenv LD_PRELOAD matlabroot/bin/glnxa64/
For a bash terminal, execute the following command.
export LD_PRELOAD=matlabroot/bin/glnxa64/
Run the Python code in the same terminal.

その他の回答 (0 件)



Community Treasure Hunt

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

Start Hunting!

Translated by