Solve problem for /usr/bin/ld: cannot find -lgfortran

gcc -std=gnu99 -shared -o vegan.so cepin.o data2hill.o decorana.o goffactor.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: ld returned 1 exit status
make: *** [vegan.so] Error 1

After installing libgfortran3, you should rename libgfortran.so.3 to libgfortran.so

mv /usr/lib/libgfortran.so.3 /usr/lib/libgfortran.so

在linux环境编译应用程式或lib的source code时常常会出现如下的错误讯息:

  • /usr/bin/ld: cannot find -lxxx

这些讯息会随着编译不同类型的source code 而有不同的结果出来如:

  • /usr/bin/ld: cannot find -lc
  • /usr/bin/ld: cannot find -lltdl
  • /usr/bin/ld: cannot find -lXtst

其中xxx即表示函式库文件名称,如上例的:libc.so、libltdl.so、libXtst.so。

 

1 comment to Solve problem for /usr/bin/ld: cannot find -lgfortran

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>