Set LD_LIBRARY_PATH correctly

You have a couple of options:

  1. Prefix the path to your shared libraries in the export statement above (more than likely $LD_LIBRARY_PATH is not set on your system and so the only paths that are getting set are the ones explicitly set in your export statement.)

     export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/:/usr/lib/:/usr/lib64/:/usr/local/MATLAB/MATLAB_Runtime/v94/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v94/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v94/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v94/extern/bin/glnxa64
    

    This export statement will not be a permanent part of your shell sessions unless you add it to .bashrc fyi.

  2. Add the MATLAB library path to /etc/ld.so.conf.d/ and run ldconfig to identify the new paths for the linker on your system.

    (BTW I am guessing at the MATLAB library name. You might need to make the name of the file something other than MATLAB like all lower case or something else. Basically we need the name of the library as it is referenced during the linking process. You could inspect a make file to see how this is referenced.)

     # Add the file '/etc/ld.so.conf.d/MATLAB' with the following lines 
     /usr/local/MATLAB/MATLAB_Runtime/v94/runtime/glnxa64
     /usr/local/MATLAB/MATLAB_Runtime/v94/bin/glnxa64
     /usr/local/MATLAB/MATLAB_Runtime/v94/sys/os/glnxa64
     /usr/local/MATLAB/MATLAB_Runtime/v94/extern/bin/glnxa64
    

    Then run ldconfig.

     sudo ldconfig
    

    You may need to unset the $LD_LIBRARY_PATH variable to make the linker use the normal system search path and pickup the new search path for MATLAB.

     unset LD_LIBRARY_PATH