Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtkbuilder and Mac OS X #18

Closed
vmagnin opened this issue Apr 18, 2011 · 15 comments
Closed

gtkbuilder and Mac OS X #18

vmagnin opened this issue Apr 18, 2011 · 15 comments
Assignees

Comments

@vmagnin
Copy link
Owner

vmagnin commented Apr 18, 2011

Paul F. built gtk-fortran on a MacBook Pro with a Core2Duo running the latest MacOSX 10.6.7
(Darwin 10.7.0 on x86_64), gtk 2.24.4 quartz version as well as gfortran 4.6 using macports. You can see some screenshots on the wiki.

The only problems are that gtkbuilder did not launch properly (he killed it after 5 minutes), and issued two
messages:

(gtkbuilder.f90.out:1578): Gtk-CRITICAL **: gtk_builder_add_from_file: assertion
`error == NULL || *error == NULL' failed
(gtkbuilder.f90.out:1578): Gtk-CRITICAL **: gtk_widget_show: assertion
`GTK_IS_WIDGET (widget)' failed

Same for gtkbuilder2:

(gtkbuilder2.f90.out:1601): Gtk-CRITICAL **: gtk_builder_add_from_file:
assertion `error == NULL || *error == NULL' failed
(gtkbuilder2.f90.out:1601): Gtk-CRITICAL **: gtk_widget_show: assertion
`GTK_IS_WIDGET (widget)' failed

They were launched from the examples/ directory.
Any idea ?

@vmagnin
Copy link
Owner Author

vmagnin commented Apr 18, 2011

I also had a problem with gtkbuilder2.f90 under Windows 7 & GTK+ 2.22.1:

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'destroy'

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'delete_event'

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'destroy'

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'button2clicked'

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'hello'

The buttons have no effect.
gtkbuilder.f90 is not affected by this problem.

@ghost ghost assigned bonanza Apr 18, 2011
@pfossati
Copy link

I tested tonight the gtk3 branch with GTK+ 3.0.5 on MacOS X 10.6.7, and gtkbuilder had exactly the same behaviour (i.e. hanging at launch with the same messages).

@bonanza
Copy link
Collaborator

bonanza commented Apr 19, 2011

The first Mac message seems to tell us that GTK is not able to assign the value NULL to the Fortran type(c_ptr) variable "error". The second message is imho only a subsequent error to the first one. I have no really idea whats wrong here. Maybe the Fortran pointer variable have to be initialized with some target address before?

The Windows messages tell us that GModule is not able to find the symbols for the signal handlers. I had similar problems under Linux with GTK 2.22 which disappeared with GTK 2.24 / Gmodule 2.28. It will be good to test it under Windows with GTK 2.24 or even GTK 3.0.

@vmagnin
Copy link
Owner Author

vmagnin commented Apr 19, 2011

It seems the latest binaries for Windows are only 2.22.1:
http://www.gtk.org/download-windows.html
And there is not yet binaries for GTK+ 3.0. Wait and see...

P.s. James, I have successfully tested your nice hl_choosers.f90 example (ubuntu 11.04, 32 bits, GTK+ 2.24.4), and also hl_dialog.f90. (They just lack the GNU GPL 3 header).

@vmagnin
Copy link
Owner Author

vmagnin commented Apr 21, 2011

I identified a minor problem in gtkbuilder.f90 and gtkbuilder2.f90: when I click on the cross to quit the window instead of using the exit button, the destroy signal is not called. The window disappears but the application is still running.
(Ubuntu 11.04, 32&64 bits)

@bonanza
Copy link
Collaborator

bonanza commented Apr 22, 2011

This seems to be a general problem with gtkbuilder. The window should have two signal connections (destroy and delete_event). But only one of these (delete_event) is connected, which is the second one in gtkbuilder.glade. However, if the respective lines in gtkbuilder.glade are written in reverse order the result is identical.

@vmagnin
Copy link
Owner Author

vmagnin commented Apr 22, 2011

I have installed Fedora 15 Beta on a 32 bits PC. I think it is the first distribution coming natively with GNOME 3 (GTK+ 3.0.9) and gfortran 4.6.0. The gtk3 branch compiles perfectly. All the examples seems to work without problem, except gtkbuilder.f90 and gtkbuilder2.f90 which just display in the console exactly the same messages than on Paul's Mac OS X. (This was not observed in Ubuntu 11.04)

As expected, when running menu.f90, hl_menu.f90 and notebooks.f90, the "undefined symbol: menu_proxy_module_load" message does not appear anymore, GTK+ 3.0 being fully integrated in the GNOME 3 desktop of Fedora 15.

@vmagnin
Copy link
Owner Author

vmagnin commented Apr 28, 2011

gtkbuilder2.f90 under Windows 7 & GTK+ 2.24.0, Glib 2.28.1, same problem as in my April 18 post:

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'destroy'

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'delete_event'

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'destroy'

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'button2clicked'

(gtkbuilder2.exe:1972): Gtk-WARNING **: Could not find signal handler 'hello'

@bonanza
Copy link
Collaborator

bonanza commented May 10, 2011

I looks like that G_MODULE_EXPORT have to be used to get this working under Windows (and also MacOSX?):
http://tadeboro.blogspot.com/2009/09/glade3-tutorial-6-signals.html
http://developer.gnome.org/glib/unstable/glib-Dynamic-Loading-of-Modules.html#G-MODULE-EXPORT:CAPS
Any ideas how to use G_MODULE_EXPORT with Fortran?

@vmagnin
Copy link
Owner Author

vmagnin commented May 10, 2011

G_MODULE_EXPORT macro is defined in /usr/include/glib-2.0/gmodule.h
I don't know how to deal with __declspec(dllexport) which seems to be a compiler directive.

/* exporting and importing functions, this is special cased
 * to feature Windows dll stubs.
 */
#define G_MODULE_IMPORT     extern
#ifdef G_PLATFORM_WIN32
#  define   G_MODULE_EXPORT     __declspec(dllexport)
#else /* !G_PLATFORM_WIN32 */
#  define   G_MODULE_EXPORT
#endif /* !G_PLATFORM_WIN32 */

@bonanza
Copy link
Collaborator

bonanza commented May 11, 2011

Did anyone tried to compile gtkbuilder2.f90 under Windows 64bit? It should work there, since the calling convention changed during changeover to 64bit Windows systems.
However, on 32bit Windows systems it should be possible to fix that using compiler directives !GCC$ ATTRIBUTES.
See:
http://gcc.gnu.org/onlinedocs/gfortran/GNU-Fortran-Compiler-Directives.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34112
http://gcc.gnu.org/viewcvs/trunk/gcc/testsuite/gfortran.dg/compiler-directive_1.f90?view=markup

@bonanza
Copy link
Collaborator

bonanza commented May 16, 2011

Now I also got the "assertion `error == NULL || *error == NULL' failed" error using gfortran 4.6.1 20110513, gtk+ 3.0.8 and gmodule 2.28.6 under Linux 64bit.
I was able to resolve that using

type(c_ptr) :: error = c_null_ptr

as initialization expression for "error" which is used in gtk_builder_add_from_file.

@bonanza
Copy link
Collaborator

bonanza commented May 18, 2011

Can anybody try that also under Windows and MacOSX?

@vmagnin
Copy link
Owner Author

vmagnin commented May 19, 2011

Good ! gtkbuilder.f90 and gtkbuilder2.f90 are now working under Windows 7 - 32bits & gfortran 4.6.0. Curriously, I first obtained an "internal compiler error: segmentation fault", and I was obliged to write the initialization on two lines:

type(c_ptr) :: error

error = c_null_ptr

Although it is a compiler bug, it would thus be better to commit it with the two lines version.

@bonanza
Copy link
Collaborator

bonanza commented May 30, 2011

It is now committed in all branches (two lines version).
I think, we can close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants