Android7.1代码编译错误

拿到RK3288平台7.1的代码,平台本来是用repo进行管理的。我们将代码改用git去管理,在删除了repo相关的管理文件之后在进行编译时出现了错误,如下:[ 44% 7552/17136] build out/target/product/hikari/gen/EXECUTABLES/iw_intermediates/version.c
FAILED: /bin/bash -c "external/iw/version.sh out/target/product/hikari/gen/EXECUTABLES/iw_intermediates/version.c"
fatal: No names found, cannot describe anything.
ninja: build stopped: subcommand failed.
build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

#### make failed to build some targets (01:39:34 (hh:mm:ss)) ####

后来在stackoverflow中找到了参考答案:地址:https://stackoverflow.com/questions/41343267/aosp-build-error-executables-iw-intermediates-version-c里面提供里两个方法:1.You can comment out everything except v="$VERSION" and the last two echo lines.But this is a temporary fix.(你可以注释掉所有的内容,但是这个只是暂时性的措施)2.Another way to solve this is by doing a repo sync before you execute make. I fixed it by simply doing a repo sync and that updated and fixed everything for me.(还有一个方法就是,在你执行make前执行repo sync操作)

网上大部分的做法,其实就是让这个脚本失效,和stackoverflow中的方法1差不多:
#!/bin/sh

VERSION="4.1"
OUT="$1"

#if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then
if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null` && [$VERSION != "4.1"]; then
        git update-index --refresh --unmerged > /dev/null
        descr=$(git describe --match=v*)

        # on git builds check that the version number above
        # is correct...
        [ "${descr%%-*}" = "v$VERSION" ] || exit 2

        v="${descr#v}"
        if git diff-index --name-only HEAD | read dummy ; then
                v="$v"-dirty
        fi
else
        v="$VERSION"
fi

echo '#include "iw.h"' > "$OUT"
echo "const char iw_version[] = \"$v\";" >> "$OUT"






  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值