zoukankan      html  css  js  c++  java
  • 【buildroot-2011.11】You may have to install 'g++' on your build machine

    buildroot - 2011.11 当进行交叉编译。例如像以下错误提及演示:

    “You may have to install 'g++' on your build machine”

    还提示:toolchain/dependencies/dependencies.sh 121 Error


    打开toolchain/dependencies/dependencies.sh,有例如以下一段脚本

    # check for host CXX
    CXXCOMPILER=$(which $HOSTCXX 2> /dev/null)
    if [ -z "$CXXCOMPILER" ] ; then
        CXXCOMPILER=$(which c++ 2> /dev/null)
    fi
    if [ -z "$CXXCOMPILER" ] ; then
        /bin/echo -e "
    You may have to install 'g++' on your build machine
    "
        #exit 1
    fi
    if [ ! -z "$CXXCOMPILER" ] ; then
        CXXCOMPILER_VERSION=$($CXXCOMPILER -v 2>&1 | sed -n '/^gcc version/p' |
            sed -e 's/^gcc version ([0-9.])/1/g' -e 's/[- ].*//g' -e '1q')
        
        if [ -z "$CXXCOMPILER_VERSION" ] ; then
            /bin/echo -e "
    You may have to install 'g++' on your build machine
    "
        fi
    
        CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/..*//g")
        CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/^$CXXCOMPILER_MAJOR.//g" -e "s/..*//g")
        if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then
            /bin/echo -e "
    You have g++ '$CXXCOMPILER_VERSION' installed.  g++ >= 2.95 is required
    "
            exit 1
        fi
    fi
    有两个地方会打印“You may have to install 'g++' on your build machine”,在这两个地方分别增加调试标记,发现是这里出问题了。

    # check for host CXX
    CXXCOMPILER=$(which $HOSTCXX 2> /dev/null)
    if [ -z "$CXXCOMPILER" ] ; then
        CXXCOMPILER=$(which c++ 2> /dev/null)
    fi
    if [ -z "$CXXCOMPILER" ] ; then
        /bin/echo -e " You may have to install 'g++' on your build machine "
        #exit 1
    fi
    if [ ! -z "$CXXCOMPILER" ] ; then
        CXXCOMPILER_VERSION=$($CXXCOMPILER -v 2>&1 | sed -n '/^gcc version/p' |
            sed -e 's/^gcc version ([0-9.])/1/g' -e 's/[- ].*//g' -e '1q')
        
        if [ -z "$CXXCOMPILER_VERSION" ] ; then
            /bin/echo -e " You may have to install 'g++' on your build machine "
        fi



        CXXCOMPILER_MAJOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/..*//g")
        CXXCOMPILER_MINOR=$(echo $CXXCOMPILER_VERSION | sed -e "s/^$CXXCOMPILER_MAJOR.//g" -e "s/..*//g")
        if [ $CXXCOMPILER_MAJOR -lt 3 -o $CXXCOMPILER_MAJOR -eq 2 -a $CXXCOMPILER_MINOR -lt 95 ] ; then
            /bin/echo -e " You have g++ '$CXXCOMPILER_VERSION' installed.  g++ >= 2.95 is required "
            exit 1
        fi
    fi

    原来他没有检查出来,CXXCOMPILER_VERSION为空。方便起见,我直接输入命令:

    c++ -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version ([0-9.])/1/g' -e 's/[- ].*//g' -e '1q'

    得到C++的版本号为:4.4.6

    我直接在CXXCOMPILER_VERSION上面加一个推理:CXXCOMPILER_VERSION=4.4.6
    然后make,直接通过。


    OK,问题解决为此。

  • 相关阅读:
    error:undefined reference to 'net_message_processor::net_message_processor()'
    android 网络检测
    eclipse 安装 ndk 组件
    eclipse下编译cocos2dx 3.0
    Cocos2dx3.0 TextField 输入中文的问题
    记录与骗子进行的一次交锋. 与技术无关
    关于继承的设计
    kubernetes1.5.2--部署dashboard服务
    kubernetes1.5.2--部署DNS服务
    kubernetes1.5.2集群部署过程--安全模式
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/5028638.html
Copyright © 2011-2022 走看看