【嵌入式】交叉编译 移植 ALSA 报错 error: ‘__kernel_long_t’ undeclared (first use in this function)

1、报错Log

In file included from ../../include/sound/asound.h:1:0,
                 from ../../include/local.h:146,
                 from timer_local.h:22,
                 from timer_hw.c:22:
timer_hw.c: In function ‘snd_timer_hw_open’:
../../include/alsa/sound/uapi/asound.h:882:42: error: ‘__kernel_long_t’ undeclared (first use in this function)
 #define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
                                          ^
timer_hw.c:249:17: note: in expansion of macro ‘SNDRV_TIMER_IOCTL_TREAD’
   if (ioctl(fd, SNDRV_TIMER_IOCTL_TREAD, &arg) < 0) {
    
    
                 ^
../../include/alsa/sound/uapi/asound.h:882:42: note: each undeclared identifier is reported only once for each function it appears in
 #define SNDRV_TIMER_IOCTL_TREAD ((sizeof(__kernel_long_t) >= sizeof(time_t)) ? \
                                          ^
timer_hw.c:249:17: note: in expansion of macro ‘SNDRV_TIMER_IOCTL_TREAD’
   if (ioctl(fd, SNDRV_TIMER_IOCTL_TREAD, &arg) < 0) {
    
    
                 ^
Makefile:381: recipe for target 'timer_hw.lo' failed
make[3]: *** [timer_hw.lo] Error 1
make[3]: *** 正在等待未完成的任务....
make[3]: Leaving directory '/home/icedustpan/buildroot-2020.05.1/output/build/alsa-lib-1.2.2/src/timer'
Makefile:541: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/icedustpan/buildroot-2020.05.1/output/build/alsa-lib-1.2.2/src'
Makefile:404: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/icedustpan/buildroot-2020.05.1/output/build/alsa-lib-1.2.2'
package/pkg-generic.mk:266: recipe for target '/home/icedustpan/buildroot-2020.05.1/output/build/alsa-lib-1.2.2/.stamp_built' failed
make: *** [/home/icedustpan/buildroot-2020.05.1/output/build/alsa-lib-1.2.2/.stamp_built] Error 2

2、解决方法

在这个文件 timer_local.h

alsa-lib-1.2.2/src/timer/timer_local.h

sudo vim ./output/build/alsa-lib-1.2.2/src/timer/timer_local.h

添加以下内容

#ifndef __kernel_long_t
typedef long        __kernel_long_t;
typedef unsigned long    __kernel_ulong_t;
#endif

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44205779/article/details/107778632
今日推荐