Compiling Protocol-Plugin c++ (MinGW)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling Protocol-Plugin c++ (MinGW)

Farc
Hello,

I'm currently developing a protocol-plugin for plugin with c++. But I'm
struggling with MinGW under Windows 7 (There are no problems on Debian 8
and g++). Compiling works fine and it runs without crashes, but it
crashes pidgin when it's exiting.

These are the last lines of output from GDB:

(01:49:33) wpurple: wpurple_cleanup
(01:49:33) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

Without GDB Windows 7(64bit) presents an error message.

I thought it might have something to do with my code. So I reduced my
plugin to really simple block of code which is just needed by pidgin to
be recognized as a protocol plugin. And the same happens when exiting.
But if I compile it in c-mode (I've tried alot of stuff...) pidgin exits
normal without crashing.

Hopefully someone can help me. Thx

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling Protocol-Plugin c++ (MinGW)

Eion Robb-3
Hi there,

I've seen something similar happen with the LINE plugin, which is also written in C++.  It looked like the C++ engine was freeing the memory when the plugin_unload() function was called and the main LINE object destructor was called.

Is your code online somewhere that I can have a play with and attach a few debuggers to?  Do you also have some backtraces of where it's crashing?  It'd be great to see if its dying in the same place.

Cheers,
Eion

On 21 October 2016 at 07:21, Farc <[hidden email]> wrote:
Hello,

I'm currently developing a protocol-plugin for plugin with c++. But I'm struggling with MinGW under Windows 7 (There are no problems on Debian 8 and g++). Compiling works fine and it runs without crashes, but it crashes pidgin when it's exiting.

These are the last lines of output from GDB:

(01:49:33) wpurple: wpurple_cleanup
(01:49:33) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

Without GDB Windows 7(64bit) presents an error message.

I thought it might have something to do with my code. So I reduced my plugin to really simple block of code which is just needed by pidgin to be recognized as a protocol plugin. And the same happens when exiting. But if I compile it in c-mode (I've tried alot of stuff...) pidgin exits normal without crashing.

Hopefully someone can help me. Thx

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel


_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling Protocol-Plugin c++ (MinGW)

Farc

Hey,

I didn't uploaded the source of my plugin yet. I have to clean up the code first (some password-stuff and so on), I might be able to do it tomorrow. But I can show you the reduced cpp I've written which causes excactly the same issue. You can find it here: http://pastebin.com/WbNy1nMr
When I compile it with gcc in c-mode it works fine, but with g++ it causes the described issue.

Here is the backtrace after the first 2 "warnings":
(22:18:07) wpurple: wpurple_cleanup
(22:18:08) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

[New Thread 2620.0xf78]

Program received signal SIGINT, Interrupt.
[Switching to Thread 2620.0xf78]
0x74fa7577 in KERNEL32!CtrlRoutine () from C:\Windows\syswow64\kernel32.dll
(gdb) bt full
#0  0x74fa7577 in KERNEL32!CtrlRoutine ()
   from C:\Windows\syswow64\kernel32.dll
No symbol table info available.
#1  0x5f9fd79a in ?? ()
No symbol table info available.
#2  0x00000000 in ?? ()
No symbol table info available.
(gdb)

After the next 2 "warnings" it ends with code 03.

Best regards,
Farc


Am 20.10.2016 um 21:57 schrieb Eion Robb:
Hi there,

I've seen something similar happen with the LINE plugin, which is also written in C++.  It looked like the C++ engine was freeing the memory when the plugin_unload() function was called and the main LINE object destructor was called.

Is your code online somewhere that I can have a play with and attach a few debuggers to?  Do you also have some backtraces of where it's crashing?  It'd be great to see if its dying in the same place.

Cheers,
Eion

On 21 October 2016 at 07:21, Farc <[hidden email]> wrote:
Hello,

I'm currently developing a protocol-plugin for plugin with c++. But I'm struggling with MinGW under Windows 7 (There are no problems on Debian 8 and g++). Compiling works fine and it runs without crashes, but it crashes pidgin when it's exiting.

These are the last lines of output from GDB:

(01:49:33) wpurple: wpurple_cleanup
(01:49:33) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

Without GDB Windows 7(64bit) presents an error message.

I thought it might have something to do with my code. So I reduced my plugin to really simple block of code which is just needed by pidgin to be recognized as a protocol plugin. And the same happens when exiting. But if I compile it in c-mode (I've tried alot of stuff...) pidgin exits normal without crashing.

Hopefully someone can help me. Thx

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel



_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling Protocol-Plugin c++ (MinGW)

Eion Robb-3
SIGINT isn't really a useful thing to backtrace on, the Pidgin.rpt in %appdata%\.purple might be more helpful

I'm also surprised to see the lack of plugin_load and plugin_unload functions.  Maybe once you have your actual source online we can give comment to what's going on. :)

You can also look at some other c++ based prpls to see if there's anything there that might help:
http://altrepo.eu/git/purple-line/blob/master/libpurple/pluginmain.cpp

(although the LINE one is probably better to base things on as they actually know C++ and i was just muddling my way through with skypekit/opensteamworks :D )

On 21 October 2016 at 09:25, Farc <[hidden email]> wrote:

Hey,

I didn't uploaded the source of my plugin yet. I have to clean up the code first (some password-stuff and so on), I might be able to do it tomorrow. But I can show you the reduced cpp I've written which causes excactly the same issue. You can find it here: http://pastebin.com/WbNy1nMr
When I compile it with gcc in c-mode it works fine, but with g++ it causes the described issue.

Here is the backtrace after the first 2 "warnings":
(22:18:07) wpurple: wpurple_cleanup
(22:18:08) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

[New Thread 2620.0xf78]

Program received signal SIGINT, Interrupt.
[Switching to Thread 2620.0xf78]
0x74fa7577 in KERNEL32!CtrlRoutine () from C:\Windows\syswow64\kernel32.dll
(gdb) bt full
#0  0x74fa7577 in KERNEL32!CtrlRoutine ()
   from C:\Windows\syswow64\kernel32.dll
No symbol table info available.
#1  0x5f9fd79a in ?? ()
No symbol table info available.
#2  0x00000000 in ?? ()
No symbol table info available.
(gdb)

After the next 2 "warnings" it ends with code 03.

Best regards,
Farc



Am 20.10.2016 um 21:57 schrieb Eion Robb:
Hi there,

I've seen something similar happen with the LINE plugin, which is also written in C++.  It looked like the C++ engine was freeing the memory when the plugin_unload() function was called and the main LINE object destructor was called.

Is your code online somewhere that I can have a play with and attach a few debuggers to?  Do you also have some backtraces of where it's crashing?  It'd be great to see if its dying in the same place.

Cheers,
Eion

On 21 October 2016 at 07:21, Farc <[hidden email]> wrote:
Hello,

I'm currently developing a protocol-plugin for plugin with c++. But I'm struggling with MinGW under Windows 7 (There are no problems on Debian 8 and g++). Compiling works fine and it runs without crashes, but it crashes pidgin when it's exiting.

These are the last lines of output from GDB:

(01:49:33) wpurple: wpurple_cleanup
(01:49:33) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

Without GDB Windows 7(64bit) presents an error message.

I thought it might have something to do with my code. So I reduced my plugin to really simple block of code which is just needed by pidgin to be recognized as a protocol plugin. And the same happens when exiting. But if I compile it in c-mode (I've tried alot of stuff...) pidgin exits normal without crashing.

Hopefully someone can help me. Thx

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel




_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling Protocol-Plugin c++ (MinGW)

Farc
Yes you are probably right about the SIGINT. Problem is that no report is generated. (Yes I've installed the debugging symbols) :( Maybe because it crashes so late?

I've removed plugin_load an _unload if they are causing the issue. As I said I've removed like anything to this simple file and it still crashes pidgin on exit.

I've also thought that maybe something is wrong with my setup of mingw. But since c-plugins are compiling fine I thought it might be something else.

Thx for the links, the hint to the LINE plugin and the help for now.
Give me a day to upload the code. I'll notice you as soon as it's uploaded. :)

Am 20.10.2016 um 22:53 schrieb Eion Robb:
SIGINT isn't really a useful thing to backtrace on, the Pidgin.rpt in %appdata%\.purple might be more helpful

I'm also surprised to see the lack of plugin_load and plugin_unload functions.  Maybe once you have your actual source online we can give comment to what's going on. :)

You can also look at some other c++ based prpls to see if there's anything there that might help:
http://altrepo.eu/git/purple-line/blob/master/libpurple/pluginmain.cpp

(although the LINE one is probably better to base things on as they actually know C++ and i was just muddling my way through with skypekit/opensteamworks :D )

On 21 October 2016 at 09:25, Farc <[hidden email]> wrote:

Hey,

I didn't uploaded the source of my plugin yet. I have to clean up the code first (some password-stuff and so on), I might be able to do it tomorrow. But I can show you the reduced cpp I've written which causes excactly the same issue. You can find it here: http://pastebin.com/WbNy1nMr
When I compile it with gcc in c-mode it works fine, but with g++ it causes the described issue.

Here is the backtrace after the first 2 "warnings":
(22:18:07) wpurple: wpurple_cleanup
(22:18:08) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

[New Thread 2620.0xf78]

Program received signal SIGINT, Interrupt.
[Switching to Thread 2620.0xf78]
0x74fa7577 in KERNEL32!CtrlRoutine () from C:\Windows\syswow64\kernel32.dll
(gdb) bt full
#0  0x74fa7577 in KERNEL32!CtrlRoutine ()
   from C:\Windows\syswow64\kernel32.dll
No symbol table info available.
#1  0x5f9fd79a in ?? ()
No symbol table info available.
#2  0x00000000 in ?? ()
No symbol table info available.
(gdb)

After the next 2 "warnings" it ends with code 03.

Best regards,
Farc



Am 20.10.2016 um 21:57 schrieb Eion Robb:
Hi there,

I've seen something similar happen with the LINE plugin, which is also written in C++.  It looked like the C++ engine was freeing the memory when the plugin_unload() function was called and the main LINE object destructor was called.

Is your code online somewhere that I can have a play with and attach a few debuggers to?  Do you also have some backtraces of where it's crashing?  It'd be great to see if its dying in the same place.

Cheers,
Eion

On 21 October 2016 at 07:21, Farc <[hidden email]> wrote:
Hello,

I'm currently developing a protocol-plugin for plugin with c++. But I'm struggling with MinGW under Windows 7 (There are no problems on Debian 8 and g++). Compiling works fine and it runs without crashes, but it crashes pidgin when it's exiting.

These are the last lines of output from GDB:

(01:49:33) wpurple: wpurple_cleanup
(01:49:33) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

Without GDB Windows 7(64bit) presents an error message.

I thought it might have something to do with my code. So I reduced my plugin to really simple block of code which is just needed by pidgin to be recognized as a protocol plugin. And the same happens when exiting. But if I compile it in c-mode (I've tried alot of stuff...) pidgin exits normal without crashing.

Hopefully someone can help me. Thx

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel





_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling Protocol-Plugin c++ (MinGW)

Farc
In reply to this post by Eion Robb-3

I've uploaded the source to github: https://github.com/farcdev/spinp

The build in mingw will need a static library of libcurl with ssl/tls support, but it is pretty easy to build one.

I've build it with:

./configure --prefix=/mingw --enable-static=yes --enable-shared=no --disable-ldap --with-winssl && make && make install

I hope you can reproduce the issue. Feel free to ask anything. :)

Am 20.10.2016 um 22:53 schrieb Eion Robb:
SIGINT isn't really a useful thing to backtrace on, the Pidgin.rpt in %appdata%\.purple might be more helpful

I'm also surprised to see the lack of plugin_load and plugin_unload functions.  Maybe once you have your actual source online we can give comment to what's going on. :)

You can also look at some other c++ based prpls to see if there's anything there that might help:
http://altrepo.eu/git/purple-line/blob/master/libpurple/pluginmain.cpp

(although the LINE one is probably better to base things on as they actually know C++ and i was just muddling my way through with skypekit/opensteamworks :D )

On 21 October 2016 at 09:25, Farc <[hidden email]> wrote:

Hey,

I didn't uploaded the source of my plugin yet. I have to clean up the code first (some password-stuff and so on), I might be able to do it tomorrow. But I can show you the reduced cpp I've written which causes excactly the same issue. You can find it here: http://pastebin.com/WbNy1nMr
When I compile it with gcc in c-mode it works fine, but with g++ it causes the described issue.

Here is the backtrace after the first 2 "warnings":
(22:18:07) wpurple: wpurple_cleanup
(22:18:08) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

[New Thread 2620.0xf78]

Program received signal SIGINT, Interrupt.
[Switching to Thread 2620.0xf78]
0x74fa7577 in KERNEL32!CtrlRoutine () from C:\Windows\syswow64\kernel32.dll
(gdb) bt full
#0  0x74fa7577 in KERNEL32!CtrlRoutine ()
   from C:\Windows\syswow64\kernel32.dll
No symbol table info available.
#1  0x5f9fd79a in ?? ()
No symbol table info available.
#2  0x00000000 in ?? ()
No symbol table info available.
(gdb)

After the next 2 "warnings" it ends with code 03.

Best regards,
Farc



Am 20.10.2016 um 21:57 schrieb Eion Robb:
Hi there,

I've seen something similar happen with the LINE plugin, which is also written in C++.  It looked like the C++ engine was freeing the memory when the plugin_unload() function was called and the main LINE object destructor was called.

Is your code online somewhere that I can have a play with and attach a few debuggers to?  Do you also have some backtraces of where it's crashing?  It'd be great to see if its dying in the same place.

Cheers,
Eion

On 21 October 2016 at 07:21, Farc <[hidden email]> wrote:
Hello,

I'm currently developing a protocol-plugin for plugin with c++. But I'm struggling with MinGW under Windows 7 (There are no problems on Debian 8 and g++). Compiling works fine and it runs without crashes, but it crashes pidgin when it's exiting.

These are the last lines of output from GDB:

(01:49:33) wpurple: wpurple_cleanup
(01:49:33) winpidgin: winpidgin_cleanup
warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

Without GDB Windows 7(64bit) presents an error message.

I thought it might have something to do with my code. So I reduced my plugin to really simple block of code which is just needed by pidgin to be recognized as a protocol plugin. And the same happens when exiting. But if I compile it in c-mode (I've tried alot of stuff...) pidgin exits normal without crashing.

Hopefully someone can help me. Thx

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel





_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling Protocol-Plugin c++ (MinGW)

Ethan Blanton-3
Farc wrote:
> I've uploaded the source to github: https://github.com/farcdev/spinp

I know this is an ancient thread, but I'm just getting to it.

You're doing all kinds of illegal runtime stuff.  Every single symbol
that you put into spinp_protocol_info needs to be extern "C".  This is
probably why your plugin is crashing.

Ethan

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling Protocol-Plugin c++ (MinGW)

Farc
Hello,

thx for the reply, but I've already tested that.

The problem seems to be with my configuration and/or Pidgin/Windows
handling dll files compiled with c++.

I'm testing under Windows 7 (running within a vm) and it crashes there
on exiting when Pidgin calls  the DestroyWindow-function in
gtkwin32dep.c:440.

On Windows 10 it does not happen. It looks like it doesn't have that
issue. But still, when you are starting Pidgin from command-line it will
not return to the command-line after exiting Pidgin.

I've tested that with another plugin written in c++ and it has exactly
the same issue, as much as my mini-plugin (the one posted on pastebin ->
http://pastebin.com/WbNy1nMr) I've written to show the bug.

Best regards,

farci



Am 10.11.2016 um 20:17 schrieb Ethan Blanton:
> Farc wrote:
>> I've uploaded the source to github: https://github.com/farcdev/spinp
> I know this is an ancient thread, but I'm just getting to it.
>
> You're doing all kinds of illegal runtime stuff.  Every single symbol
> that you put into spinp_protocol_info needs to be extern "C".  This is
> probably why your plugin is crashing.
>
> Ethan

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel
Reply | Threaded
Open this post in threaded view
|

Re: Compiling Protocol-Plugin c++ (MinGW)

Richard Laager
On 11/12/2016 04:11 AM, Farc wrote:
> I've tested that with another plugin written in c++ and it has exactly
> the same issue, as much as my mini-plugin (the one posted on pastebin ->
> http://pastebin.com/WbNy1nMr) I've written to show the bug.

Have you tried with the extern "C" around the functions too?

--
Richard

_______________________________________________
Devel mailing list
[hidden email]
https://pidgin.im/cgi-bin/mailman/listinfo/devel