常见编译报错汇总
关键字:
error:
make[
FAILED:
multiple definition
1. 摄像头兼容个数超过16个 - 增大为18个
alps\kernel-3.18\drivers\misc\mediatek\imgsensor\src\mt6735m\kd_sensorlist.h
#define MAX_NUM_OF_SUPPORT_SENSOR 16
ACDK_KD_SENSOR_INIT_FUNCTION_STRUCT kdSensorList[MAX_NUM_OF_SUPPORT_SENSOR]=
{
...
}
报错log:
excess elements in array initializer(给数组塞了超过初始化个数的元素)
In file included from alps/kernel-3.18/drivers/misc/mediatek/imgsensor/src/mt6735m/kd_sensorlist.c:39:0:
alps/kernel-3.18/drivers/misc/mediatek/imgsensor/src/mt6735m/kd_sensorlist.h:677:5: error: excess elements in array initializer [-Werror]
{T4KA3_SENSOR_ID, SENSOR_DRVNAME_T4KA3_MIPI_RAW, T4KA3_MIPI_RAW_SensorInit},
^
2. 安卓5.1 新增驱动需要在alps\kernel-3.10\drivers\misc\mediatek\Kconfig.drivers中建宏
3. makefile从安卓6.0移植到安卓5.1,需要修改
参照同一目录其他Makefile修改
4. 缺少头文件包含 - (安卓5.1)
fae提供的代码qma6981.c, 没有包含包含头文件accel.h, 导致编译移植报结构体struct sensor_init_info定义不一致
+ #include <accel.h>
报错log:
alps/kernel-3.10/drivers/misc/mediatek/accelerometer/qma6981/qma6981.c: In function 'qma6981_init':
alps/kernel-3.10/drivers/misc/mediatek/accelerometer/qma6981/qma6981.c:2091:2: error: implicit declaration of function 'acc_driver_add' [-Werror=implicit-function-declaration]
acc_driver_add(&qma6981_init_info);
^
5. 报错信息为转义字符 - 服务器加密问题 - 重启编译服务器
报错log:
Line 2780: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:1: error: stray '\24' in program
Line 2784: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:3: error: stray '#' in program
Line 2787: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:1: error: unknown type name 'b'
Line 2790: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:6: error: null character(s) ignored [-Werror]
Line 2793: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:1: error: stray '\272' in program
Line 2796: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:1: error: stray '\1' in program
Line 2816: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:13: error: stray '\210' in program
Line 2817: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:13: error: stray '\207' in program
Line 2818: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:13: error: stray '\22' in program
Line 2819: ./build/core/combo/include/arch/linux-arm/AndroidConfig.h:1:13: error: stray '\320' in program
6. 两个.c文件中重复定义 - 修改其中一个名字
报错log:
alps/kernel/mediatek/custom/out/kernel/accelerometer/mxc622x.c:1319: multiple definition of `gsensor_operate'
mediatek/custom/out/kernel/accelerometer/mxc400x.o:alps/kernel/mediatek/custom/out/kernel/accelerometer/mxc400x.c:1845: first defined here
make[4]: *** [mediatek/custom/out/kernel/built-in.o] Error 1
7. 编译服务器空间不足 - [No space left on device] - 清除服务器多余存储
例1:
cp: writing `out/target/product/magc6580_we_t_n/obj/EXECUTABLES/e2fsck_intermediates/quota.P': No space left on device
cp: failed to extend `out/target/product/magc6580_we_t_n/obj/EXECUTABLES/e2fsck_intermediates/quota.P': No space left on device
sed: couldn't write 47 items to stdout: No space left on device
[ 53% 19897/36901] Export includes file: -- out/target/product/magc6580_we_t_n/obj/EXECUTABLES/e2fsck_intermediates/export_includes
[ 53% 19898/36901] target SharedLib: libart (out/target/product/magc6580_we_t_n/obj/SHARED_LIBRARIES/libart_intermediates/LINKED/libart.so)
FAILED: /bin/bash -c "prebuilts/clang/host/linux-x86/clang-2690385/bin/clang++ -nostdlib -Wl,-soname,libart.so -Wl,--gc-sections -shared -Lout/target/product/magc6580_we_t_n/obj/lib
out/target/product/magc6580_we_t_n/obj/lib/crtbegin_so.o
例2:
FAILED: /bin/bash -c "out/host/linux-x86/bin/acp -fp out/target/product/magc6737m_65_n/obj/lib/libart.so out/target/product/magc6737m_65_n/system/lib64/libart.so"
acp: failed writing 'out/target/product/magc6737m_65_n/system/lib64/libart.so': No space left on device
[ 63% 28774/45356] target C: racoon <= external/ipsec-tools/src/racoon/genlist.c
FAILED: /bin/bash -c "(PWD=/proc/self/cwd prebuilts/misc/linux-x86/ccache/ccache prebuilts/clang/host/linux-x86/clang-2690385/bin/clang
fatal error: error in backend: IO failure on output stream.
[ 63% 28774/45356] target SharedLib: libart-compiler (out/target/product/magc6737m_65_n/obj/SHARED_LIBRARIES/libart-compiler_intermediates/LINKED/libart-compiler.so)
FAILED: /bin/bash -c "prebuilts/clang/host/linux-x86/clang-2690385/bin/clang++ -nostdlib -Wl,-soname,libart-compiler.so -Wl,--gc-sections -shared -Lout/target/product/magc6737m_65_n/obj/lib
out/target/product/magc6737m_65_n/obj/lib/crtbegin_so.o
out/target/product/magc6737m_65_n/obj/SHARED_LIBRARIES/libart-compiler_intermediates/compiled_method.o
8. BoardConfig.mk分区不足
!!!默认的分区,及大小是写在alps/device/mediatek/build/build/tools/ptgen/MT6737M/partition_table_MT6737M.xls中
此中方式只能修改大小,不能重新划分分区
1. 修改alps/device/haocheng/hct6580_we_a_l/BoardConfig.mk 在最后添加:
BOARD_MTK_SYSTEM_SIZE_KB := 1835008 // 需要比文件夹略大: alps\out\target\product\hct6580_weg_a_l\system
BOARD_MTK_USERDATA_SIZE_KB := 786432 // 注意大小是16的倍数
2. rm –rf out\target\product\$PROJECT_NAME \obj\PTGEN // 【重要】里面有分区表,不删除不会生效!!!
3. source xxx; lunch xxx; make lk; // 【重要】重新生成 MT6580_Android_scatter.txt
4. 查看【system】分区大小是否成功改变
vi out/target/product/hct6580_weg_a_l/MT6580_Android_scatter.txt
partition_index: SYS19
partition_name: system // 关键字[system]
file_name: system.img
is_download: true
type: EXT4_IMG
linear_start_addr: 0xa800000
physical_start_addr: 0xa800000
- partition_size: 0x60000000 // 原本报错的时候
+ partition_size: 0x70000000 // 修改之后生成
region: EMMC_USER
storage: HW_STORAGE_EMMC
boundary_check: true
is_reserved: false
operation_type: UPDATE
reserve: 0x00
5. Make snod 或 make systemimage
log:
Target system fs image: out/target/product/hct6580_weg_a_l/obj/PACKAGING/systemimage_intermediates/system.img
error: ext4_allocate_best_fit_partial: failed to allocate 3060 blocks, out of space?
error: failed to build out/target/product/hct6580_weg_a_l/obj/PACKAGING/systemimage_intermediates/system.img from out/target/product/hct6580_weg_a_l/system
Running: mkuserimg.sh -s out/target/product/hct6580_weg_a_l/system out/target/product/hct6580_weg_a_l/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 1610612736 out/target/product/hct6580_weg_a_l/root/file_contexts
Out of space? the tree size of out/target/product/hct6580_weg_a_l/system is (MB):
1511 out/target/product/hct6580_weg_a_l/system
The max is 1536 MB.
make: *** [out/target/product/hct6580_weg_a_l/obj/PACKAGING/systemimage_intermediates/system.img] Error 1
#### make failed to build some targets (01:03:06 (hh:mm:ss)) ####
9. android.mk
./vendor/mediatek/proprietary/hardware/sensor/Android.mk:59: *** commands commence before first target
在C/C++语言中,可以用\来换行,此时要注意,在一行的最后面加上\, 而这个\后面不能再有任何字符,哪怕是空格,也不允许,否则出错。
对于makefile,也有类似的原则,最近写makefile,一不小心,在\后多了个空格,结果编译出现:commands commence before first target
10. kernel-3.18\arch\arm64\configs\k37mv1_64_bsp_debug_defconfig、k37mv1_64_bsp_defconfig
- CONFIG_FRAME_WARN=1400
+ CONFIG_FRAME_WARN=1500
函数调用栈过深,内核配置的栈缓存不够用
报错log:
/home/android009/liuzhigou/code0_alps_o1_mp1_v662_R2_32_to_64_user/alps/kernel-3.18/drivers/misc/mediatek/imgsensor/src/mt6735m/kd_sensorlist.c: In function ‘CAMERA_HW_Ioctl’:
/home/android009/liuzhigou/code0_alps_o1_mp1_v662_R2_32_to_64_user/alps/kernel-3.18/drivers/misc/mediatek/imgsensor/src/mt6735m/kd_sensorlist.c:3643:1: error: the frame size of 1456 bytes is larger than 1400 bytes [-Werror=frame-larger-than=]
}
^
cc1: all warnings being treated as errors
make[6]: *** [drivers/misc/mediatek/imgsensor/src/mt6735m/kd_sensorlist.o] Error 1
make[5]: *** [drivers/misc/mediatek/imgsensor/src/mt6735m] Error 2
make[4]: *** [drivers/misc/mediatek/imgsensor/src] Error 2
make[4]: *** Waiting for unfinished jobs....
22. 编译报错分析
最新推荐文章于 2023-11-01 17:02:57 发布