bmsherman/haskell-matlab

Missing C libraries: mx, mat, eng

Closed this issue · 4 comments

I am using MATLAB 2011b and tried to install by including the extra lib and include folders, but cabal still complains about "Missing C libraries: mx, mat, eng". I have used the command

cabal install --extra-lib-dirs="/usr/local/MATLAB/R2011b/bin/glnxa64/" --extra-include-dirs="/usr/local/MATLAB/R2011b/extern/include/"

Any help would be greatly appreciated. Thanks.

Do the following files exist on your file system?

/usr/local/MATLAB/R2011b/bin/glnxa64/libmx.so
/usr/local/MATLAB/R2011b/bin/glnxa64/libmat.so
/usr/local/MATLAB/R2011b/bin/glnxa64/libeng.so
/usr/local/MATLAB/R2011b/extern/include/matrix.h

What versions of Cabal and GHC are you using? What operating system are you using?

All these files are on my file system. I am using Cabal 1.20.0.2 and GHC 7.6.3. On this system, I was able to compile a Haskell program calling into the demo program matcreat.c (provided by MathWorks) with no problem using the following command:

ghc --make -main-is Main Main.hs matcreat.c -I/usr/local/MATLAB/R2011b/extern/include -L/usr/local/MATLAB/R2011b/bin/glnxa64 -optl-Wl,-rpath,/usr/local/MATLAB/R2011b/bin/glnxa64 -lmat -lmx

It seems like you're doing everything correctly. I can't figure out what the issue might be. For reference, I am able to use the package successfully with MATLAB R2014a, GHC 7.8.3, and cabal-install 1.20.0.3 on Ubuntu 14.10. All I can venture to say is that your issue is probably not specific to this package. Sorry!

A couple of problems could cause this. A dependency of one of these libraries may be missing. This could be checked e.g. by:
$ ldd /opt/MATLAB/R2017a/bin/glnxa64/libmx.so

In my case, libpam was missing ("not found").

Another issue is that e.g. " /opt/MATLAB/R2017a/bin/glnxa64/" may need to be added to LD_LIBRARY_PATH.