【发布时间】:2011-08-29 11:51:40
【问题描述】:
我正在尝试编译一个库,其中包含来自 kernel-devel 包的一些头文件。我链接了适当的头文件,但现在我在这些头文件中遇到编译错误。
/usr/include/asm-generic/bitops/fls64.h: In function ‘int fls64(__u64)’:
/usr/include/asm-generic/bitops/fls64.h:10: error: ‘fls’ was not declared in this scope
/usr/include/asm-generic/bitops/fls64.h:11: error: ‘fls’ was not declared in this scope
还有,这里是来自 asm-generic/bitops/fls64.h 的代码
#ifndef _ASM_GENERIC_BITOPS_FLS64_H_
#define _ASM_GENERIC_BITOPS_FLS64_H_
#include <asm/types.h>
static inline int fls64(__u64 x)
{
__u32 h = x >> 32;
if (h)
return fls(h) + 32;
return fls(x);
}
#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */
您可以注意到“return fls(h)”,fls() 没有定义。我可以通过包含“fls.h”来解决这个问题,但是我想修复标准内核头文件中的此类错误吗??
任何可以解释为什么会这样以及我可以做些什么来解决这些问题的指针?顺便说一句,我在这里提到的错误只是冰山一角。多个此类标头中有很多此类(缺少声明)错误。
我们将不胜感激。谢谢!
rgds/R.
PS:一些系统细节:
Linux 发行版:CentOS (5.5)
[raj@localhost common]$ uname -a
Linux localhost.localdomain 2.6.18-238.9.1.el5 #1 SMP Tue Apr 12 18:10:56 EDT 2011 i686 i686 i386 GNU/Linux
[raj@localhost common]$ cat /proc/version
Linux version 2.6.18-238.9.1.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Tue Apr 12 18:10:56 EDT 2011
【问题讨论】:
-
请发布更多编译器的输出。真正的错误可能在您引用的摘录之上。
-
Robin,我没有发布更多内容,因为我认为这无关紧要。我担心的是我认为标准的 Linux 头文件 fls64.h 正在使用一个没有定义的函数。这正常吗?
-
我认为这也取决于如何配置内核。代码是标准的,但配置可能有 1000 或更多的可能性。
标签: linux gcc linux-kernel compilation centos5