[commonqt-devel] CommonQt for newer versions of smoke

Elliott Slaughter elliottslaughter at gmail.com
Tue Mar 8 19:41:58 UTC 2011


On Tue, Mar 8, 2011 at 10:30 AM, David Lichteblau <david at lichteblau.com>wrote:

> Quoting Elliott Slaughter (elliottslaughter at gmail.com):
> > Undefined symbols:
> >   "Smoke::classMap", referenced from:
> >       Smoke::findClass(char const*)in commonqt.o
> >       Smoke::findClass(char const*)in commonqt.o
> >   "Smoke::NullModuleIndex", referenced from:
> >       Smoke::idMethod(short, short)in commonqt.o
> >       Smoke::idClass(char const*, bool)in commonqt.o
> >       Smoke::idClass(char const*, bool)in commonqt.o
> >       Smoke::idMethodName(char const*)in commonqt.o
> >       Smoke::findClass(char const*)in commonqt.o
> > ld: symbol(s) not found
> > collect2: ld returned 1 exit status
> > make: *** [libcommonqt.1.0.0.dylib] Error 1
>
> Just a shot in the dark, but I had a linking error on Windows, because
> CommonQt still links to smokeqtcore, and actually needs smokebase.
>
> Does it help if you change s/smokeqtcore/smokebase/ in commonqt.pro
> before re-running qmake?
>

Yup, that fixed the link error.

I have a couple of quibbles about the way you load foreign libraries. The
first is that you hard code the .so extension for non-unix platforms. Mac OS
X uses a .darwin extension. Here's a minimal fix for that:

diff --git a/ffi.lisp b/ffi.lisp
index 36a4a99..0dd1fc0 100755
--- a/ffi.lisp
+++ b/ffi.lisp
@@ -34,10 +34,14 @@

 (defun load-libcommonqt ()
   (cffi:load-foreign-library
-   #-(or windows mswindows win32)
+   #-(or windows mswindows win32 darwin)
    (namestring (merge-pathnames "libcommonqt.so"
                                 (asdf::component-relative-pathname
                                  (asdf:find-system :qt))))
+   #+(or darwin)
+   (namestring (merge-pathnames "libcommonqt.dylib"
+                                (asdf::component-relative-pathname
+                                 (asdf:find-system :qt))))
    #+(or windows mswindows win32)
    (namestring (merge-pathnames "debug/commonqt.dll"
                                 (asdf::component-relative-pathname
diff --git a/info.lisp b/info.lisp
index 6615e82..dcb9b52 100755
--- a/info.lisp
+++ b/info.lisp
@@ -696,7 +696,8 @@
         #+debug (assert (< idx (length *module-table*)))
         (cffi:load-foreign-library
         (format nil
-                #-(or mswindows windows win32) "libsmoke~A.so"
+                #-(or mswindows windows win32 darwin) "libsmoke~A.so"
+                #+(or darwin) "libsmoke~A.dylib"
                 #+(or mswindows windows win32) "smoke~A.dll"
                 name))
         (let ((init (cffi:foreign-symbol-pointer

But beyond that basic issue, you don't take advantage of
CFFI's *foreign-library-directories* feature, which is going to make it
difficult for me to relocate the shared libraries. For example, if I wanted
to save a core and distribute it as a binary, I don't think I'll be able to
do that easily with this setup.

For an example of how to do this look at lispbuilder-sdl's ffi code,
especially around lines 9 and 27.

http://code.google.com/p/lispbuilder/source/browse/trunk/lispbuilder-sdl/cffi/library.lisp

At any rate, I can run the tutorial code, so thanks for the help :-).

-- 
Elliott Slaughter

"Don't worry about what anybody else is going to do. The best way to predict
the future is to invent it." - Alan Kay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/commonqt-devel/attachments/20110308/b0ec4633/attachment.html>


More information about the commonqt-devel mailing list