Is there a list of MATLAB Runtime dependencies?

22 次查看(过去 30 天)
Greetings,
I was deploying the MATLAB Runtime (aka MCR) to a headless Redhat Enterprise Linux (RHEL) 7.4 environment when I noticed that I was missing several dependencies.
I installed MCR version R2017b (9.3) with this command (which succeeded, see install.txt):
./install -mode silent -agreeToLicense yes
I then set / verified the LD_LIBRARY_PATH environment variable:
$ echo $LD_LIBRARY_PATH
:/usr/local/MATLAB/MATLAB_Runtime/v93/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v93/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v93/sys/os/glnxa64:
Finally, I tested the Shared Object files included in the installation to verify they have available all the libraries they need:
find /usr/local/MATLAB -type f -name '*.so*' -exec ldd {} \; | grep 'not found' | sort | uniq
This resulted in the libraries listed in the attached notFound.txt. While I can easily determine which packages provide these libraries with Yellowdog Updater, Modified (yum) and install them, was wondering (especially for future deployments of future versions) if there exists a list of packages for supported Linux distributions that need to be deployed alongside the MCR. I checked the MCR Documentation and didn't see a list of said libraries.
Thanks

采纳的回答

Mikhail
Mikhail 2017-9-24
Unfortunately, there seems to be no such list of libraries required to run MCR (not to mention MATLAB itself). In fact, i've seen cases where even "officially supported" Linux distros were lacking libraries required for a particular functionality of MATLAB or Simulink. The list of required libraries also changes from version to version.
You are on the right track of inspecting MCR's libraries by your own.
I would recommend using "readelf -d" to list only direct dependencies of a shared library (unlike ldd listing dependencies recursively). This should be faster and more secure than using ldd.
  1 个评论
Nicholas Haas
Nicholas Haas 2017-9-24
编辑:Nicholas Haas 2017-9-24
Thanks, it is as I suspected then, the exact packages required are not documented. Good tip on using readelf. I've updated my dependency check scripts (this time in a headless centos 7.4 x86-64 Docker image with unzip, wget, and mlocate installed) based on your advice, should anyone run into this same problem during MCR deployment, hope they find the following useful.
MCR R2017b's apparent (based on inspection of the bundled libraries with readelf) 'free' dependencies (free as defined as what the maintainers of CentOS felt free open source and/or relevant enough to include in their default repositories) can be resolved with the following command:
yum install libX11 libXcomposite libXcursor libXdamage libXext libXfixes libXft libXi libXrandr libXrender libXScrnSaver libXt libXtst libXxf86vm alsa-lib atk cairo cups-libs fontconfig GConf2 gtk2 gdk-pixbuf2 gnome-vfs2 gstreamer1-plugins-base gstreamer1 pango libsndfile libxcb libxslt
However, this leaves a number of dependencies left unsatisfied (see attached stillMissing.txt). I suspect that a number of these can be found in EPEL or other third-party repositories. If one is so inclined to use said repositories, see the yum provides step below on how to resolve them once YUM is aware of their contents.
New MCR Dependency Resolution Steps (likely cleaner / easier / better ways than this):
1. Find all SO dependencies of the MCR:
find /usr/local/MATLAB -type f -name '*.so*' -exec readelf -d {} \; | sed -n 's/.*Shared library:\ \[\(.*\)\].*/\1/p' | sort | uniq > depends.txt
2. Find all SO dependencies bundled with the MCR:
find /usr/local/MATLAB -type f -name '*.so*' -printf "%f\n" | sort | uniq > bundled.txt
3. Show only ones that aren't bundled:
diff bundled.txt depends.txt | grep '> ' | cut -c3- > notBundled.txt
4. Find non-bundled SOs that the system is aware of:
updatedb
cat notBundled.txt | xargs -n 1 locate -l 1 | xargs -n1 basename > onSystem.txt
5. Find which SOs need to be deployed:
diff onSystem.txt notBundled.txt | grep '> ' | cut -c3- > needInstall.txt
6. Find which packages provide said libraries:
cat needInstall.txt | xargs -n 1 yum provides > yumProvides.txt

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2017-9-23
You can run the dependency report on your code. Or if you have a compiled version of your code, run DependencyWalker (Google it).

Community Treasure Hunt

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

Start Hunting!

Translated by