加载共享库时出错:libgfortran.so.1:无法打开共享对象文件:没有这样的文件或目录(error while loading shared libraries: libgfortran.so.1: cannot open shared object file: No such file or directory)

我的任务是将程序放到docker环境中,我使用的是ubuntu容器。 该程序由Fortran编写。 当我运行该程序时,我得到了这个错误

./cscheck.out: error while loading shared libraries: libgfortran.so.1: cannot open shared object file: No such file or directory

我几乎读了所有的搜索页面。 我已经尝试过命令ldconfig -v ,但它不起作用。 而且我知道这个错误是因为错过了libgfortran.so.1,但是在ubuntu软件包搜索页面中,libgfortran的最低版本是3.所以我找不到版本1。

你能否给我线索,我需要继续努力。

My task is to put the program to docker environment, I use ubuntu container. and the program is written by fortran. When I run the program, I got this error
./cscheck.out: error while loading shared libraries: libgfortran.so.1: cannot open shared object file: No such file or directory
I have almost read all the search pages. I have tried the command ldconfig -v, but it doesn't work. And I learned that this error is because the missed libgfortran.so.1 , but in ubuntu package search page, the lowest version of libgfortran is 3. So I can't find the version 1.
Can you give me clue, I need to keep trying.


最满意答案

你从哪里得到这个节目? 如果您有源代码,或者您需要查找旧的libgfortran,请使用当前的gfortran重新构建它。 它将在GCC的旧版本中发布。 尝试安装GCC 4.1或类似的。 这样的旧版本不会出现在当前版本库中,您必须手动安装它。

Where did you get this program? Rebuild it with the current gfortran if you have the source or you need to find the old libgfortran. It will be in an old release of GCC. Try to install GCC 4.1 or similar. Such an old version will not be present in current repositories, you must install it manually.

2018-03-08


如果要在群集上发送批处理作业,请添加如下命令 echo $LD_LIBRARY_PATH

ldd ./your_app

到您的批处理脚本。 这应该有助于调试问题。 还要确保在mpirun中导出环境变量。 例如,在OpenMPI中,您将运行您的代码 mpirun -x LD_LIBRARY_PATH

...
If you are sending a batch job on a cluster, please add commands like echo $LD_LIBRARY_PATH
...

在crontab中的命令之前添加了.bash_profile。

# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0
...

我遇到了这个问题,因为我的共享库依赖于另一个不正常工作的共享库。 I got this problem because my shared libraries depends on another shared library which works improperly.