我按照前面给出的程序安装了g77。但是,当我运行它后,出现错误,请您帮助别人解决这件事。
drjinasena@drjinasena-All-Series:~/minimum$ g77 sorting.f
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status谢谢
发布于 2017-02-01 11:48:34
这两个问题将在更详细的这里中描述。但总体解决方案是:
“找不到.”错误是一个关于在此之前的错误。找出crti.o在您的系统中的位置:
sudo find /usr/ -name "crti.o"
/usr/lib32/crti.o
/usr/lib/debug/usr/lib/x86_64-linux-gnu/crti.o
/usr/lib/x86_64-linux-gnu/crti.o
/usr/libx32/crti.o将带有"linux-gnu“的位置添加到环境变量LIBRARY_PATH中。为此,请编辑.bashrc文件,然后重新加载它。即:
gedit ~/.bashrc然后添加到末尾:
LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH
export LIBRARY_PATH(用系统的正确路径替换路径)。保存并退出文件,然后重新加载它:
source ~/.bashrc“无法找到-lgcc_s”表示ld找不到库(libgcc_s)。你可以帮助它,通过自己找到图书馆:
sudo find /usr/ -name libgcc_s.so它为我返回了几个版本,所以我选择了最新的版本(位于这里:'/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so'),然后检查ld期望库的位置:
ld -lgcc_s --verbose这会返回大量的文本,但是我们感兴趣的主要部分就在最后:
==================================================
attempt to open /usr/x86_64-linux-gnu/lib64/libgcc_s.so failed
attempt to open /usr/x86_64-linux-gnu/lib64/libgcc_s.a failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libgcc_s.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libgcc_s.a failed
attempt to open //usr/local/lib64/libgcc_s.so failed
attempt to open //usr/local/lib64/libgcc_s.a failed
attempt to open //lib/x86_64-linux-gnu/libgcc_s.so failed
attempt to open //lib/x86_64-linux-gnu/libgcc_s.a failed
attempt to open //lib64/libgcc_s.so failed
attempt to open //lib64/libgcc_s.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libgcc_s.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libgcc_s.a failed
attempt to open //usr/lib64/libgcc_s.so failed
attempt to open //usr/lib64/libgcc_s.a failed
attempt to open //usr/local/lib/libgcc_s.so failed
attempt to open //usr/local/lib/libgcc_s.a failed
attempt to open //lib/libgcc_s.so failed
attempt to open //lib/libgcc_s.a failed
attempt to open //usr/lib/libgcc_s.so failed
attempt to open //usr/lib/libgcc_s.a failed
ld: cannot find -lgcc_s[/text]如果我们从实际文件所在的位置创建一个符号链接到这些位置之一,那么我们就都完成了:
sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so /usr/lib/x86_64-linux-gnu/https://askubuntu.com/questions/815641
复制相似问题