QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1647|回复: 0

没有办法整体编译通过ldd2的源代码!!请求帮忙

[复制链接]
发表于 2006-11-18 15:15:26 | 显示全部楼层 |阅读模式
在redhat9.0或者debian(2.4.27内核)下面就是没有办法整体编译通过ldd2(linux设备驱动程序,2nd)的源代码,会出现一大堆错误。提示如下:
zxh@debian:~/testSource/Ldd2/ldd2-samples-1.0.1$ make

for n in misc-progs misc-modules skull scull scullc scullp scullv sbull spull snull short shortprint pci simple usb allocator; do make -C $n || exit 1; done
make[1]: Entering directory `/home/zxh/testSource/Ldd2/ldd2-samples-1.0.1/misc-progs'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/zxh/testSource/Ldd2/ldd2-samples-1.0.1/misc-progs'
make[1]: Entering directory `/home/zxh/testSource/Ldd2/ldd2-samples-1.0.1/misc-modules'
gcc -Wall -D__KERNEL__ -DMODULE -I/usr/src/kernel-headers-2.4.27-2-386 /include -O2 -I.. -c -o sleepy.o sleepy.c
gcc: cannot specify -o with -c or -S and multiple compilations
make[1]: *** [sleepy.o] 错误 1
make[1]: Leaving directory `/home/zxh/testSource/Ldd2/ldd2-samples-1.0.1/misc-modules'
make: *** [subdirs] 错误 1

尤其是这句提示“gcc: cannot specify -o with -c or -S and multiple compilations”不知道什么意思?但是如果在各个目录下面单个编译某个文件,都能够成功,也可以加载,我单个编译各个模块的makefile是这样的(这时debian的,如果在redhat9.0下面,就把kernel-headers-2.4.27-2-386换成linux-2.4.20-8就这可以):
TARGET := hello
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /usr/src/kernel-headers-2.4.27-2-386/include
#INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := gcc

${TARGET}.o: ${TARGET}.c
clean:
rm -rf *.o
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-25 00:44 , Processed in 0.071749 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表