zoukankan      html  css  js  c++  java
  • suse 下的gcc安装

    在付出了一天的努力之后终于在win7系统上面硬盘安装suse操作系统成功,可是随之而来的问题居然是没有安装GCC,这对我来说是一个不小的打击,因为很多工作和工具安装需要通过GCC来编译,因此我只好求助于百度,搜索了各种攻略,现在把我安装成功的经验分享一下。

    因为suse里面本身没有cc的编译工具,所以使用

    gcc-4.4.2.tar.bz2这种方式安装的报告失败,报告的问题如下:

    checking whether ln works... yes
    checking whether ln -s works... yes
    checking for gcc... no
    checking for cc... no
    checking for cc... no
    checking for cl... no
    configure: error: in `/home/lyl2002/gcc-4.4.2':
    configure: error: no acceptable C compiler found in $PATH

    然后在一个论坛里面建议用rpm的包去安装,现在找到rpm的地址:

    http://213.174.32.130/sles/distribution/9.0/suse/i586/

    首先下载cpp-3.3.3-43.24.i586.rpm

    尝试安装一下:

    # 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.2

    看log是需要安装上面的两个依赖,从上面给的地址中download下来

    之后安装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(" GCC is OK! ");

    编译test.c
    # gcc -O test.c -o test
    生成可执行文件test(通过ls命令可以看到) 运行 test
    #./test
    屏幕输出
    GCC is OK!
    说明GCC程序编译正确。

    7)加入相应的环境变量PATH,LD_LIBRARY_PATH即可。

    这样就完成了Suse安装gcc的步骤。

  • 相关阅读:
    如何用阿里云ECS搭建网站
    win10下使用pipreqs提示不是内部或外部命令
    python使用openpyxl获取合并单元格的值
    Chrome的一些常用小tips
    Ubantu部署
    分不清ERP、SAP、MES?干货整理看这里
    ApacheCN 数据科学译文集 20210313 更新
    ApacheCN 计算机视觉译文集 20210218 更新
    ApacheCN 计算机视觉译文集 20210212 更新
    ApacheCN 计算机视觉译文集 20210203 更新
  • 原文地址:https://www.cnblogs.com/bob62/p/3551739.html
Copyright © 2011-2022 走看看