当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 16 篇帖子 ]  前往页数 1, 2  下一页
作者 内容
1 楼 
 文章标题 : 怒了,急求解答为什么我Ubuntu7.10不可以编译内核模块
帖子发表于 : 2008-04-13 20:51 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
一个简单的hello.c
代码:
#include <linux/module.h>
#include <linux/init.h>
MODULE_LICENSE("GPL");

   static int hello_init(void)
    {
        printk(KERN_ALERT "Hello, world\n");
        return 0;
    }
 
  static void hello_exit(void)
  {
       printk(KERN_ALERT "Goodbye, cruel world\n");
  }

   module_init(hello_init);
   module_exit(hello_exit);

我的Makefile文件
代码:
PWD = $(shell pwd)
KERNEL_SRC = /usr/src/linux/

obj-m := hello.o
module-objs := hello.o

all:
   $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
   
clean:
   rm *.ko
   rm *.o

我出现的错误
代码:
$ make
make -C /usr/src/linux/ M=/home/yxdtiger modules
make[1]: Entering directory `/usr/src/linux-2.6.24.4'

  ERROR: Kernel configuration is invalid.
         include/linux/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.


  WARNING: Symbol version dump /usr/src/linux-2.6.24.4/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/yxdtiger/hello.o
cc1: 错误: include/linux/autoconf.h:No such file or directory
在包含自 include/linux/posix_types.h:47 的文件中,
                 从 include/linux/types.h:11,
                 从 include/linux/prefetch.h:13,
                 从 include/linux/list.h:8,
                 从 include/linux/module.h:9,
                 从 /home/yxdtiger/hello.c:1:
/usr/lib/gcc/i486-linux-gnu/4.1.3/include/asm/posix_types.h:13:22: 错误: features.h:No such file or directory
/usr/lib/gcc/i486-linux-gnu/4.1.3/include/asm/posix_types.h:14:35: 错误: 没有包含路径可供搜索 asm/posix_types.h
在包含自 include/linux/prefetch.h:13 的文件中,
                 从 include/linux/list.h:8,
                 从 include/linux/module.h:9,
                 从 /home/yxdtiger/hello.c:1:
include/linux/types.h:12:23: 错误: asm/types.h:No such file or directory
In file included from include/linux/prefetch.h:13,
                 from include/linux/list.h:8,
                 from include/linux/module.h:9,
                 from /home/yxdtiger/hello.c:1:
include/linux/types.h:16: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__kernel_dev_t’
include/linux/types.h:19: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dev_t’
include/linux/types.h:20: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ino_t’
include/linux/types.h:21: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mode_t’
include/linux/types.h:22: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘nlink_t’
include/linux/types.h:23: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘off_t’
include/linux/types.h:24: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pid_t’
include/linux/types.h:25: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘daddr_t’
include/linux/types.h:27: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘suseconds_t’
include/linux/types.h:28: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘timer_t’
include/linux/types.h:29: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘clockid_t’
include/linux/types.h:35: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uid_t’
include/linux/types.h:36: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gid_t’
include/linux/types.h:37: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uid16_t’
include/linux/types.h:38: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘gid16_t’
include/linux/types.h:57: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘loff_t’
include/linux/types.h:66: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘size_t’
include/linux/types.h:71: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ssize_t’
include/linux/types.h:76: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ptrdiff_t’
include/linux/types.h:81: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘time_t’
include/linux/types.h:86: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘clock_t’
include/linux/types.h:91: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘caddr_t’
include/linux/types.h:109: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘u_int8_t’
include/linux/types.h:110: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int8_t’
include/linux/types.h:111: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘u_int16_t’
include/linux/types.h:112: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int16_t’
include/linux/types.h:113: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘u_int32_t’
include/linux/types.h:114: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int32_t’
include/linux/types.h:118: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uint8_t’
include/linux/types.h:119: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uint16_t’
include/linux/types.h:120: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uint32_t’
include/linux/types.h:123: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uint64_t’
include/linux/types.h:124: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘u_int64_t’
include/linux/types.h:125: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int64_t’
include/linux/types.h:180: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__le16’
include/linux/types.h:181: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__be16’
include/linux/types.h:182: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__le32’
include/linux/types.h:183: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__be32’
include/linux/types.h:185: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__le64’
include/linux/types.h:186: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__be64’
include/linux/types.h:188: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__sum16’
include/linux/types.h:189: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__wsum’
include/linux/types.h:197: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘resource_size_t’
include/linux/types.h:203: 错误: expected specifier-qualifier-list before ‘__kernel_daddr_t’
在包含自 include/linux/list.h:8 的文件中,
                 从 include/linux/module.h:9,
                 从 /home/yxdtiger/hello.c:1:
include/linux/prefetch.h:14:27: 错误: asm/processor.h:No such file or directory
include/linux/prefetch.h:15:23: 错误: asm/cache.h:No such file or directory
In file included from include/linux/list.h:8,
                 from include/linux/module.h:9,
                 from /home/yxdtiger/hello.c:1:
include/linux/prefetch.h:53: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
在包含自 include/linux/module.h:9 的文件中,
                 从 /home/yxdtiger/hello.c:1:
include/linux/list.h:9:24: 错误: asm/system.h:No such file or directory
In file included from include/linux/module.h:9,
                 from /home/yxdtiger/hello.c:1:
include/linux/list.h: 在函数 ‘__list_add_rcu’ 中:
include/linux/list.h:100: 错误: 隐式声明函数 ‘smp_wmb’
在包含自 include/linux/module.h:10 的文件中,
                 从 /home/yxdtiger/hello.c:1:
include/linux/stat.h:6:22: 错误: asm/stat.h:No such file or directory
在包含自 include/linux/kernel.h:11 的文件中,
                 从 include/linux/cache.h:4,
                 从 include/linux/time.h:7,
                 从 include/linux/stat.h:60,
                 从 include/linux/module.h:10,
                 从 /home/yxdtiger/hello.c:1:
include/linux/linkage.h:4:25: 错误: asm/linkage.h:No such file or directory
在包含自 include/linux/kernel.h:15 的文件中,
                 从 include/linux/cache.h:4,
                 从 include/linux/time.h:7,
                 从 include/linux/stat.h:60,
                 从 include/linux/module.h:10,
                 从 /home/yxdtiger/hello.c:1:
include/linux/bitops.h:17:24: 错误: asm/bitops.h:No such file or directory
In file included from include/linux/kernel.h:15,
                 from include/linux/cache.h:4,
                 from include/linux/time.h:7,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/yxdtiger/hello.c:1:
include/linux/bitops.h: 在函数 ‘get_bitmask_order’ 中:
include/linux/bitops.h:29: 错误: 隐式声明函数 ‘fls’
include/linux/bitops.h: 在函数 ‘hweight_long’ 中:
include/linux/bitops.h:45: 错误: 隐式声明函数 ‘hweight32’
include/linux/bitops.h:45: 错误: 隐式声明函数 ‘hweight64’
include/linux/bitops.h: 在顶层:
include/linux/bitops.h:53: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rol32’
include/linux/bitops.h:63: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ror32’
include/linux/bitops.h: 在函数 ‘fls_long’ 中:
include/linux/bitops.h:72: 错误: 隐式声明函数 ‘fls64’
In file included from include/linux/kernel.h:16,
                 from include/linux/cache.h:4,
                 from include/linux/time.h:7,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/yxdtiger/hello.c:1:
include/linux/log2.h: 在顶层:
include/linux/log2.h:32: 错误: expected ‘)’ before ‘n’
include/linux/log2.h:40: 错误: expected ‘)’ before ‘n’
在包含自 include/linux/cache.h:4 的文件中,
                 从 include/linux/time.h:7,
                 从 include/linux/stat.h:60,
                 从 include/linux/module.h:10,
                 从 /home/yxdtiger/hello.c:1:
include/linux/kernel.h:17:27: 错误: asm/byteorder.h:No such file or directory
include/linux/kernel.h:18:21: 错误: asm/bug.h:No such file or directory
In file included from include/linux/cache.h:4,
                 from include/linux/time.h:7,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/yxdtiger/hello.c:1:
include/linux/kernel.h:148: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kernel.h:149: 错误: 格式字符串实参不是字符串玵型
include/linux/kernel.h:149: 警告: 与内建函数 ‘snprintf’ 类型冲突
include/linux/kernel.h:150: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kernel.h:151: 错误: 格式字符串实参不是字符串玵型
include/linux/kernel.h:151: 警告: 与内建函数 ‘vsnprintf’ 类型冲突
include/linux/kernel.h:152: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kernel.h:153: 错误: 格式字符串实参不是字符串玵型
include/linux/kernel.h:154: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kernel.h:155: 错误: 格式字符串实参不是字符串玵型
include/linux/kernel.h:251: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kernel.h:253: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kernel.h:256: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kernel.h:258: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kernel.h:319:2: 错误: #error "Please fix asm/byteorder.h"
In file included from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:49,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/yxdtiger/hello.c:1:
include/linux/thread_info.h:23: 错误: expected specifier-qualifier-list before ‘u32’
在包含自 include/linux/preempt.h:9 的文件中,
                 从 include/linux/spinlock.h:49,
                 从 include/linux/seqlock.h:29,
                 从 include/linux/time.h:8,
                 从 include/linux/stat.h:60,
                 从 include/linux/module.h:10,
                 从 /home/yxdtiger/hello.c:1:
include/linux/thread_info.h:34:29: 错误: asm/thread_info.h:No such file or directory
include/linux/thread_info.h:43: 警告: ‘struct thread_info’ 在形参表内部声明
include/linux/thread_info.h:43: 警告: 它的作用域仅限于此定义或声明,这可能并不是您想要的
include/linux/thread_info.h: 在函数 ‘set_ti_thread_flag’ 中:
include/linux/thread_info.h:45: 错误: 隐式声明函数 ‘set_bit’
include/linux/thread_info.h:45: 错误: 提领指向不完全类型的指针
include/linux/thread_info.h: 在顶层:
include/linux/thread_info.h:48: 警告: ‘struct thread_info’ 在形参表内部声明
include/linux/thread_info.h: 在函数 ‘clear_ti_thread_flag’ 中:
include/linux/thread_info.h:50: 错误: 隐式声明函数 ‘clear_bit’
include/linux/thread_info.h:50: 错误: 提领指向不完全类型的指针
include/linux/thread_info.h: 在顶层:
include/linux/thread_info.h:53: 警告: ‘struct thread_info’ 在形参表内部声明
include/linux/thread_info.h: 在函数 ‘test_and_set_ti_thread_flag’ 中:
include/linux/thread_info.h:55: 错误: 隐式声明函数 ‘test_and_set_bit’
include/linux/thread_info.h:55: 错误: 提领指向不完全类型的指针
include/linux/thread_info.h: 在顶层:
include/linux/thread_info.h:58: 警告: ‘struct thread_info’ 在形参表内部声明
include/linux/thread_info.h: 在函数 ‘test_and_clear_ti_thread_flag’ 中:
include/linux/thread_info.h:60: 错误: 隐式声明函数 ‘test_and_clear_bit’
include/linux/thread_info.h:60: 错误: 提领指向不完全类型的指针
include/linux/thread_info.h: 在顶层:
include/linux/thread_info.h:63: 警告: ‘struct thread_info’ 在形参表内部声明
include/linux/thread_info.h: 在函数 ‘test_ti_thread_flag’ 中:
include/linux/thread_info.h:65: 错误: 隐式声明函数 ‘test_bit’
include/linux/thread_info.h:65: 错误: 提领指向不完全类型的指针
在包含自 include/linux/seqlock.h:29 的文件中,
                 从 include/linux/time.h:8,
                 从 include/linux/stat.h:60,
                 从 include/linux/module.h:10,
                 从 /home/yxdtiger/hello.c:1:
include/linux/spinlock.h:333:24: 错误: asm/atomic.h:No such file or directory
In file included from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/yxdtiger/hello.c:1:
include/linux/spinlock.h: 在顶层:
include/linux/spinlock.h:339: 错误: expected ‘)’ before ‘*’ token
In file included from include/linux/time.h:8,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/yxdtiger/hello.c:1:
include/linux/seqlock.h: 在函数 ‘read_seqbegin’ 中:
include/linux/seqlock.h:89: 错误: 隐式声明函数 ‘smp_rmb’
In file included from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from /home/yxdtiger/hello.c:1:
include/linux/time.h: 在顶层:
include/linux/time.h:14: 错误: expected specifier-qualifier-list before ‘time_t’
include/linux/time.h:20: 错误: expected specifier-qualifier-list before ‘time_t’
include/linux/time.h: 在函数 ‘timespec_equal’ 中:
include/linux/time.h:43: 错误: ‘const struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:43: 错误: ‘const struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:43: 错误: ‘const struct timespec’ 没有名为 ‘tv_nsec’ 的成员
include/linux/time.h:43: 错误: ‘const struct timespec’ 没有名为 ‘tv_nsec’ 的成员
include/linux/time.h: 在函数 ‘timespec_compare’ 中:
include/linux/time.h:53: 错误: ‘const struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:53: 错误: ‘const struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:55: 错误: ‘const struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:55: 错误: ‘const struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:57: 错误: ‘const struct timespec’ 没有名为 ‘tv_nsec’ 的成员
include/linux/time.h:57: 错误: ‘const struct timespec’ 没有名为 ‘tv_nsec’ 的成员
include/linux/time.h: 在函数 ‘timeval_compare’ 中:
include/linux/time.h:62: 错误: ‘const struct timeval’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:62: 错误: ‘const struct timeval’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:64: 错误: ‘const struct timeval’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:64: 错误: ‘const struct timeval’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:66: 错误: ‘const struct timeval’ 没有名为 ‘tv_usec’ 的成员
include/linux/time.h:66: 错误: ‘const struct timeval’ 没有名为 ‘tv_usec’ 的成员
include/linux/time.h: 在顶层:
include/linux/time.h:73: 错误: expected declaration specifiers or ‘...’ before ‘time_t’
include/linux/time.h: 在函数 ‘timespec_sub’ 中:
include/linux/time.h:82: 错误: ‘struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:82: 错误: ‘struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:83: 错误: ‘struct timespec’ 没有名为 ‘tv_nsec’ 的成员
include/linux/time.h:83: 错误: ‘struct timespec’ 没有名为 ‘tv_nsec’ 的成员
include/linux/time.h:83: 错误: 提供给函数 ‘set_normalized_timespec’ 的实参太多
include/linux/time.h: 在顶层:
include/linux/time.h:133: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘timespec_to_ns’
include/linux/time.h:145: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘timeval_to_ns’
include/linux/time.h:157: 警告: 在 ‘s64’ 的声明中,类型默认为 ‘int’
include/linux/time.h:157: 错误: expected ‘;’, ‘,’ or ‘)’ before ‘nsec’
include/linux/time.h:165: 警告: 在 ‘s64’ 的声明中,类型默认为 ‘int’
include/linux/time.h:165: 错误: expected ‘;’, ‘,’ or ‘)’ before ‘nsec’
include/linux/time.h:172: 错误: expected declaration specifiers or ‘...’ before ‘u64’
include/linux/time.h: 在函数 ‘timespec_add_ns’ 中:
include/linux/time.h:174: 错误: ‘ns’ 未声明 (在此函数内第一次使用)
include/linux/time.h:174: 错误: (即使在一个函数内多次出现,每个未声明的标识符在其
include/linux/time.h:174: 错误: 所在的函数内只报告一次。)
include/linux/time.h:174: 错误: ‘struct timespec’ 没有名为 ‘tv_nsec’ 的成员
include/linux/time.h:177: 错误: ‘struct timespec’ 没有名为 ‘tv_sec’ 的成员
include/linux/time.h:179: 错误: ‘struct timespec’ 没有名为 ‘tv_nsec’ 的成员
In file included from include/linux/module.h:10,
                 from /home/yxdtiger/hello.c:1:
include/linux/stat.h: 在顶层:
include/linux/stat.h:63: 错误: expected specifier-qualifier-list before ‘u64’
在包含自 include/linux/kmod.h:23 的文件中,
                 从 include/linux/module.h:13,
                 从 /home/yxdtiger/hello.c:1:
include/linux/errno.h:4:23: 错误: asm/errno.h:No such file or directory
In file included from include/linux/module.h:13,
                 from /home/yxdtiger/hello.c:1:
include/linux/kmod.h: 在函数 ‘request_module’ 中:
include/linux/kmod.h:33: 错误: ‘ENOSYS’ 未声明 (在此函数内第一次使用)
include/linux/kmod.h: 在函数 ‘call_usermodehelper’ 中:
include/linux/kmod.h:74: 错误: ‘ENOMEM’ 未声明 (在此函数内第一次使用)
include/linux/kmod.h: 在函数 ‘call_usermodehelper_keys’ 中:
include/linux/kmod.h:86: 错误: ‘ENOMEM’ 未声明 (在此函数内第一次使用)
在包含自 include/linux/module.h:14 的文件中,
                 从 /home/yxdtiger/hello.c:1:
include/linux/elf.h:6:21: 错误: asm/elf.h:No such file or directory
In file included from include/linux/module.h:14,
                 from /home/yxdtiger/hello.c:1:
include/linux/elf.h: 在顶层:
include/linux/elf.h:18: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf32_Addr’
include/linux/elf.h:19: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf32_Half’
include/linux/elf.h:20: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf32_Off’
include/linux/elf.h:21: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf32_Sword’
include/linux/elf.h:22: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf32_Word’
include/linux/elf.h:25: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf64_Addr’
include/linux/elf.h:26: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf64_Half’
include/linux/elf.h:27: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf64_SHalf’
include/linux/elf.h:28: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf64_Off’
include/linux/elf.h:29: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf64_Sword’
include/linux/elf.h:30: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf64_Word’
include/linux/elf.h:31: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf64_Xword’
include/linux/elf.h:32: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Elf64_Sxword’
include/linux/elf.h:126: 错误: expected specifier-qualifier-list before ‘Elf32_Sword’
include/linux/elf.h:134: 错误: expected specifier-qualifier-list before ‘Elf64_Sxword’
include/linux/elf.h:149: 错误: expected specifier-qualifier-list before ‘Elf32_Addr’
include/linux/elf.h:154: 错误: expected specifier-qualifier-list before ‘Elf64_Addr’
include/linux/elf.h:159: 错误: expected specifier-qualifier-list before ‘Elf32_Addr’
include/linux/elf.h:165: 错误: expected specifier-qualifier-list before ‘Elf64_Addr’
include/linux/elf.h:171: 错误: expected specifier-qualifier-list before ‘Elf32_Word’
include/linux/elf.h:180: 错误: expected specifier-qualifier-list before ‘Elf64_Word’
include/linux/elf.h:193: 错误: expected specifier-qualifier-list before ‘Elf32_Half’
include/linux/elf.h:210: 错误: expected specifier-qualifier-list before ‘Elf64_Half’
include/linux/elf.h:232: 错误: expected specifier-qualifier-list before ‘Elf32_Word’
include/linux/elf.h:243: 错误: expected specifier-qualifier-list before ‘Elf64_Word’
include/linux/elf.h:288: 错误: expected specifier-qualifier-list before ‘Elf32_Word’
include/linux/elf.h:301: 错误: expected specifier-qualifier-list before ‘Elf64_Word’
include/linux/elf.h:362: 错误: expected specifier-qualifier-list before ‘Elf32_Word’
include/linux/elf.h:369: 错误: expected specifier-qualifier-list before ‘Elf64_Word’
include/linux/elf.h:374:5: 警告: “ELF_CLASS”未定义
include/linux/elf.h:396: 错误: expected declaration specifiers or ‘...’ before ‘loff_t’
In file included from include/linux/kobject.h:24,
                 from include/linux/module.h:16,
                 from /home/yxdtiger/hello.c:1:
include/linux/sysfs.h:30: 错误: expected specifier-qualifier-list before ‘mode_t’
include/linux/sysfs.h:64: 错误: expected specifier-qualifier-list before ‘size_t’
include/linux/sysfs.h:75: 错误: expected specifier-qualifier-list before ‘ssize_t’
include/linux/sysfs.h: 在函数 ‘sysfs_schedule_callback’ 中:
include/linux/sysfs.h:122: 错误: ‘ENOSYS’ 未声明 (在此函数内第一次使用)
include/linux/sysfs.h: 在顶层:
include/linux/sysfs.h:153: 错误: expected declaration specifiers or ‘...’ before ‘mode_t’
In file included from include/linux/kobject.h:27,
                 from include/linux/module.h:16,
                 from /home/yxdtiger/hello.c:1:
include/linux/kref.h:24: 错误: expected specifier-qualifier-list before ‘atomic_t’
在包含自 include/linux/kobject.h:29 的文件中,
                 从 include/linux/module.h:16,
                 从 /home/yxdtiger/hello.c:1:
include/linux/wait.h:26:25: 错误: asm/current.h:No such file or directory
In file included from include/linux/module.h:16,
                 from /home/yxdtiger/hello.c:1:
include/linux/kobject.h:41: 错误: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘uevent_seqnum’
include/linux/kobject.h:228: 错误: expected specifier-qualifier-list before ‘ssize_t’
include/linux/kobject.h:256: 错误: expected declaration specifiers or ‘...’ before ‘size_t’
include/linux/kobject.h: 在函数 ‘kobject_action_type’ 中:
include/linux/kobject.h:258: 错误: ‘EINVAL’ 未声明 (在此函数内第一次使用)
在包含自 /home/yxdtiger/hello.c:1 的文件中:
include/linux/module.h:19:23: 错误: asm/local.h:No such file or directory
include/linux/module.h:21:24: 错误: asm/module.h:No such file or directory
In file included from /home/yxdtiger/hello.c:1:
include/linux/module.h: 在顶层:
include/linux/module.h:49: 错误: expected specifier-qualifier-list before ‘ssize_t’
include/linux/module.h: 在函数 ‘lookup_module_symbol_name’ 中:
include/linux/module.h:529: 错误: ‘ERANGE’ 未声明 (在此函数内第一次使用)
include/linux/module.h: 在函数 ‘lookup_module_symbol_attrs’ 中:
include/linux/module.h:534: 错误: ‘ERANGE’ 未声明 (在此函数内第一次使用)
include/linux/module.h: 在函数 ‘module_get_kallsym’ 中:
include/linux/module.h:541: 错误: ‘ERANGE’ 未声明 (在此函数内第一次使用)
make[2]: *** [/home/yxdtiger/hello.o] 错误 1
make[1]: *** [_module_/home/yxdtiger] 错误 2
make[1]: Leaving directory `/usr/src/linux-2.6.24.4'
make: *** [all] 错误 2


页首
 用户资料  
 
2 楼 
 文章标题 :
帖子发表于 : 2008-04-13 20:53 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
急啊,大侠求救阿,不然我就得装FC了


页首
 用户资料  
 
3 楼 
 文章标题 :
帖子发表于 : 2008-04-13 20:55 
头像

注册: 2006-07-02 11:16
帖子: 12522
地址: 廣州
送出感谢: 0 次
接收感谢: 8
KERNEL_SRC = /usr/src/linux/ <-- 你这里根本没放内核(头文件)源码

先了解原理


_________________
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。


页首
 用户资料  
 
4 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:07 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET 写道:
KERNEL_SRC = /usr/src/linux/ <-- 你这里根本没放内核(头文件)源码

先了解原理
我放了的阿,因为不确定,刚刚还重新编译了内核
代码:
$ ls /usr/src/linux
arch       Documentation  kernel       REPORTING-BUGS   stamp-configure-arch
block      drivers        lib          samples          stamp-configure-indep
conf.vars  fs             MAINTAINERS  scripts          stamp-debian
COPYING    include        Makefile     security         stamp-indep-conf
CREDITS    init           mm           sound            stamp-kernel-image
crypto     ipc            net          stamp-arch-conf  usr
debian     Kbuild         README       stamp-configure


页首
 用户资料  
 
5 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:09 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET
请教下怎么解决阿,明天要交个内核模块的习题,可我这边还没能编译。。。


页首
 用户资料  
 
6 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:13 
头像

注册: 2006-07-02 11:16
帖子: 12522
地址: 廣州
送出感谢: 0 次
接收感谢: 8
不知道你的 /usr/src/linux/ 怎么来的, 我这里可以
安装对应内核的header包


_________________
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。


页首
 用户资料  
 
7 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:16 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET
是我自己装的阿,一个到linux-2.6.24.4的硬链接,我以前用的是以前默认的 linux-headers-2.6.22-14
也不行


页首
 用户资料  
 
8 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:17 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET
是不是重新装个头文件包就好了?


页首
 用户资料  
 
9 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:19 
头像

注册: 2006-07-02 11:16
帖子: 12522
地址: 廣州
送出感谢: 0 次
接收感谢: 8
是我自己装的阿,一个到linux-2.6.24.4的硬链接,我以前用的是以前默认的 linux-headers-2.6.22-14
也不行

什么意思


_________________
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。


页首
 用户资料  
 
10 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:20 
头像

注册: 2006-07-02 11:16
帖子: 12522
地址: 廣州
送出感谢: 0 次
接收感谢: 8
我自己编译的内核

ii linux-headers-2.6.23.14-ac-080115 2.6.23.14-ac-080115-10.00.Custom Header files related to Linux kernel, specif
ii linux-image-2.6.23.14-ac-080115 2.6.23.14-ac-080115-10.00.Custom Linux kernel binary image for version 2.6.23


_________________
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。


页首
 用户资料  
 
11 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:28 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET
代码:
$ make ‐C /usr/src/linux-headers-2.6.22-14 M=`pwd` modules
make: *** 没有规则可以创建目标“‐C”。 停止。

这个是用的我安装系统时生成的头文件,出现错误
我不知道怎么解决,就编译了个新内核,还是不行


页首
 用户资料  
 
12 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:31 
头像

注册: 2006-07-02 11:16
帖子: 12522
地址: 廣州
送出感谢: 0 次
接收感谢: 8
yxdtiger 写道:
BigSnake.NET
代码:
$ make ‐C /usr/src/linux-headers-2.6.22-14 M=`pwd` modules
make: *** 没有规则可以创建目标“‐C”。 停止。

这个是用的我安装系统时生成的头文件,出现错误
我不知道怎么解决,就编译了个新内核,还是不行


你看看你自己写的makefile
改第二行就是啊


_________________
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。


页首
 用户资料  
 
13 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:36 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET
我改了
代码:
PWD = $(shell pwd)
KERNEL_SRC = /usr/src/linux-headers-2.6.22-14

obj-m := hello.o
module-objs := hello.o

all:
   $(MAKE) -C $(KERNEL_SRC) M=$(PWD) modules
   
clean:
   rm *.ko
   rm *.o
出现下面的错误
代码:
~$ make
make -C /usr/src/linux-headers-2.6.22-14  M=/home/yxdtiger modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.22-14'

  WARNING: Symbol version dump /usr/src/linux-headers-2.6.22-14/Module.symvers
           is missing; modules will have no dependencies and modversions.

  Building modules, stage 2.
  MODPOST 1 modules
/bin/sh: scripts/mod/modpost: No such file or directory
make[2]: *** [__modpost] 错误 127
make[1]: *** [modules] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.22-14'
make: *** [all] 错误 2


页首
 用户资料  
 
14 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:42 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET
我为这几个错误忙了两天了,还是没解决,大侠帮忙阿
万分感谢!!!


页首
 用户资料  
 
15 楼 
 文章标题 :
帖子发表于 : 2008-04-13 21:54 

注册: 2007-03-19 14:04
帖子: 17
送出感谢: 0 次
接收感谢: 0 次
大侠,救命阿!!!


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 16 篇帖子 ]  前往页数 1, 2  下一页

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 1 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译