By Lyaaaaaaaaaaaaaaa

2019-09-11 09:24:22 8 Comments

I'm having troubles distributing a GtkAda application on Windows. I made an executable (with Windows native compiler) and tried using it on another Windows computer. However, I get errors about dlls missing.

I tried distributing with my .exe three folders.

  • bin including the dlls installed by GtkAda,
  • etc including fonts, gtk-3.0 and pango,
  • lib including gtk-3.0 with dlls too.

This is what I read from the GtkAda documentation

I think I maybe forgot to specify something in the project file

Here my GPS project file

with "C:\GNAT\GTK\lib\gnat\gtkada";

project Logfilter is
    for Source_Dirs use ("src");
    for Object_Dir  use "obj";
    for Exec_Dir    use "exec";
    for Main use ("log_filter_main.adb");

    package Builder is
      for Executable ("main.adb") use "Logs_Filter";
    end Builder;

    package Compiler is
      for Switches ("ada") use ("-Wl,--subsystem,windows");
    end Compiler;

end Logfilter;

I'm using a glade (gtk 3.14) file and GtkAda 2019.

Thank you.


@DeeDee 2019-09-11 10:20:42

Where did you put the main executable (log_filter_main.exe)? What libraries are missing?

When I create a directory structure using the batch program below (change the variables GTKADA_INSTALL_DIR and TARGET_DIR to match your situation), and then copy my executable (a simple GtkAda program) into %TARGET_DIR%\bin, then this executable runs just fine. It's important that the application resides in the bin folder such that the correct GTK runtime libraries will be found during startup.



xcopy /s /i %GTKADA_INSTALL_DIR%\bin\*.dll       %TARGET_DIR%\bin\
xcopy /s /i %GTKADA_INSTALL_DIR%\etc\*.*         %TARGET_DIR%\etc\
xcopy /s /i %GTKADA_INSTALL_DIR%\lib\gtk-3.0\*.* %TARGET_DIR%\lib\gtk-3.0\

REM  Copy your GtkAda application (.exe and other dependencies if applicable) 
REM  to %TARGET_DIR%\bin\

Regarding the project file: first, it's not completely clear why the Builder package is needed, but I might lack some project specific knowledge/requirements here. Second, if you want to get rid of the console window popping up when starting the GUI application, then you might want to use

package Linker is
  for Switches ("ada") use ("-mwindows");
end Linker;

instead of

package Compiler is
  for Switches ("ada") use ("-Wl,--subsystem,windows");
end Compiler;


Small additional note beyond the scope of the question (you may already have thought of it): please do not forget to quit the GTK main application when you close the main window. Define (for example):

procedure Destroy_Event_Callback
   (Widget : access Gtk.Widget.Gtk_Widget_Record'Class)
end Destroy_Event_Callback;

and then register it as a callback when the main window is initialized:

Main_Window.On_Destroy (Destroy_Event_Callback'Access);

If the Gtk.Main.Main_Quit call is omitted, then the program (process) will keep running after you close the main window (at least when you use the -mwindows linker option).

@Lyaaaaaaaaaaaaaaa 2019-09-11 15:20:32

The problem was my .exe not being in bin with the dlls needed. Now I only need to get done with the GLib-GIO-ERRORstrange error.

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] unknown project file: "gtkada"

  • 2019-03-26 05:15:49
  • trayres
  • 221 View
  • 1 Score
  • 1 Answer
  • Tags:   ada gtkada

1 Answered Questions

[SOLVED] Use package from a static library in ada

1 Answered Questions

[SOLVED] GPRBuild does not compile C files

  • 2019-03-09 11:41:31
  • flyx
  • 93 View
  • 3 Score
  • 1 Answer
  • Tags:   c ada gnat gprbuild

2 Answered Questions

[SOLVED] Shell command to compile C in Gprbuild

  • 2019-02-27 21:09:42
  • Frédéric Praca
  • 72 View
  • 1 Score
  • 2 Answer
  • Tags:   c ada gprbuild

1 Answered Questions

[SOLVED] How to create an ada lib.a and link to C

  • 2014-11-07 16:18:25
  • crychair
  • 3453 View
  • 6 Score
  • 1 Answer
  • Tags:   c ada gnat gnat-gps

1 Answered Questions

[SOLVED] Unable to pass box widget using callback handler in Gtkada

1 Answered Questions

[SOLVED] Can't find GNAT GPS Dependencies Form

  • 2015-06-27 19:30:23
  • Jim
  • 237 View
  • 0 Score
  • 1 Answer
  • Tags:   ada gnat

2 Answered Questions

[SOLVED] Ada GPS IDE Compiler error Undefined symbols for architecture x86_64

  • 2013-08-01 19:57:35
  • user2643432
  • 1391 View
  • 2 Score
  • 2 Answer
  • Tags:   ada

1 Answered Questions

[SOLVED] Auto packgaing for applications in linux

1 Answered Questions

[SOLVED] Ada - strange error - consistent version of gcc/gnatbind

  • 2011-09-28 00:10:18
  • michele
  • 951 View
  • 2 Score
  • 1 Answer
  • Tags:   gcc ada gnat

Sponsored Content