with Gnat-2020-Community version and Gtkada I try to create a simple gui on Debian 10.2 (x86_64 GNU/Linux).
The project is based on GtkAda's "Simple window" project from the "Create Project from Template" dialog (I assume that the code runs out of the box).
-- Initialize GtkAda.
Gtk.Main.Init;
-- Create a window with a size of 400x400
Gtk_New (Win);
Win.Set_Default_Size (400, 400);
-- Create a box to organize vertically the contents of the window
Gtk_New_Vbox (Box);
Win.Add (Box);
-- Add a label
Gtk_New (Label, "Hello world.");
Box.Add (Label);
-- Stop the Gtk process when closing the window
Win.On_Delete_Event (Delete_Event_Cb'Unrestricted_Access);
-- Show the window and present it
Win.Show_All;
Win.Present;
-- Start the Gtk+ main loop
Gtk.Main.Main;
No changes have been applied except from the adjustment of 'with "gtkada";' to the correct path of the gtkada.gpr file in the project's gpr file.
GtkAda is detected correctly. The project is built successfully both in static and relocatable configuration.
However, the program cannot be run successfully but generates this terminal output when executing Win.Show_All;
:
/home/user/workspace_ada/Simple_Window/Simple_Window/obj/main
Fontconfig warning: "/home/user/workspace_ada/gnat-2020/etc/fonts/fonts.conf", line 86: unknown element "blank"
(main:4012): Gtk-WARNING **: 21:38:39.988: Could not load a pixbuf from icon theme.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /home/user/workspace_ada/gnat-2020/share/icons/Adwaita/16x16/status/image-missing.png: Format der Bilddatei unbekannt (gdk-pixbuf-error-quark, 3)
raised PROGRAM_ERROR : unhandled signal
[2020-08-20 21:38:40] process exited with status 1, elapsed time: 00.30s
I have installed the following packages as required by Gtkada: libglib*
, libgtk*
.
Furthermore I have installed libx11*
and libncurses*
, because I had the feeling as if it would be beneficial.
I have searched both the internet and the Gtkada community at stackoverflow on this topic without success.
Therefore I would like to ask you, the Ada experts and gurus of the Stackoverflow community, on ideas or what I am missing.
Many thanks in advance. Best regards.
Problem: You can't run the program written in GtkAda directly on Linux. You have to always use script gtkada-env.sh
or it equivalent before start a program to set proper paths and environment variables for Gtk bundled with GtkAda.
If you want to see how that starting script should looks, here is a small example: https://github.com/thindil/hunter/blob/master/hunter.sh
If you plan to use gtkada-env.sh
script, you need to run it only once, because it create a new default shell with proper paths and variables settings