[lambda-gtk-devel] Libraries & cm-gtk...

Dietrich Bollmann diresu at web.de
Fri Jan 12 15:19:19 UTC 2007


Hi,

I am not sure if the following observation is helpful - but for any case
here it comes...

On my system (Debian etch) the extension `.so.0' is used for some
libraries - and not the extension `.so' cm-gtk was searching for.

Example:

  ls -la /usr/lib/libgtk-x11-2.0.so
  ls: /usr/lib/libgtk-x11-2.0.so: No such file or directory

  ls -la /usr/lib/libgtk-x11-2.0*
  lrwxrwxrwx 1 root root      26 2006-10-27 23:30
/usr/lib/libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.800.20
  -rw-r--r-- 1 root root 3039524 2006-10-14 06:29
/usr/lib/libgtk-x11-2.0.so.0.800.20

In order to load the libraries I made some changes to my version of the
code:

  - cm-gtk now searches the libraries using both extensions
  - the list of extensions searched for is customizable
    by setting the variable *gtk-libext* to something different.
    current value:   #+:darwin '("dylib") #-:darwin '("so" "so.0"))

Thanks for your wonderful program!

Best wishes, Dietrich


Here come my changes...

File: .../common-music/cm-gtk/gtkffi-cmusbcl.lisp

============================================================
original version:
------------------------------------------------------------

(in-package :cl-user)
(eval-when (:compile-toplevel :load-toplevel :execute)
  #+sbcl (setq sb-alien::*values-type-okay* t)
  (export '(*gtk-libdir* *gtk-libfiles*) :cl-user)
  (defvar *gtk-libdir* #+:darwin "/sw/lib/" #-:darwin "/usr/lib/")
  (defvar *gtk-libfiles*
    '("libgtk-x11-2.0" "libgdk-x11-2.0" "libatk-1.0"
      "libgdk_pixbuf-2.0"
      #-:darwin "libm" #+:darwin "/usr/lib/libm"
      "libpangoxft-1.0" "libpangox-1.0" "libpango-1.0"
      "libgobject-2.0" "libgmodule-2.0"
      #-:darwin "libdl"
      "libglib-2.0"
      #+:darwin "libintl"
      #+:darwin "libiconv"
     ))
  (flet ((libpath (lib &aux p)
           (setq p (namestring
                     (merge-pathnames (format nil "~A.~A"
                                              lib
                                              #+:darwin "dylib"
                                              #-:darwin "so")
                                      *gtk-libdir*)))
           (if (probe-file p)
             p
             (error "Library ~S not found. Either GTK is not installed
or else cl-user:*gtk-libdir* needs to be set to the directory containing
GTK on your machine." p))))
  #+:sbcl
  (dolist (l *gtk-libfiles*) (load-shared-object (libpath l)))
  #+:cmu
  (dolist (l *gtk-libfiles*) (ext:load-foreign (libpath l)))))

============================================================
the changed version:
------------------------------------------------------------

(in-package :cl-user)
(eval-when (:compile-toplevel :load-toplevel :execute)
  #+sbcl (setq sb-alien::*values-type-okay* t)
  (export '(*gtk-libdir* *gtk-libfiles*) :cl-user)
  (defvar *gtk-libdir* #+:darwin "/sw/lib/" #-:darwin "/usr/lib/")
  (defvar *gtk-libfiles*
    '("libgtk-x11-2.0" "libgdk-x11-2.0" "libatk-1.0"
      "libgdk_pixbuf-2.0"
      #-:darwin "libm" #+:darwin "/usr/lib/libm"
      "libpangoxft-1.0" "libpangox-1.0" "libpango-1.0"
      "libgobject-2.0" "libgmodule-2.0"
      #-:darwin "libdl"
      "libglib-2.0"
      #+:darwin "libintl"
      #+:darwin "libiconv"
     ))
  (defvar *gtk-libext* #+:darwin '("dylib") #-:darwin '("so" "so.0"))
  (flet ((libpath (lib)
           (loop for ext in *gtk-libext*
                 for library = (namestring
                                (merge-pathnames (format nil "~A.~A" lib
ext)
                                                 *gtk-libdir*))
                 for exists = (probe-file library)
                 until exists
                 finally
                 (return
                   (if exists
                       ;; found library - return it
                       library
                       ;; couldn't find library - throw error
                       (error
                        (concatenate
                         'string
                         (format nil "Library ~S with neither of the
extensions ~{~a~^, ~} found. "
                                 lib *gtk-libext*)
                         "Either GTK is not installed "
                         "or else cl-user:*gtk-libdir*,
cl-user:*gtk-libfiles* or cl-user:*gtk-libext* "
                         "needs to be set to fing the GTK libraries on
your machine.")))))))
    (dolist (l *gtk-libfiles*)
      (let ((lib (libpath l)))
        ;; (format t ";;; Loading library ~a~%" lib)
        #+:sbcl (load-shared-object lib)
        #+:cmu  (ext:load-foreign   lib)))))

============================================================









More information about the Lambda-gtk-devel mailing list