这篇文章主要为大家展示了“Suse如何安装gcc”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Suse如何安装gcc”这篇文章吧。
获得程序
cpp-3.3.3-43.24.i586.rpm
glibc-devel-2.3.3-98.28.i586.rpm
gcc-3.3.3-43.24.i586.rpm
根据安装过程中所缺的包,进行补充。
准备安装GCC
# rpm -ivh gcc-3.3.3-43.24.i586.rpm
error: Failed dependencies:
glibc-devel is needed by gcc-3.3.3-43.24
cpp = 3.3.3-43.24 is needed by gcc-3.3.3-43.24
安装GCC必须软件
1)安装glibc-devel
#rpm -ivh glibc-devel-2.3.3-98.28.i586.rpm
Preparing... ########################################### [100%]
1:glibc-devel ########################################### [100%]
2)安装cpp
#rpm -ivh cpp-3.3.3-43.24.i586.rpm
Preparing... ########################################### [100%]
package cpp-3.3.3-43.41 (which is newer than cpp-3.3.3-43.24) is already installed
file /usr/bin/cpp from install of cpp-3.3.3-43.24 conflicts with file from package cpp-3.3.3-43.41
file /usr/lib/gcc-lib/i586-suse-linux/3.3.3/cc1 from install of cpp-3.3.3-43.24 conflicts with file from package cpp-3.3.3-43.41
file /usr/share/man/man1/cpp.1.gz from install of cpp-3.3.3-43.24 conflicts with file from package cpp-3.3.3-43.41
可以发现系统遭已安装了cpp,只是版本冲突。
3)执行gcc安装
# rpm -ivh gcc-3.3.3-43.24.i586.rpm
error: Failed dependencies:
cpp = 3.3.3-43.24 is needed by gcc-3.3.3-43.24
发现系统还是识别不了cpp
4)强制安装版本cpp-3.3.3-43.24
# rpm -ivh cpp-3.3.3-43.24.i586.rpm --nodeps --force
Preparing... ########################################### [100%]
1:cpp ########################################### [100%]
5)再次安装gcc
# rpm -ivh gcc-3.3.3-43.24.i586.rpm
Preparing... ########################################### [100%]
1:gcc ########################################### [100%]
6)测试gcc
# which gcc
/usr/bin/gcc
#vi test.c
test.c内容如下:
#include <stdio.h>
main()
{
printf("\nGCC is OK!\n\n");
}
编译test.c
# gcc -O test.c -o test
生成可执行文件test(通过ls命令可以看到) 运行 test
#./test
屏幕输出
GCC is OK!
说明GCC程序编译正确。
7)加入相应的环境变量PATH,LD_LIBRARY_PATH即可。
这样就完成了Suse安装gcc的步骤。
以上是“Suse如何安装gcc”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注编程网行业资讯频道!