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

Error division-by-zero in first example from tutorial #6

Closed metadeus closed 11 years ago

metadeus commented 12 years ago

Empty window appears but then error signalled.

cl-cffi-gtk commit b4087629 SBCL 1.0.55 Ubuntu 12.04 x64

Error: arithmetic error DIVISION-BY-ZERO signalled [Condition of type DIVISION-BY-ZERO]

Restarts: 0: [TERMINATE-THREAD] Terminate this thread (#<THREAD "cl-gtk2 main thread" RUNNING {1008CF0373}>)

Backtrace: 0: ("foreign function: #x200D539DA2") 1: ((LAMBDA () :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS)) 2: ((FLET #:WITHOUT-INTERRUPTS-BODY-237377 :IN SB-THREAD:MAKE-THREAD)) 3: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD:MAKE-THREAD)) 4: ((FLET #:WITHOUT-INTERRUPTS-BODY-88845 :IN SB-THREAD::CALL-WITH-MUTEX)) 5: (SB-THREAD::CALL-WITH-MUTEX ..) 6: (SB-THREAD::INITIAL-THREAD-FUNCTION) 7: ("foreign function: call_into_lisp") 8: ("foreign function: new_thread_trampoline")

Code: (ql:quickload :cl-cffi-gtk)

(defpackage :gtk-tutorial (:use :gtk :gdk :gobject :glib :pango :cairo :common-lisp))

(in-package :gtk-tutorial)

(defun example-simple-window () (within-main-loop (let ( ;; Create a toplevel window. (window (gtk-window-new :toplevel))) ;; Show the window. (gtk-widget-show-all window))))

(example-simple-window)

crategus commented 12 years ago

Hello Artyom,

thank you very much for your interest in the Lisp binding to GTK+.

If I see it correctly, you are using a 64-bit Ubuntu 12.04. I am working with a 32-bit Ubuntu 12.04. You can use the library function cl-cffi-gtk-build-info to get more information about the installation. On my notebook I get:

cl-cffi-gtk version: 0.0.0 cl-cffi-gtk build date: 20:0 5/22/2012 GTK+ version: 3.4.2 GLIB version: 2.32.1 Pango version: 1.30.0 Cairo version: 1.10.2 Machine type: X86 Machine version: Intel(R) Pentium(R) M processor 1.73GHz Software type: Linux Software version: 3.2.0-24-generic Lisp implementation type: SBCL Lisp implementation version: 1.0.56

At this time I have no idea what is going wrong. It seems to me that the error originates from the library Bordeaux Threads, which might not work correctly on a 64-bit system. But perhaps I am completely wrong.

Remark:

I am working now about 6 month on the cl-cffi-gtk library. At this moment I update the complete library to GTK+ 3.4. To get the implementation complete I have to implement even more functionality of the libraries Cairo, Pango and GIO. All examples of the tutorial work correctly with GTK+ 3.4 on my Ubuntu 12.04 32 bit with SBCL 1.0.56.

Every help to solve the reported problem is appreciated.

Dieter Kaiser

metadeus commented 12 years ago

cl-cffi-gtk version: 0.0.0 cl-cffi-gtk build date: 12:14 5/23/2012 GTK+ version: 3.4.2 GLIB version: 2.32.1 Pango version: 1.30.0 Cairo version: 1.10.2 Machine type: X86-64 Machine version: AMD Phenom(tm) II X6 1055T Processor Software type: Linux Software version: 3.2.0-24-generic Lisp implementation type: SBCL Lisp implementation version: 1.0.55.0.debian

metadeus commented 12 years ago

Today I'm going to try it on my second Ubuntu 12.04 x86.

metadeus commented 12 years ago

Same problem here.

Linux ubuntu 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux

cl-cffi-gtk version: 0.0.0 cl-cffi-gtk build date: 15:18 5/23/2012 GTK+ version: 3.4.1 GLIB version: 2.32.1 Pango version: 1.30.0 Cairo version: 1.10.2 Machine type: X86 Machine version: Intel(R) Core(TM) i7-2677M CPU @ 1.80GHz Software type: Linux Software version: 3.2.0-23-generic-pae Lisp implementation type: SBCL Lisp implementation version: 1.0.56.0.debian

Should I try with latest bordeaux-threads?

cmatei commented 11 years ago

I see the same, but randomly. Sometimes it works, sometimes I get the same error and backtrace.

cl-cffi-gtk version: 1.0.0 cl-cffi-gtk build date: 12:29 8/29/2012 GTK+ version: 3.4.2 GLIB version: 2.32.3 GDK-Pixbuf version: 2.26.1 Pango version: 1.30.0 Cairo version: 1.12.2 Machine type: X86-64 Machine version: Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz Software type: Linux Software version: 3.4-trunk-amd64 Lisp implementation type: SBCL Lisp implementation version: 1.0.58.0.debian

crategus commented 11 years ago

The problem seems to be in the library Bordeaux Threads. I can not reproduce the issue. I use the library version 0.8.2. I have not done an asdf-install, but I have downloaded and installed the release bordeaux-threads-0.8.2.tar.gz which is available from http://common-lisp.net/project/bordeaux-threads/releases/ . With this version of bordeaux threads, SBCL 1.0.57 and earlier versions of SBCL I never had a problem.

Perhaps I can get your version of Bordeaux Threads to reproduce the issue on my system.

This is the build info on my system. I am working with SBCL 1.0.57 on an Ubuntu Linux 1.0.4 (32bit). You get the build info with the command (cl-cffi-gtk-build-info).

cl-cffi-gtk version: 1.0.0 cl-cffi-gtk build date: 10:26 8/31/2012 GTK+ version: 3.4.2 GLIB version: 2.32.3 GDK-Pixbuf version: 2.26.1 Pango version: 1.30.0 Cairo version: 1.10.2 Machine type: X86 Machine version: Intel(R) Core(TM)2 Duo CPU T7250 @ 2.00GHz Software type: Linux Software version: 3.2.0-30-generic-pae Lisp implementation type: SBCL Lisp implementation version: 1.0.57

Dieter Kaiser

cmatei commented 11 years ago

I have mine installed via quicliksp, but I did a diff vs the tar.gz release and it's identical (0.8.2).

I just realised I should mention that I am testing in slime, which spawns some additional threads itself. Simply running sbcl --load tutorial.lisp with some sample code does not appear to trigger the issue (ran it 10 times, happens more often when in slime).