msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.22k stars 1.19k forks source link

GIO issue: Segmentation fault #4411

Open songqingshan opened 5 years ago

songqingshan commented 5 years ago

User@shan MINGW64 /c/users/user/desktop/gtkapp/thread-g-msys2-3/build $ ./spawn Segmentation fault

under dos image_under_dos

under msys2 image_under_msys2

StarWolf3000 commented 5 years ago

What library are you using and what are you compiling?

songqingshan commented 5 years ago

Hello,

Thank you for your response.

I compile it with "gcc -o spawn spawn.c $(pkg-config --cflags --libs gtk+-3.0)". I believe that uses Glib. I attach one of spawn.c versions as follows. I have tried it in various versions, but the results almost are the same.

In addition, I compile other programs well which can not run in Msys2 Mingw64 . but those programs are compiled and run well in msys mingw64 many times. I use a makefile with Msys2 Mingw64 and msys mingw64 settings respectively to make programs.

I personally believe the issues are caused by GIO.

Your help is very important to me and others.

Thank you once again,

spawn.c:

include <gio/gio.h>

include

 

static void show_reslut()

{

g_print("show_reslut\n");

}

 

int main( int argc, char **argv )

{

GSubprocess *child_process = NULL;

GError **error;

const gchar *id;

GCancellable *cancellable;

 

/ Spawn child process /

do {

child_process = g_subprocess_new(G_SUBPROCESS_FLAGS_STDIN_INHERIT, error, "./helper");

g_print("0\n");

if (child_process==NULL) g_print("t\n");

} while (child_process==NULL);

 

g_print("1\n");

if (child_process==NULL) g_print("%s\n", *error);

g_print("2\n");

id = g_subprocess_get_identifier(child_process);

 

g_print("child_process id = %s\n", id);

 

g_subprocess_wait_async(child_process,cancellable,show_reslut, NULL );

g_subprocess_wait_finish(child_process,(GAsyncResult *)show_reslut,error);

 

g_subprocess_wait(child_process,cancellable,error);

 

if (g_subprocess_get_if_exited(child_process)) g_print("child_process normally exits!\n");

else g_print("child_process fails to exit!\n");

 

g_print("status: %d\n", g_subprocess_get_exit_status(child_process));

 

g_print("end...\n");

 

 

return( 0 );

}

helper.c:

/*

*/

include

include

 

 

int

main( int argc,

char **argv )

{

int i;

int num1=0;

int num2=0;

 

for( i = 0; i < 10; i++ )

{

char stdout_string[] = "Normal message no: .";

char stderr_string[] = "Error message no: .";

 

stdout_string[19] = '0' + i;

stderr_string[18] = '0' + i;

 

sleep( 1 );

num1 = fprintf( stdout, "%s\n", stdout_string );

printf( "num1 = %d\n", num1);

fflush(stdout);

sleep( 1 );

num2 = fprintf( stderr, "%s\n", stderr_string );

printf( "num2 = %d\n", num2);

fflush(stderr);

}

 

return( 0 );

}

 

 


From: StarWolf3000 notifications@github.com Sent: September 18, 2018 12:55 AM To: Alexpux/MINGW-packages Cc: songqingshan; Author Subject: Re: [Alexpux/MINGW-packages] GIO issue: Segmentation fault (#4411)

What library are you using and what are you compiling?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Alexpux/MINGW-packages/issues/4411#issuecomment-422264372, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ApTBU3pVzG_U4PBfQVJ9upr1zOWLxXdFks5ucIrAgaJpZM4WqjTg.

songqingshan commented 5 years ago

Hello,

I am wondering how this issue is going? Is there any progress?

FYI

Another program is compiled and run well in msys mingw64. it runs well in dos as well. It is recompiled well in msys2 mingw64, but following errors appear when running in msys2 mingw64.

css dir: -------C:\users\user\desktop\bao\appwin\build\css\baostyle.css

 

(bao.exe:5400): Gtk-CRITICAL **: 09:00:50.341: Error building template class 'BaoAppWindow' for an instance of type 'BaoAppWindow': .:561:36 attribute 'name' invalid for element 'style'

 

(bao.exe:5400): GLib-GIO-CRITICAL **: 09:00:50.450: g_settings_bind_with_mapping: assertion 'G_IS_OBJECT (object)' failed

 

(bao.exe:5400): GLib-GIO-CRITICAL **: 09:00:50.450: g_settings_bind_with_mapping: assertion 'G_IS_OBJECT (object)' failed

 

(bao.exe:5400): GLib-GIO-CRITICAL **: 09:00:50.450: g_settings_bind_with_mapping: assertion 'G_IS_OBJECT (object)' failed

 

(bao.exe:5400): GLib-GIO-CRITICAL **: 09:00:50.450: g_settings_bind_with_mapping: assertion 'G_IS_OBJECT (object)' failed

 

(bao.exe:5400): GLib-GIO-CRITICAL **: 09:00:50.450: g_settings_bind_with_mapping: assertion 'G_IS_OBJECT (object)' failed

 

(bao.exe:5400): GLib-GObject-WARNING **: 09:00:50.450: invalid (NULL) pointer instance

 

(bao.exe:5400): GLib-GObject-CRITICAL **: 09:00:50.450: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

 

(bao.exe:5400): GLib-GObject-WARNING **: 09:00:50.450: invalid (NULL) pointer instance

 

(bao.exe:5400): GLib-GObject-CRITICAL **: 09:00:50.450: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

 

(bao.exe:5400): GLib-GObject-WARNING **: 09:00:50.450: invalid (NULL) pointer instance

 

(bao.exe:5400): GLib-GObject-CRITICAL **: 09:00:50.450: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

 

(bao.exe:5400): GLib-GObject-WARNING **: 09:00:50.450: invalid (NULL) pointer instance

 

(bao.exe:5400): GLib-GObject-CRITICAL **: 09:00:50.450: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

window--initial-ends

app--activate ends

when it runs in dos.

error message:

"The procedure entry point g_subprocess_get_successful could not be located in the dynamic link library

c:\users\user\desktop....

"

I believe it is a critical issue. Your help is appreciated.

Thanks,

Song


From: StarWolf3000 notifications@github.com Sent: September 18, 2018 12:55 AM To: Alexpux/MINGW-packages Cc: songqingshan; Author Subject: Re: [Alexpux/MINGW-packages] GIO issue: Segmentation fault (#4411)

What library are you using and what are you compiling?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Alexpux/MINGW-packages/issues/4411#issuecomment-422264372, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ApTBU3pVzG_U4PBfQVJ9upr1zOWLxXdFks5ucIrAgaJpZM4WqjTg.