MATLAB crashes after setting LD_PRELOAD parameter

12 vues (au cours des 30 derniers jours)
Stefan
Stefan le 5 Sep 2023
Réponse apportée : Abhas le 31 Déc 2024
I am trying to integrate external cpp code into simulink using S-Functions. I have got the external cpp code pre-compiled in a shared library form. When I compile the S-function code using mex command, it compiles successfully but when i try to load the S-function, it gives me the error below.
/home/divyanshu/MATLAB/R2023a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by
/home/divyanshu/build_workspace/develop/simulink_tests/libs/libutils.so)
I have seen similar issues on the MATLAB forum and they suggest setting the LD_PRELOAD param but after setting the param and trying to load the mex executable, the entire MATLAB crashes and there is no warning or error message. I am assuming this issue is because of broken dependecies because of LD_PRELOAD. I saw this link facing the same issue but i am not sure it helps me at all. What can I do about this as I am all out of options?
  1 commentaire
Ganesh
Ganesh le 14 Sep 2023
Requesting you to share the CPP Code that you are using, and also a template of the Simulink model that you are using in order to reproduce the issue.
Thanks and Regards,
Ganesh S

Connectez-vous pour commenter.

Réponses (1)

Abhas
Abhas le 31 Déc 2024
The error you're encountering indicates that the shared library "libutils.so" requires a version of the GNU Standard C++ Library ("libstdc++") that provides "GLIBCXX_3.4.29". This version is not present in the "libstdc++" bundled with your MATLAB installation, leading to the error.
MATLAB includes its own version of "libstdc++" located in "${MATLAB_ROOT}/sys/os/glnxa64/". If this version is outdated compared to the one used to compile your shared library, version mismatches like the one you're experiencing can occur.
You may refer to following guide step by step to solve the above issue: https://gist.github.com/Han-ga86caq/cb8ad2666f8513db6d435b0ed3164170
I hope this helps!

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by