Makefile错误:commands commence before first target.

本文分析了Makefile中常见的错误原因,包括命令行未以正确的[Tab]字符开始及规则定义不完整等问题,并提供了相应的解决方法。

关于这个错误,网上的分析如下:

 

1)Makefile可能是以命令行开始:以[Tab]字符开始,但不是一个合法的命令行(例如,一个变量的赋值)。命令行必须和规则一一对应。

 

2)产生第二种的错误的原因可能是一行的第一个非空字符为分号,make会认为此处遗漏了规则的“target: prerequisite”部分。

 

 

检查了一下,发现果然是命令的开头没有加[tab]字符。

 

 

GCC="aarch64-openwrt-linux-musl-gcc" CXX="aarch64-openwrt-linux-musl-g++" RANLIB="aarch64-openwrt-linux-musl-gcc-ranlib" STRIP=aarch64-openwrt-linux-musl-strip OBJCOPY=aarch64-openwrt-linux-musl-objcopy OBJDUMP=aarch64-openwrt-linux-musl-objdump SIZE=aarch64-openwrt-linux-musl-size CROSS="aarch64-openwrt-linux-musl-" ARCH="aarch64" TARGET_CFLAGS="-Os -pipe -march=armv8-a -mcpu=cortex-a73+crypto -fno-caller-saves -fno-plt -Wa,--noexecstack -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/ge550v1/qca_95xx_12_2/build_dir/target-aarch64/u-boot-2022.01:u-boot-2022.01 -Wformat -Werror=format-security -fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro" TARGET_LDFLAGS="-L/ge550v1/qca_95xx_12_2/staging_dir/target-aarch64/usr/lib -L/ge550v1/qca_95xx_12_2/staging_dir/target-aarch64/lib -L/ge550v1/qca_95xx_12_2/staging_dir/toolchain-aarch64/usr/lib -L/ge550v1/qca_95xx_12_2/staging_dir/toolchain-aarch64/lib -fPIC -specs=/ge550v1/qca_95xx_12_2/include/hardened-ld-pie.specs -znow -zrelro" no-dot-config-targets=envtools envtools ; make[5]: Entering directory `/ge550v1/qca_95xx_12_2/build_dir/target-aarch64/u-boot-2022.01' Makefile:40: *** commands commence before first target. Stop. make[5]: Leaving directory `/ge550v1/qca_95xx_12_2/build_dir/target-aarch64/u-boot-2022.01' make[4]: *** [/ge550v1/qca_95xx_12_2/build_dir/target-aarch64/u-boot-2022.01/.built] Error 2 make[4]: Leaving directory `/ge550v1/qca_95xx_12_2/package/boot/uboot-envtools' time: package/boot/uboot-envtools/compile#0.14#0.05#0.18 make[3]: *** [package/boot/uboot-envtools/compile] Error 2 make[3]: Leaving directory `/ge550v1/qca_95xx_12_2' make[2]: *** [/ge550v1/qca_95xx_12_2/staging_dir/target-aarch64/stamp/.package_compile] Error 2 make[2]: Leaving directory `/ge550v1/qca_95xx_12_2' make[1]: *** [world] Error 2 make[1]: Leaving directory `/ge550v1/qca_95xx_12_2' make: *** [sdk] Error 2 huaxi@fd4bb9d5f3ca:/ge550v1/Iplatform/build$
最新发布
09-04
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值