ubuntu安装gcc不同的版本

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

ubuntu安装gcc不同的版本

clear_love8   2019-11-14 我要评论

服务器ubuntu14.04安装ns3.29中,显示gcc版本过低
使用apt-get安装失败,ubuntu14.04默认安装gcc4.8.4,无法下载更高级的gcc版本

先找到资料1,脚本尝试了,下载不了gcc-6
再尝试源码安装gcc,找到资料2,手动安装gcc的依赖包和gcc,发现其中的mpfr包的博客中的版本下载不到,新版本尝试下,对之后的步骤有影响导致最后一个依赖包下载失败,不过这个博客中有gcc各种版本的下载源比较有用,在此贴出:下载源1(使用过),下载源2
最后找到一个博客,里面有个脚本直接下载编译所需要的依赖项,尝试并成功,资料3
编译完成后,出现:

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib/../lib64

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.

这是告诉你接下来要怎么用。简单的办法是在 /etc/ld.so.conf.d 下新建一个文件 local.conf,里边写上 /usr/local/lib。然后以 root 权限执行 ldconfig。这样你的系统才会找得到安装到 /usr/local/lib 下的库文件。
一般Linux系统缺省不会去/usr/local/lib找库文件。所以才有上面的警告。除了把该路径加入ldconfig之外,另外一个办法是用

./configure --prefix=/usr

来指定安装到缺省路径。(有个风险:别覆盖了系统原有的东西)
参考网页

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们