0

我正在尝试编译 SVGA 源以构建共享库对象。编译时出现此错误

make[1]: Entering directory `/home/manmatha/Downloads/svgalib-1.9.25/utils'
gcc -I../include -I. -MM ../utils/restorefont.c ../utils/convfont.c ../utils/restoretextmode.c ../utils/restorepalette.c ../utils/dumpreg.c >.depend
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o restorefont.o restorefont.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o restorefont restorefont.o -lvga -lm
chmod 4755 restorefont
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o convfont.o convfont.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o convfont convfont.o -lvga -lm
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o restoretextmode.o restoretextmode.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o restoretextmode restoretextmode.o -lvga -lm
chmod 4755 restoretextmode
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o restorepalette.o restorepalette.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o restorepalette restorepalette.o -lvga -lm
chmod 4755 restorepalette
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o dumpreg.o dumpreg.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o dumpreg dumpreg.o -lvga -lm
chmod 4755 dumpreg
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o gtfcalc -DTESTING_GTF gtf/gtfcalc.c -lvga -lm
gtf/gtfcalc.c:67: error: static declaration of ‘round’ follows non-static declaration
make[1]: *** [gtfcalc] Error 1
make[1]: Leaving directory `/home/manmatha/Downloads/svgalib-1.9.25/utils'
make: *** [textutils] Error 2

编辑::是的,补丁有效..但是在编译 svga_helper.ko 模块时编译遇到下一个错误

/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:1:26: error: linux/config.h: No such file or directory
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:20:35: error: linux/devfs_fs_kernel.h: No such file or directory
In file included from /home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:42:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/kernel26compat.h: In function ‘devfs_unregister_chrdev’:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/kernel26compat.h:80: error: void value not ignored as it ought to be
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c: In function ‘svgalib_helper_ioctl’:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:237: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:242: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:247: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:252: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:258: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:264: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:358: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:358: error: (Each undeclared identifier is reported only once
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:358: error: for each function it appears in.)
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:358: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:123: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,  void *, struct pt_regs *)’
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c: In function ‘svgalib_helper_open’:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:446: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:446: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:123: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int,  void *, struct pt_regs *)’
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c: In function ‘init_module’:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:651: error: implicit declaration of function ‘class_device_create’
make[3]: *** [/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.o] Error 1
make[2]: *** [_module_/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper] Error 2
make[2]: Leaving directory `/usr/src/kernels/2.6.32-358.0.1.el6.x86_64'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper'
make: *** [installmodule] Error 2
4

1 回答 1

3

我认为您想使用更新版本的 svgalib。1.4.3 已经很老了,不再维护。如果我没记错的话,它也需要打补丁才能与较新的编译器一起使用。尝试来自http://svgalib.org/的 1.9.x 版本之一

对于更高版本,如果您收到错误:

error: static declaration of 'round' follows non-static declaration

应用以下补丁:

--- svgalib-1.9.25/utils/gtf/gtfcalc.c
+++ svgalib-1.9.25/utils/gtf/gtfcalc.c
@@ -68,5 +68,5 @@

-static double round(double v) 
+double round(double v) 
 { 
    return floor(v + 0.5); 
 }

编辑:

使用 svga_helper.ko 模块中的最新编译问题,设置 NO_HELPER 变量以禁用构建 svga_helper.ko。config.h 等已从更新的内核中删除。从自述文件:

有一个编译时选项可以返回旧行为,即使用 root 权限访问 /dev/mem,而不是 svgalib 助手。要为此进行编译,请选择 Makefile.cfg 中的 NO_HELPER 选项。

于 2013-05-05T00:25:59.457 回答