Segmentation Fault when using MATLAB Engine with RHEL or CentOS Linux
42 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2021 年 6 月 3 日
編集済み: MathWorks Support Team
2022 年 9 月 29 日
When I run this simple script using MATLAB Engine for Python on RHEL (or Centos) Linux, I get a Segmentation Fault.
import matlab.engine
eng=matlab.engine.start_matlab()
eng.sqrt(4.)
Sometimes, instead of a Segmentation fault, I get the following type of error.
"libstdc++.so.6: 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
2024 年 3 月 7 日
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/glibc-2.17_shim.so
For a bash terminal, execute the following command.
export LD_PRELOAD=matlabroot/bin/glnxa64/glibc-2.17_shim.so
Run the Python code in the same terminal.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Python Package Integration についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!