PC环境:
fedora core 7.0
其相关配置为:
linux:2.6.21
gcc:4.1.2
线程库:NPTL2.6 (getconf GNU_LIBPTHREAD_VERSION命令查看)
fedora core 7.0
其相关配置为:
linux:2.6.21
gcc:4.1.2
线程库:NPTL2.6 (getconf GNU_LIBPTHREAD_VERSION命令查看)
(1)、编译libminigui-1.3.3出错:
varbitmap.c:248: error: static declaration of 'var_bitmap_font_ops' follows non-static declaration
varbitmap.c:248: error: static declaration of 'var_bitmap_font_ops' follows non-static declaration
具体错误如下:
source='varbitmap.c' object='varbitmap.lo' libtool=yes \
depfile='.deps/varbitmap.Plo' tmpdepfile='.deps/varbitmap.TPlo' \
depmode=gcc3 /bin/sh http://www.cnblogs.com/depcomp \
/bin/sh http://www.cnblogs.com/libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -Ihttp://www.cnblogs.com/include -I../include -g -O2 -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c -o varbitmap.lo `test -f 'varbitmap.c' || echo './'`varbitmap.c
rm -f .libs/varbitmap.lo
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -Ihttp://www.cnblogs.com/include -I../include -g -O2 -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c varbitmap.c -MT varbitmap.lo -MD -MP -MF .deps/varbitmap.TPlo -fPIC -DPIC -o .libs/varbitmap.lo
varbitmap.c:248: error: static declaration of 'var_bitmap_font_ops' follows non-static declaration
varbitmap.h:38: error: previous declaration of 'var_bitmap_font_ops' was here
make[4]: *** [varbitmap.lo] 错误 1
make[4]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/src/font'
make[3]: *** [all-recursive] 错误 1
make[3]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/src/font'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/src'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3'
make: *** [all] 错误 2
source='varbitmap.c' object='varbitmap.lo' libtool=yes \
depfile='.deps/varbitmap.Plo' tmpdepfile='.deps/varbitmap.TPlo' \
depmode=gcc3 /bin/sh http://www.cnblogs.com/depcomp \
/bin/sh http://www.cnblogs.com/libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -Ihttp://www.cnblogs.com/include -I../include -g -O2 -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c -o varbitmap.lo `test -f 'varbitmap.c' || echo './'`varbitmap.c
rm -f .libs/varbitmap.lo
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -Ihttp://www.cnblogs.com/include -I../include -g -O2 -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c varbitmap.c -MT varbitmap.lo -MD -MP -MF .deps/varbitmap.TPlo -fPIC -DPIC -o .libs/varbitmap.lo
varbitmap.c:248: error: static declaration of 'var_bitmap_font_ops' follows non-static declaration
varbitmap.h:38: error: previous declaration of 'var_bitmap_font_ops' was here
make[4]: *** [varbitmap.lo] 错误 1
make[4]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/src/font'
make[3]: *** [all-recursive] 错误 1
make[3]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/src/font'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/src'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3'
make: *** [all] 错误 2
出错原因:
在src/font/varbitmap.h中定义了extern FONTOPS var_bitmap_font_ops,那里var_bitmap_font_ops为extern类型的,而在src/font/varbitmap.c中定义的是static类型,所以可能造成了编译的出错。
在src/font/varbitmap.h中定义了extern FONTOPS var_bitmap_font_ops,那里var_bitmap_font_ops为extern类型的,而在src/font/varbitmap.c中定义的是static类型,所以可能造成了编译的出错。
解决方法如下:
修改src/font/varbitmap.c文件:
//static FONTOPS var_bitmap_font_ops = {
extern FONTOPS var_bitmap_font_ops = { // wmmwang 修改
修改src/font/varbitmap.c文件:
//static FONTOPS var_bitmap_font_ops = {
extern FONTOPS var_bitmap_font_ops = { // wmmwang 修改
(2)、编译libminigui-1.3.3出错:
grid.c: In function 'AddCol':
grid.c:626: error: invalid lvalue in assignment
grid.c:627: error: invalid lvalue in assignment
grid.c:640: error: invalid lvalue in assignment
grid.c:641: error: invalid lvalue in assignment
grid.c:669: error: invalid lvalue in assignment
grid.c:670: error: invalid lvalue in assignment
grid.c:682: error: invalid lvalue in assignment
grid.c:683: error: invalid lvalue in assignment
grid.c: In function 'AddRow':
grid.c:735: error: invalid lvalue in assignment
grid.c:736: error: invalid lvalue in assignment
grid.c:747: error: invalid lvalue in assignment
grid.c:748: error: invalid lvalue in assignment
grid.c:776: error: invalid lvalue in assignment
grid.c:777: error: invalid lvalue in assignment
grid.c:790: error: invalid lvalue in assignment
grid.c:791: error: invalid lvalue in assignment
grid.c: In function 'AddCol':
grid.c:626: error: invalid lvalue in assignment
grid.c:627: error: invalid lvalue in assignment
grid.c:640: error: invalid lvalue in assignment
grid.c:641: error: invalid lvalue in assignment
grid.c:669: error: invalid lvalue in assignment
grid.c:670: error: invalid lvalue in assignment
grid.c:682: error: invalid lvalue in assignment
grid.c:683: error: invalid lvalue in assignment
grid.c: In function 'AddRow':
grid.c:735: error: invalid lvalue in assignment
grid.c:736: error: invalid lvalue in assignment
grid.c:747: error: invalid lvalue in assignment
grid.c:748: error: invalid lvalue in assignment
grid.c:776: error: invalid lvalue in assignment
grid.c:777: error: invalid lvalue in assignment
grid.c:790: error: invalid lvalue in assignment
grid.c:791: error: invalid lvalue in assignment
具体错误如下:
source='grid.c' object='grid.lo' libtool=yes \
depfile='.deps/grid.Plo' tmpdepfile='.deps/grid.TPlo' \
depmode=gcc3 /bin/sh http://www.cnblogs.com/depcomp \
/bin/sh http://www.cnblogs.com/libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I./ -I../include -Ihttp://www.cnblogs.com/include -g -O2 -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c -o grid.lo `test -f 'grid.c' || echo './'`grid.c
rm -f .libs/grid.lo
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I./ -I../include -Ihttp://www.cnblogs.com/include -g -O2 -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c grid.c -MT grid.lo -MD -MP -MF .deps/grid.TPlo -fPIC -DPIC -o .libs/grid.lo
grid.c: In function 'AddCol':
grid.c:626: error: invalid lvalue in assignment
grid.c:627: error: invalid lvalue in assignment
grid.c:640: error: invalid lvalue in assignment
grid.c:641: error: invalid lvalue in assignment
grid.c:669: error: invalid lvalue in assignment
grid.c:670: error: invalid lvalue in assignment
grid.c:682: error: invalid lvalue in assignment
grid.c:683: error: invalid lvalue in assignment
grid.c: In function 'AddRow':
grid.c:735: error: invalid lvalue in assignment
grid.c:736: error: invalid lvalue in assignment
grid.c:747: error: invalid lvalue in assignment
grid.c:748: error: invalid lvalue in assignment
grid.c:776: error: invalid lvalue in assignment
grid.c:777: error: invalid lvalue in assignment
grid.c:790: error: invalid lvalue in assignment
grid.c:791: error: invalid lvalue in assignment
make[3]: *** [grid.lo] 错误 1
make[3]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/ext/control'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/ext'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3'
make: *** [all] 错误 2
source='grid.c' object='grid.lo' libtool=yes \
depfile='.deps/grid.Plo' tmpdepfile='.deps/grid.TPlo' \
depmode=gcc3 /bin/sh http://www.cnblogs.com/depcomp \
/bin/sh http://www.cnblogs.com/libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I./ -I../include -Ihttp://www.cnblogs.com/include -g -O2 -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c -o grid.lo `test -f 'grid.c' || echo './'`grid.c
rm -f .libs/grid.lo
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I./ -I../include -Ihttp://www.cnblogs.com/include -g -O2 -D__MINIGUI_LIB__ -D_REENTRANT -O2 -Wall -Wstrict-prototypes -pipe -DNDEBUG -c grid.c -MT grid.lo -MD -MP -MF .deps/grid.TPlo -fPIC -DPIC -o .libs/grid.lo
grid.c: In function 'AddCol':
grid.c:626: error: invalid lvalue in assignment
grid.c:627: error: invalid lvalue in assignment
grid.c:640: error: invalid lvalue in assignment
grid.c:641: error: invalid lvalue in assignment
grid.c:669: error: invalid lvalue in assignment
grid.c:670: error: invalid lvalue in assignment
grid.c:682: error: invalid lvalue in assignment
grid.c:683: error: invalid lvalue in assignment
grid.c: In function 'AddRow':
grid.c:735: error: invalid lvalue in assignment
grid.c:736: error: invalid lvalue in assignment
grid.c:747: error: invalid lvalue in assignment
grid.c:748: error: invalid lvalue in assignment
grid.c:776: error: invalid lvalue in assignment
grid.c:777: error: invalid lvalue in assignment
grid.c:790: error: invalid lvalue in assignment
grid.c:791: error: invalid lvalue in assignment
make[3]: *** [grid.lo] 错误 1
make[3]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/ext/control'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3/ext'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/source/minigui/minigui1.3.x/libminigui-1.3.3'
make: *** [all] 错误 2
出错原因:
从gcc 3.4.3开始,左值强制类型转换已经被移除了,在C和Objective-C中则是不赞成的用法。特别地,像下面的代码:
int i;
(char) i = 5;
或者
char *p;
((int *) p)++;
已经不在被C++接受,在以后的版本中也将不被C和Objective-C接受。
从gcc 3.4.3开始,左值强制类型转换已经被移除了,在C和Objective-C中则是不赞成的用法。特别地,像下面的代码:
int i;
(char) i = 5;
或者
char *p;
((int *) p)++;
已经不在被C++接受,在以后的版本中也将不被C和Objective-C接受。
解决方法如下:
将上面出错的grid.c文件中对应行数的强制转换去掉。例如grid.c:626、627行修改如下:
//(PGRIDCOLHDR)pCell1->pRowHdr = pRowHdr; // wmmwang 修改
//(PGRIDCOLHDR)pCell1->pColHdr = pCol1;
pCell1->pRowHdr = pRowHdr;
pCell1->pColHdr = pCol1;
其他出错行同上修改。
将上面出错的grid.c文件中对应行数的强制转换去掉。例如grid.c:626、627行修改如下:
//(PGRIDCOLHDR)pCell1->pRowHdr = pRowHdr; // wmmwang 修改
//(PGRIDCOLHDR)pCell1->pColHdr = pCol1;
pCell1->pRowHdr = pRowHdr;
pCell1->pColHdr = pCol1;
其他出错行同上修改。
(3)、编译mde-1.3.0出错:
/usr/local/include/minigui/filedlg.h:130: undefined reference to `OpenFileDialogEx'
/usr/local/include/minigui/filedlg.h:130: undefined reference to `OpenFileDialogEx'
具体错误如下:
source='main.c' object='main.o' libtool=no \
depfile='.deps/main.Po' tmpdepfile='.deps/main.TPo' \
depmode=gcc3 /bin/sh ../depcomp \
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"mde\" -DVERSION=\"1.3.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MINIGUI_COMMON_H=1 -DHAVE_DECL__LITE_VERSION=0 -DHAVE_DECL__STAND_ALONE=0 -DHAVE_DECL__USE_NEWGAL=0 -I. -I. -g -O2 -Wall -Wstrict-prototypes -pipe -D_REENTRANT -c `test -f 'main.c' || echo './'`main.c
gcc -g -O2 -Wall -Wstrict-prototypes -pipe -D_REENTRANT -o notebook main.o -lpng -ljpeg -lpthread -lminigui
main.o: In function `OpenFileDialog':
/usr/local/include/minigui/filedlg.h:130: undefined reference to `OpenFileDialogEx'
/usr/local/include/minigui/filedlg.h:130: undefined reference to `OpenFileDialogEx'
main.o: In function `SetWindowSize':
/home/source/minigui/minigui1.3.x/mde-1.3.0/notebook/main.c:524: undefined reference to `myWinEntries'
/usr/local/lib/libminigui.so: undefined reference to `pthread_kill_other_threads_np'
collect2: ld 返回 1
make[2]: *** [notebook] 错误 1
make[2]: Leaving directory `/home/source/minigui/minigui1.3.x/mde-1.3.0/notebook'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/source/minigui/minigui1.3.x/mde-1.3.0/notebook'
make: *** [all-recursive] 错误 1
source='main.c' object='main.o' libtool=no \
depfile='.deps/main.Po' tmpdepfile='.deps/main.TPo' \
depmode=gcc3 /bin/sh ../depcomp \
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"mde\" -DVERSION=\"1.3.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MINIGUI_COMMON_H=1 -DHAVE_DECL__LITE_VERSION=0 -DHAVE_DECL__STAND_ALONE=0 -DHAVE_DECL__USE_NEWGAL=0 -I. -I. -g -O2 -Wall -Wstrict-prototypes -pipe -D_REENTRANT -c `test -f 'main.c' || echo './'`main.c
gcc -g -O2 -Wall -Wstrict-prototypes -pipe -D_REENTRANT -o notebook main.o -lpng -ljpeg -lpthread -lminigui
main.o: In function `OpenFileDialog':
/usr/local/include/minigui/filedlg.h:130: undefined reference to `OpenFileDialogEx'
/usr/local/include/minigui/filedlg.h:130: undefined reference to `OpenFileDialogEx'
main.o: In function `SetWindowSize':
/home/source/minigui/minigui1.3.x/mde-1.3.0/notebook/main.c:524: undefined reference to `myWinEntries'
/usr/local/lib/libminigui.so: undefined reference to `pthread_kill_other_threads_np'
collect2: ld 返回 1
make[2]: *** [notebook] 错误 1
make[2]: Leaving directory `/home/source/minigui/minigui1.3.x/mde-1.3.0/notebook'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/home/source/minigui/minigui1.3.x/mde-1.3.0/notebook'
make: *** [all-recursive] 错误 1
出错原因:
1.3.3版本的minigui所使用的超线程库为旧的linuxpthreads,而我使用的环境为fedora core 7.0,其使用的超线程库为较新的NPTL2.6(可以使用getconf GNU_LIBPTHREAD_VERSION命令查看),在这个新的超线程库中,pthread_kill_other_threads_np这个函数已经不能使用。
1.3.3版本的minigui所使用的超线程库为旧的linuxpthreads,而我使用的环境为fedora core 7.0,其使用的超线程库为较新的NPTL2.6(可以使用getconf GNU_LIBPTHREAD_VERSION命令查看),在这个新的超线程库中,pthread_kill_other_threads_np这个函数已经不能使用。
解决方法如下:
修改src/kernel/init.c文件,将435行注释掉:
//pthread_kill_other_threads_np (); //wmmwang 修改
修改src/kernel/init.c文件,将435行注释掉:
//pthread_kill_other_threads_np (); //wmmwang 修改