解决:MATLAB_Compiler_Runtime libgfortran.so.3: version `GFORTRAN_1.4' not found

今天运行程序时出现一个小错误:

/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/liblapack.so.3gf)

错误原因:大概是因为我的程序中用到了liblapack,而liblapack又用到了libgfortran,但是MATLAB_Compiler_Runtime中带来的这个版本的libgfortran版本不是所需的版本,所以就出现了上述错误。以前没看到这个错误,最近新装了MATLAB_Compiler_Runtime,覆盖了原来可用的版本估计。解决方法很简单,顺便记录在此。


看到这个错误第一反映是搜了一下系统里有没有这个:

$ locate GFORTRAN_1.4
$ locate GFORTRAN
都没搜到!

$ GFORTRAN --version
GFORTRAN: command not found

$ gfortran --version
The program 'gfortran' is currently not installed.  You can install it by typing:
sudo apt-get install gfortran
还是什么也没搜到。差一点就按提示安装一下了。三思而后行的习惯告诉我应该先Google一下。于是没有做任何安装,保持系统原样。进行如下一些操作就可以了(库名是小写而已,之前搜错名字了):
$ locate libgfortran
/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64/libgfortran.so.3
/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64/libgfortran.so.3.0.0
/opt/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3
/opt/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3.0.0
/usr/lib/x86_64-linux-gnu/libgfortran.so.3
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
/usr/share/doc/libgfortran3
/var/cache/apt/archives/libgfortran3_4.9.2-0ubuntu1~12.04_amd64.deb
/var/lib/dpkg/info/libgfortran3:amd64.list
/var/lib/dpkg/info/libgfortran3:amd64.md5sums
/var/lib/dpkg/info/libgfortran3:amd64.postinst
/var/lib/dpkg/info/libgfortran3:amd64.postrm
/var/lib/dpkg/info/libgfortran3:amd64.shlibs
/var/lib/dpkg/info/libgfortran3:amd64.symbols

$ locate libgfortran.so
/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64/libgfortran.so.3
/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64/libgfortran.so.3.0.0
/opt/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3
/opt/MATLAB/R2012a/sys/os/glnxa64/libgfortran.so.3.0.0
/usr/lib/x86_64-linux-gnu/libgfortran.so.3
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0

只需要做个symbolic link就可以了。选用/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0版本。
$ ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 /opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64/libgfortran.so.3
ln: failed to create symbolic link `/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64/libgfortran.so.3': File exists
$ ln -sf /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 /opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64/libgfortran.so.3

参考:

http://stackoverflow.com/questions/9628273/libgfortran-version-gfortran-1-4-not-found

http://stackoverflow.com/questions/9628273/libgfortran-version-gfortran-1-4-not-found

http://ubuntuforums.org/showthread.php?t=1901733&page=2&s=3d1af04ecad639a1c3f7696dadb83d0e

你可能感兴趣的:(matlab)