平台
Android + RK3288 7.1 / RK3399 9.0
编译
1.下载源码
can-utils
2.解码到源码目录下
3.加载环境并执行mm
报错:
/rk3288/obj/EXECUTABLES/j1939cat_intermediates/j1939cat.P; sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\\\\$//' -e '/^\$/ d' -e 's/\$/ :/' < out/target/product/rk3288/obj/EXECUTABLES/j1939cat_intermediates/j1939cat.d >> out/target/product/rk3288/obj/EXECUTABLES/j1939cat_intermediates/j1939cat.P; rm -f out/target/product/rk3288/obj/EXECUTABLES/j1939cat_intermediates/j1939cat.d )" packages/anson/can-utils-master/j1939cat.c:255:62: error: use of undeclared identifier 'SCM_TIMESTAMPING_OPT_STATS'; did you mean 'SOF_TIMESTAMPING_OPT_STATS'? } else if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_TIMESTAMPING_OPT_STATS) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ SOF_TIMESTAMPING_OPT_STATS packages/anson/can-utils-master/include/linux/net_tstamp.h:30:2: note: 'SOF_TIMESTAMPING_OPT_STATS' declared here SOF_TIMESTAMPING_OPT_STATS = (1<<12), ^ 1 error generated. ninja: build stopped: subcommand failed. build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed make: *** [ninja_wrapper] Error 1 make: Leaving directory '/disk2/anson/rk3288_n712' #### make failed to build some targets (01:05 (mm:ss)) ####
没找到SCM_TIMESTAMPING_OPT_STATS的定义, google 了下, 将就用下:
#define SCM_TIMESTAMPING_OPT_STATS 54
以下新增3399 9.0部分编译错误及处理
packages/can-utils-master/can-calc-bit-timing.c:606:12: error: comparison of integers of different signs: 'int' and 'const __u32' (aka 'const unsigned int') [-Werror,-Wsign-compare] tseg1 < btc->tseg1_min || tseg1 > btc->tseg1_max || ~~~~~ ^ ~~~~~~~~~~~~~~ packages/can-utils-master/can-calc-bit-timing.c:606:38: error: comparison of integers of different signs: 'int' and 'const __u32' (aka 'const unsigned int') [-Werror,-Wsign-compare] tseg1 < btc->tseg1_min || tseg1 > btc->tseg1_max || ~~~~~ ^ ~~~~~~~~~~~~~~ 2 errors generated. [ 17% 34/196] target C: candump <= packages/can-utils-master/candump.c packages/can-utils-master/candump.c:170:25: warning: unused parameter 'signo' [-Wunused-parameter] static void sigterm(int signo) ^ 1 warning generated. ninja: build stopped: subcommand failed. 14:30:21 ninja failed with: exit status 1 #### failed to build some targets (03:56 (mm:ss)) ####
int tseg1, alltseg; //改为 unsigned int tseg1, alltseg;
packages/can-utils-master/testj1939.c:56:27: warning: unused parameter 'sig' [-Wunused-parameter] static void onsigalrm(int sig) ^ packages/can-utils-master/testj1939.c:64:26: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces] struct itimerval it = { 0 }; ^ {}
struct itimerval it = { 0 }; //改为 struct itimerval it;// = { 0 }
改完, 编译OK
PS:编译通过后, 并进行验证测试