我是靠谱客的博主 悦耳玫瑰,最近开发中收集的这篇文章主要介绍compile:错误: ‘SPIN_LOCK_UNLOCKED’未声明(不在函数内),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

when I compile ethercat, compile:错误: ‘SPIN_LOCK_UNLOCKED’未声明(不在函数内)


摘自:http://blog.csdn.net/lkssbc/article/details/6905773

编译LDD3中的scull出现错误,错误: ‘SPIN_LOCK_UNLOCKED’未声明(不在函数内)

处理办法:

   将static spinlock_t scull_u_lock =SPIN_LOCK_UNLOCKED;

   改为staticDEFINE_SPINLOCK(scull_u_lock);

再次编译通过。

原因:

   SPIN_LOCK_UNLOCKED has beendeprecated since 2.6.19 and will get removed in 2.6.39。SPIN_LOCK_UNLOCKED已被弃用自2.6.19,将在2.6.39中删除。

(擦,我用的是3.0.0的内核,已经被删除了)

备忘,仅供参考。


error: ‘SPIN_LOCK_UNLOCKED’undeclared here (not in a function) 错误的解析

摘自:http://hi.baidu.com/lrbpp/blog/item/0f02781a01bc75c636d122a7.html

Full error:

Quote:
/tmp/.MP2CHYBH8/parallels-kernel-modules/src/hypervisor-api/Linux/hyp_api.c:75:38:error: ‘SPIN_LOCK_UNLOCKED’ undeclared here (not in afunction)
/tmp/.MP2CHYBH8/parallels-kernel-modules/src/hypervisor-api/Linux/hyp_api.c:112:2:error: implicit declaration of function ‘kmalloc’
Trying to run on Kernel Linux3.0.0-1-amd64 (x86_64).

Apparently SPIN_LOCK_UNLOCKED has been deprecated(弃用) since 2007and completely removed since version 2.6.39.
I was able to patch that by adding the removed line back into tospinlock_types.h but I'm not sure about the kmalloc.

So @Parallels team; please update I wanna try/buy this software.<3
And @Everyone else; know of a temporary patch to fix the kmallocissue? :(

If I could patch the sourcedirectly it'd be ok but I'm sort of scared to since I can'tcontinue the installation from the same tmp folder and if I justran the make from there I might miss some finalizing routine Idon't know about. x.x

现在使用voidspin_lock_init(spinlock_t *lock);

函数代替初始化 自旋锁spin;




最后

以上就是悦耳玫瑰为你收集整理的compile:错误: ‘SPIN_LOCK_UNLOCKED’未声明(不在函数内)的全部内容,希望文章能够帮你解决compile:错误: ‘SPIN_LOCK_UNLOCKED’未声明(不在函数内)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部