crategus / cl-cffi-gtk

cl-cffi-gtk is a Lisp binding to the GTK+ 3 library.
http://www.crategus.com/books/cl-cffi-gtk
146 stars 33 forks source link

Can't run a buildapp compiled app #25

Closed EuAndreh closed 6 years ago

EuAndreh commented 10 years ago

Hi there!

I had this problem the other day and posted about it on the Lisp mailing list, but I didn't get many answers, so I came to the source =]

Here's a (edited) copy of the mailing list post:

I'm trying to run a compiled version (with buildapp) of a fully-functional interpreted GUI code, but the compiled code shows some strange messages that I don't know what they mean.

I have a sample app (actually taken from the book tutorial):

The ASDF file:

(asdf:defsystem gui-test 
  :depends-on (:cl-cffi-gtk) 
  :components ((:file "gui-test"))) 
;end of ASDF file 

The main file:

(defpackage gui-test 
  (:use gtk gdk gdk-pixbuf gobject 
        glib gio pango cairo cl)) 

(in-package gui-test) 

(defun example-simple-window () 
  (within-main-loop 
    (let ((window (gtk-window-new :toplevel))) 

      (g-signal-connect window "destroy" 
                        (lambda (widget) 
                          (declare (ignore widget)) 
                          (leave-gtk-main))) 
      (gtk-widget-show-all window)))) 

(defun main (argv) 
  (declare (ignore argv)) 
  (example-simple-window)) 
;end of main file 

The buildapp command:

buildapp --output built-gui-test --load ~/.sbclrc  --load-system cl-cffi-gtk  --load gui-test.asd  --load gui-test  --entry gui-test:main 

The buildapp output:

;; loading file #P"/home/andreh/.sbclrc" 
;; loading system "cl-cffi-gtk" 
;; loading file #P"/home/andreh/Dropbox/Code/QL/local-projects/gui-test/gui-test.asd" 
;; loading file #P"/home/andreh/Dropbox/Code/QL/local-projects/gui-test/gui-test.lisp" 
[undoing binding stack and other enclosing state... done] 
[saving current Lisp image into built-gui-test: 
writing 5856 bytes from the read-only space at 0x0x20000000 
writing 13376 bytes from the static space at 0x0x20100000 
writing 90898432 bytes from the dynamic space at 0x0x1000000000 
done] 

But when I run the app, it show this message(the entire message is too big to fit here):

Loading Glib ... 
Loading GDK ... 
Loading GTK ... 
STYLE-WARNING: Undefined alien: "gtk_get_major_version" 
STYLE-WARNING: Undefined alien: "gtk_init_check" 
(... a whole lot more of undefined aliens...) 
STYLE-WARNING: Undefined alien: "gtk_application_is_inhibited" 
STYLE-WARNING: Undefined alien: "gtk_application_window_get_id" 
WARNING: cl-cffi-gtk: GType AtkImplementorIface is not known to GObject 
WARNING: cl-cffi-gtk: GType AtkImplementorIface is not known to GObject 
WARNING: 
   Declared GType name 'AtkImplementorIface' for class 'ATK-IMPLEMENTOR-IFACE' is invalid (g_type_name returned 0) 

What this Undefined alien warning means? Why the program doesn't run?

Thanks in advance =]

crategus commented 10 years ago

Thank you very much for your interest in cl-cffi-gtk. I am on holiday until next week. I will answer on your problem when I am back from holiday.

Dieter Kaiser

EuAndreh commented 10 years ago

Thank you for your attention. (Oops, accidentally closed the issue, sorry)

crategus commented 10 years ago

I have tried to build an executable from the gtk-demo with SBCL, but I get the same problems as you. The SBCL documentation states that the implementation of saving a core image is not as polished and painless as you might like. Unfortunately, I am not a expert in creating executable Lisp images. For the development I am loading the code from the Lisp prompt. Therefore, I have no workaround at this time.

The warning show that the foreign functions are no longer available. Something is broken, when generating the Lisp executable.

At first, it would be interesting if you can run your application loading it into a Lisp. This should be no problem. You can also try to run the gtk-demo, which is available in the directory /demo/gtk-demo. Load the file "gtk-demo.lisp", change to the package 'gtk-demo and start the demo with the command main.

I know of one working program which uses cl-cffi-gtk and comes with an script to generate the executable. You can find it on github http://github.com/ralph-schleicher/atmosphere-calculator

I will work on this problem further. Perhaps someone else can show a working way of generating a Lisp executable.

Dieter Kaiser

EuAndreh commented 10 years ago

Thank you very much. Should I try it with another compiler?

I'll take a look at the atmosphere-calculator.