I try to use mex some toolbox using matlab. But I got these errors: /usr/bin/ld: cannot find -lgfortran

I used Ubuntu 14.04. I installed gfortran. Could any one help ?

this is the output of : ldconfig -p | grep fortran

xiaoma@laptop:~$ ldconfig -p | grep fortran
    libhdf5hl_fortran.so.7 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libhdf5hl_fortran.so.7
    libhdf5_fortran.so.7 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libhdf5_fortran.so.7
    libgfortran.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgfortran.so.3

Possible solution:

  1. Link libgfortran.so.3 to libgfortran.so

    ln -s libgfortran.so.3 libgfortran.so
  2. Rebuild ld cache

    sudo ldconfig
  3. Reinstall the lib

Check out https://stackoverflow.com/questions/16710047/usr-bin-ld-cannot-find-lnameofthelibrary for more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.