kernelhcy / gtkqq

a qq client based on gtk+ uses webqq protocol
http://code.google.com/p/gtk-qq/
GNU General Public License v3.0
181 stars 42 forks source link

刚尝试了一下,ubuntu12.04 还是无法编译 #86

Closed billzt closed 12 years ago

billzt commented 12 years ago

qqtypes.c: In function 'qq_info_new': qqtypes.c:26:5: error: 'g_mutex_new' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:271) [-Werror=deprecated-declarations] qqtypes.c: In function 'qq_info_free': qqtypes.c:95:5: error: 'g_mutex_free' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:273) [-Werror=deprecated-declarations] cc1: all warnings being treated as errors

https://github.com/kernelhcy/gtkqq/issues/39 是一个情况

ekd123 commented 12 years ago

暂时先把-Werror去掉吧

ekd123 commented 12 years ago

刚把code patch完发现clone错了branch。。。等等我把code重改一遍。。。

ekd123 commented 12 years ago

请测试吧!

billzt commented 12 years ago

@ekd123 谢谢,明天再测了

billzt commented 12 years ago

@ekd123 对不起,还是有错误:

qqtypes.c: In function 'qq_info_new': qqtypes.c:27:5: error: incompatible type for argument 1 of 'g_mutex_init' /usr/include/glib-2.0/glib/gthread.h:155:17: note: expected 'union GMutex ' but argument is of type 'GMutex' qqtypes.c: In function 'qq_info_free': qqtypes.c:101:5: error: incompatible type for argument 1 of 'g_mutex_clear' /usr/include/glib-2.0/glib/gthread.h:156:17: note: expected 'union GMutex ' but argument is of type 'GMutex'

ekd123 commented 12 years ago

@billzt 呃,搞错了类型似乎。等等我看看

ekd123 commented 12 years ago

@billzt 再试下吧

billzt commented 12 years ago

@ekd123 谢谢!刚试了一下,qqtype.c 已经没有问题了,但其他地方还有问题: qqinit.c: In function 'qq_init': qqinit.c:10:9: error: 'g_thread_init' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:259) [-Werror=deprecated-declarations] cc1: all warnings being treated as errors

billzt commented 12 years ago

@ekd123 你先把那个 pull request 撤下来,全部改好之后再 request 吧。另外把 GLIB_CHECK_VERSION(2,32,0) 改成 2.31.0 吧!高于2.31.0版的都应该执行新的函数

ekd123 commented 12 years ago

@billzt 我没有环境,都是看着文档改的。。所以说能不能改完还等着你的报告呢。你用 make -k 把所有错误都弄出来吧

billzt commented 12 years ago

@ekd123 改一点是一点吧

billzt commented 12 years ago

@ekd123 我用 make -k 试试看!

billzt commented 12 years ago

@ekd123 好了,错误应该全部出来了

qqinit.c: In function 'qq_init': qqinit.c:10:9: error: 'g_thread_init' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:259) [-Werror=deprecated-declarations] cc1: all warnings being treated as errors make[3]: *\ [libwebqq_la-qqinit.lo] 错误 1

qqpoll.c: In function 'qq_start_poll': qqpoll.c:390:9: error: 'g_thread_init' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:259) [-Werror=deprecated-declarations] qqpoll.c:392:5: error: 'g_mutex_new' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:271) [-Werror=deprecated-declarations] qqpoll.c:400:5: error: 'g_thread_create' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:100): Use 'g_thread_new' instead [-Werror=deprecated-declarations] qqpoll.c: In function 'qq_stop_poll': qqpoll.c:417:5: error: 'g_mutex_free' is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:273) [-Werror=deprecated-declarations] cc1: all warnings being treated as errors make[3]: *\ [libwebqq_la-qqpoll.lo] 错误 1

qqutils.c: In function 'save_img_to_file': qqutils.c:77:5: error: 'g_io_channel_close' is deprecated (declared at /usr/include/glib-2.0/glib/giochannel.h:194): Use 'g_io_channel_shutdown' instead [-Werror=deprecated-declarations] cc1: all warnings being treated as errors make[3]: *\ [libwebqq_la-qqutils.lo] 错误 1

msgloop.c: 在函数‘gqq_msgloop_start’中: msgloop.c:54:5: 错误: 不建议使用‘g_thread_create’(声明于 /usr/include/glib-2.0/glib/deprecated/gthread.h:100):Use 'g_thread_new' instead [-Werror=deprecated-declarations] cc1: all warnings being treated as errors make[4]: *\ [msgloop.o] 错误 1

loginpanel.c: 在函数‘update_buddy_qq_number’中: loginpanel.c:676:5: 错误: 不建议使用‘g_thread_init’(声明于 /usr/include/glib-2.0/glib/deprecated/gthread.h:259) [-Werror=deprecated-declarations] loginpanel.c: 在函数‘update_face_image’中: loginpanel.c:768:5: 错误: 不建议使用‘g_thread_init’(声明于 /usr/include/glib-2.0/glib/deprecated/gthread.h:259) [-Werror=deprecated-declarations] cc1: all warnings being treated as errors make[4]: *\ [loginpanel.o] 错误 1

gqqconfig.c: 在函数‘gqq_config_init’中: gqqconfig.c:288:5: 错误: 不建议使用‘g_mutex_new’(声明于 /usr/include/glib-2.0/glib/deprecated/gthread.h:271) [-Werror=deprecated-declarations] gqqconfig.c: 在函数‘gqq_config_finalize’中: gqqconfig.c:406:5: 错误: 不建议使用‘g_mutex_free’(声明于 /usr/include/glib-2.0/glib/deprecated/gthread.h:273) [-Werror=deprecated-declarations] cc1: all warnings being treated as errors make[4]: *\ [gqqconfig.o] 错误 1

ekd123 commented 12 years ago

@billzt 好多。。。我去看看吧。

billzt commented 12 years ago

@ekd123 为了防止有遗漏,我往你邮箱发了一封邮件,里面记录的 make -k 的全部信息,可以看看

ekd123 commented 12 years ago

@billzt 好了,你先用我这个fork的试试,等好了我再pull request。

billzt commented 12 years ago

@ekd123 好,我试试看了

billzt commented 12 years ago

@ekd123 在测试之前还有件事麻烦下:你把所有的 GLIB_CHECK_VERSION(2,32,0) 改成 2.31.0 吧!我刚 grep 了一下,很多,自己不方便改

ekd123 commented 12 years ago

@billzt 其实不是2.31.0,这些接口都是在 2.32.0 被标记过时的。http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html

billzt commented 12 years ago

@ekd123 必须改。2.31 和2.32是同一回事,这些接口已经被抛弃了。只不过现在 Ubuntu 12.04 使用的是2.31,以后正式发布时会更新到2.32.

2.31 就是 2.32 的预览版啊,如果不改一下,我现在还是没法通过编译,因为代码还是会执行 g_mutex_new(2.31<2.32嘛),结果就失败了,我刚刚试过了

ekd123 commented 12 years ago

……嘛,太多了改起来太麻烦。现在有点事暂时搞不了这个了,你自己改改吧。我先发个pull request。

billzt commented 12 years ago

@ekd123 也行,我自己试试

billzt commented 12 years ago

@ekd123 @wxjeacen 还有最后一个问题吧:

qqutils.c: In function 'save_img_to_file': qqutils.c:78:5: error: too few arguments to function 'g_io_channel_shutdown' /usr/include/glib-2.0/glib/giochannel.h:196:11: note: declared here make[3]: *\ [libwebqq_la-qqutils.lo] 错误 1

g_io_channel_shutdown() 需要三个参数 g_io_channel_shutdown (GIOChannel _channel, gboolean flush, GError *_err);

另外src/gui/msgloop.c有一处语法错误:

 ml -> name = g_strdup(name);

 GError *err = NULL;

+#if GLIB_CHECK_VERSION(2,32,0)

+#else

+#endif

第56行末尾的分号应该去掉。

我自己修改之后,可以通过编译。但运行时发生段错误: $ gtkqq -d

MESSAGE : gthread auto initialized. (qqinit.c, 19) GLib-GObject-WARNING **: g_object_new_valist: object class GQQConfig' has no property namedqqinit.c' DEBUG : Open db connection to /home/bill/.gtkqq/gtkqq.db (dao.c, 168) Last datebase version is 1002. (dao.c, 84) DEBUG : GQQConfig setter: info (gqqconfig.c, 159) 段错误 (核心已转储)

shwangdev commented 12 years ago

把core dump发给我看看,或者把运行 gdb gtkqq core.xxx,把断点信息发上来。 2012/2/24 billzt < reply@reply.github.com

@ekd123 @wxjeacen 还有最后一个问题吧:

qqutils.c: In function 'save_img_to_file': qqutils.c:78:5: error: too few arguments to function 'g_io_channel_shutdown' /usr/include/glib-2.0/glib/giochannel.h:196:11: note: declared here make[3]: *\ [libwebqq_la-qqutils.lo] 错误 1

g_io_channel_shutdown() 需要三个参数 g_io_channel_shutdown (GIOChannel _channel, gboolean flush, GError *_err);

另外src/gui/msgloop.c有一处语法错误:

ml -> name = g_strdup(name);

GError *err = NULL;
  • if(g_thread_create(thread_main, ml, FALSE, &err) == NULL){
  • if(

+#if GLIB_CHECK_VERSION(2,32,0)

  • g_thread_new("", thread_main, NULL);

+#else

  • g_thread_create(thread_main, ml, FALSE, &err)

+#endif

  •  == NULL){
    
    g_warning("Create main loop thread failed... %s (%s, %d)"
    
                          , err -> message, __FILE__, __LINE__);
    
    g_error_free(err);

第56行末尾的分号应该去掉。

我自己修改之后,可以通过编译。但运行时发生段错误: $ gtkqq -d

MESSAGE : gthread auto initialized. (qqinit.c, 19) GLib-GObject-WARNING **: g_object_new_valist: object class GQQConfig' has no property namedqqinit.c' DEBUG : Open db connection to /home/bill/.gtkqq/gtkqq.db (dao.c, 168) Last datebase version is 1002. (dao.c, 84) DEBUG : GQQConfig setter: info (gqqconfig.c, 159) 段错误 (核心已转储)


Reply to this email directly or view it on GitHub: https://github.com/kernelhcy/gtkqq/issues/86#issuecomment-4152915

billzt commented 12 years ago

@ekd123 @wxjeacen

bill@VirtualBox:~$ gdb /usr/bin/gtkqq core GNU gdb (Ubuntu/Linaro 7.4-0ubuntu1) 7.4 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /usr/bin/gtkqq...done. [New LWP 15838] [New LWP 15837] [New LWP 15836] [New LWP 15835]

warning: Can't read pathname for load map: 输入/输出错误. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". Core was generated by `gtkqq'. Program terminated with signal 11, Segmentation fault.

0 thread_main (data=0x0) at msgloop.c:22

22 ml -> ctx = g_main_context_new(); (gdb) bt

0 thread_main (data=0x0) at msgloop.c:22

1 0x00504453 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0

2 0x003e6d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0

3 0x00baf76e in clone () from /lib/i386-linux-gnu/libc.so.6

(gdb)

这样子够吗?

shwangdev commented 12 years ago

看不出来是哪里的问题。。

你能always 重现?

billzt commented 12 years ago

@wxjeacen 可以重现,我已经重现三次了。当然地址会不大一样,比如:

(gdb) r Starting program: /usr/bin/gtkqq [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".

MESSAGE : gthread auto initialized. (qqinit.c, 19)

GLib-GObject-WARNING **: g_object_new_valist: object class GQQConfig' has no property namedqqinit.c' Last datebase version is 1002. (dao.c, 84) [New Thread 0xb7c11b40 (LWP 8143)] [New Thread 0xb7410b40 (LWP 8144)] [New Thread 0xb6affb40 (LWP 8145)]

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb6affb40 (LWP 8145)] thread_main (data=0x0) at msgloop.c:22 22 ml -> ctx = g_main_context_new(); (gdb) bt

0 thread_main (data=0x0) at msgloop.c:22

1 0x009f4453 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0

2 0x00a88d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0

3 0x00b8676e in clone () from /lib/i386-linux-gnu/libc.so.6

ekd123 commented 12 years ago

@wxjeacen @billzt

https://github.com/kernelhcy/gtkqq/blob/dev/src/gui/gqqconfig.c#L104

应该是 GQQConfig *cfg = (GQQConfig*)g_object_new(GQQ_TYPE_CONFIG, "info", info, NULL);

这句少了个 NULL,否则会一直解析下去。参见 GObject Reference Manual。那个 GObject-Warning 是这个原因了。另外,SEGV 可能是我用的 g_thread_new 不对,我是直接改成了相对应的无 user_data 版。。。所以 https://github.com/kernelhcy/gtkqq/blob/dev/src/gui/msgloop.c#L17 那个 data 其实是 NULL。。所以开 100 次重现 100 次。

所以 https://github.com/kernelhcy/gtkqq/blob/dev/src/gui/msgloop.c#L56 应该改成 g_thread_new("", thread_main, ml);。试试吧。

(我把我的 fork 删掉了。。所以没法 Pull Request 了。。。)

billzt commented 12 years ago

@ekd123 fork 删掉可以接着 fork 的,我就删了好几次又恢复了好几次~

ekd123 commented 12 years ago

@billzt 其实是我太懒了。。。而且github在我这里速度相当慢。。。上次又一不小心把整个目录清空了。。 你可以自己试试改改~

billzt commented 12 years ago

@ekd123 行,我去试试吧!

billzt commented 12 years ago

@ekd123 按照你的修改之后,程序可以启动。但登陆过程中又段错误了:

MESSAGE : gthread auto initialized. (qqinit.c, 19) Last datebase version is 1002. (dao.c, 84) [New Thread 0xb7c11b40 (LWP 8209)] [New Thread 0xb7410b40 (LWP 8210)] [New Thread 0xb6affb40 (LWP 8211)] [New Thread 0xb60ffb40 (LWP 8212)] [New Thread 0xb58feb40 (LWP 8213)] [New Thread 0xb4b4cb40 (LWP 8216)]

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb4b4cb40 (LWP 8216)] do_poll (data=0x0) at qqpoll.c:279 279 QQInfo *info = par -> info; (gdb) bt

0 do_poll (data=0x0) at qqpoll.c:279

1 0x009f4453 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0

2 0x00a88d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0

3 0x00b8676e in clone () from /lib/i386-linux-gnu/libc.so.6

shwangdev commented 12 years ago

看上去似乎有内存溢出。 2012/2/26 billzt < reply@reply.github.com

@ekd123 按照你的修改之后,程序可以启动。但登陆过程中又段错误了:

MESSAGE : gthread auto initialized. (qqinit.c, 19) Last datebase version is 1002. (dao.c, 84) [New Thread 0xb7c11b40 (LWP 8209)] [New Thread 0xb7410b40 (LWP 8210)] [New Thread 0xb6affb40 (LWP 8211)] [New Thread 0xb60ffb40 (LWP 8212)] [New Thread 0xb58feb40 (LWP 8213)] [New Thread 0xb4b4cb40 (LWP 8216)]

Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb4b4cb40 (LWP 8216)] do_poll (data=0x0) at qqpoll.c:279 279 QQInfo *info = par -> info; (gdb) bt

0 do_poll (data=0x0) at qqpoll.c:279

1 0x009f4453 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0

2 0x00a88d4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0

3 0x00b8676e in clone () from /lib/i386-linux-gnu/libc.so.6


Reply to this email directly or view it on GitHub: https://github.com/kernelhcy/gtkqq/issues/86#issuecomment-4178532

ekd123 commented 12 years ago

@billzt @wxjeacen 我错了。。我又改掉了一个 user_data。。。https://github.com/kernelhcy/gtkqq/blob/dev/src/libqq/qqpoll.c#L411 应为 GThread *thread = g_thread_new("", do_poll, par);

billzt commented 12 years ago

@ekd123 好,现在基本上没有问题了