dyn.load("path/file_name.so") 中的错误:无法加载共享对象

Error in dyn.load("path/file_name.so") : unable to load shared object

我有几个要在 R 中使用的已编译 Fortran 子例程。当我尝试调用这个特定的子例程时,它会产生以下错误:

Error in dyn.load("path/file_name.so") : 
  unable to load shared object '/complete_path/file_name.so':
  libgfortran.so.4: cannot open shared object file: No such file or directory

其他子程序虽然完美加载,这里是子程序:

subroutine box_center(m,n,o,a,b,ps,box,filter)
    implicit none
    integer, intent(in) :: m,n,o
    integer :: x,y,t,mone,none,a,b
    double precision, intent(inout) :: ps(m,n,o),box(a,b)
    double precision, intent(out) :: filter(m,n,o)

    mone=m - 3
    none=n - 3
    do 20,t=1,time 
      do 10, x=4,mone
       do 5, y=4,none
        box = reshape((/ps(x-3,y-3,t)  ,ps(x-3,y-2,t),ps(x-3,y-1,t) &
                        , ps(x-3,y,t)  ,ps(x-3,y+1,t),ps(x-3,y+2,t) &
                , ps(x-3,y+3,t) & 
                                , ps(x-2,y-3,t),ps(x-2,y-2,t),ps(x-2,y-1,t) &
                        , ps(x-2,y,t)  ,ps(x-2,y+1,t),ps(x-2,y+2,t) &
                , ps(x-2,y+3,t) & 
                                , ps(x-1,y-3,t),ps(x-1,y-2,t),ps(x-1,y-1,t) &
                        , ps(x-1,y,t)  ,ps(x-1,y+1,t),ps(x-1,y+2,t) &
                , ps(x-1,y+3,t) & 
                    , ps(x,y-3,t),ps(x,y-2,t),ps(x,y-1,t) &
                        , ps(x,y,t)  ,ps(x,y+1,t),ps(x,y+2,t) &
                , ps(x,y+3,t) & 
                                , ps(x+1,y-3,t),ps(x+1,y-2,t),ps(x+1,y-1,t) &
                        , ps(x+1,y,t)  ,ps(x+1,y+1,t),ps(x+1,y+2,t) &
                , ps(x+1,y+3,t) & 
                                , ps(x+2,y-3,t),ps(x+2,y-2,t),ps(x+2,y-1,t) &
                        , ps(x+2,y,t)  ,ps(x+2,y+1,t),ps(x+2,y+2,t) &
                , ps(x+2,y+3,t) & 
                                , ps(x+3,y-3,t),ps(x+3,y-2,t),ps(x+3,y-1,t) &
                        , ps(x+3,y,t)  ,ps(x+3,y+1,t),ps(x+3,y+2,t) &
                , ps(x+3,y+3,t)/), (/a,b/))


           if(minval(box) .EQ. box(4,4)) then                       
                filter(x,y,t) = 1.00
              else
                filter(x,y,t) = 0.00
             end if 


5          end do 
10         end do   
20  end do  
    end subroutine box_center

所有的子程序都是用同样的程序编译的:

gfortran -c -ffree-form file_name.f 
R CMD SHLIB file_name.f

还有一点要提:当我使用我的本地机器时,这个特定的子例程加载正常,它在 HPC 上产生错误。

也许像我这样的初学者会觉得它有用而不是删除问题。

在远程机器上编译 Fortran 子程序是本地机器上没有的解决方案。