From: ········@gmail.com
Subject: clsql/uffi/cmucl and netbsd, has anyone got it to work?
Date: 
Message-ID: <1122842614.606368.82080@f14g2000cwb.googlegroups.com>
I am trying to get cmucl/clsql/uffi runing on NetBSD 2.0.1, Now
cmucl-19b-pre1 seems to load shared objects fine on its own, did a dns
lookup with it. But when I try to use CLSQL even with the socket level
protocol I can not get it to work.  There is a problem getting it to
load shared libraries, here is some details:


nagios# cat clsql-load.lisp
(load "asdf.lisp")

(push "/usr/local/lib/cmucl/site/md5/" asdf:*central-registry*)
(push "/usr/local/lib/cmucl/site/cl-base64/" asdf:*central-registry*)
(push "/usr/local/lib/cmucl/site/clsql/" asdf:*central-registry*)
(push "/usr/local/lib/cmucl/site/uffi/" asdf:*central-registry*)

(asdf:oos 'asdf:load-op :clsql)
(asdf:oos 'asdf:load-op :clsql-postgresql )

here is the lisp:

nagios# lisp
CMU Common Lisp 19b-pre1 (19B), running on nagios.proxicom.com
With core: /usr/local/bin/lisp.core
Dumped on: Mon, 2005-06-27 17:40:50-04:00 on nagios.proxicom.com
Send bug reports and questions to your local CMU CL maintainer,
or to ··@snoopy.mv.com,
or to
··········@cs.cmu.edu.
Loaded subsystems:
   Python 1.1, target Intel x86
   CLOS based on Gerd's PCL 2004/04/14 03:32:47
   Gray Streams Protocol Support
   CLX X Library MIT R5.02
   Motif toolkit and graphical debugger 1.0
   Hemlock 3.5

and here is the output:


; Python version 1.1, VM version Intel x86 on 11 JUL 05 04:44:35 pm.
; Compiling:
/usr/local/lib/cmucl/site/clsql-3.2.1/uffi/clsql-uffi-loader.lisp
05 JUL 05 08:51:52 pm

; Converted FIND-AND-LOAD-FOREIGN-LIBRARY.
; Compiling DEFUN FIND-AND-LOAD-FOREIGN-LIBRARY:
; Byte Compiling Top-Level Form:
; Converted LOAD-UFFI-FOREIGN-LIBRARY.
; Compiling DEFUN LOAD-UFFI-FOREIGN-LIBRARY:
; Byte Compiling Top-Level Form:

; /usr/local/lib/cmucl/site/clsql-3.2.1/uffi/clsql-uffi-loader.x86f
written.
; Compilation finished in 0:00:00.
;; Loading
#P"/usr/local/lib/cmucl/site/clsql-3.2.1/uffi/clsql-uffi-loader.x86f".
Warning:
Error in function SYSTEM::ENSURE-LISP-TABLE-OPENED:
  Can't open global symbol table: "Service unavailable"
Warning:
Error in function SYSTEM::LOAD-OBJECT-FILE:
  Can't open object
"/usr/local/lib/cmucl/site/clsql-3.2.1/uffi/clsql_uffi.so": "Service
unavailable"
;;; Running /usr/bin/ld...
Warning:
File-error in function EXTENSIONS:LOAD-FOREIGN:
  File does not exist: clsql_uffi.a.
;;; Running /usr/bin/ld...
Warning:
File-error in function EXTENSIONS:LOAD-FOREIGN:
  File does not exist: clsql_uffi.o.


Error in function FIND-AND-LOAD-FOREIGN-LIBRARY:
  Couldn't load foreign libraries "clsql_uffi",
#P"/usr/local/lib/cmucl/site/clsql-3.2.1/uffi/clsql_uffi".
  [Condition of type SIMPLE-ERROR]

Restarts:
 0: [CONTINUE] Return NIL from load of
#P"/usr/local/lib/cmucl/site/clsql-3.2.1/uffi/clsql-uffi-loader.x86f".
 1: [RETRY   ] Retry performing #<ASDF:LOAD-OP NIL {493E5565}> on
               #<ASDF:CL-SOURCE-FILE "clsql-uffi-loader" {4937EAAD}>.
 2: [ACCEPT  ] Continue, treating #<ASDF:LOAD-OP NIL {493E5565}> on
               #<ASDF:CL-SOURCE-FILE "clsql-uffi-loader" {4937EAAD}> as
               having been successful.
 3:            Return NIL from load of "clsql-load.lisp".
 4: [ABORT   ] Return to Top-Level.

Debug  (type H for help)

(FIND-AND-LOAD-FOREIGN-LIBRARY
 ("clsql_uffi"
#P"/usr/local/lib/cmucl/site/clsql-3.2.1/uffi/clsql_uffi")
 :MODULE "clsql-uffi"
 :SUPPORTING-LIBRARIES ...)
Source:
0]


Now I have added some code that I think is right to clsql/uffi/make.sh:
elif [ "os_netbsd" ]; then
   gcc -fPIC -DPIC -c $SOURCE -o $OBJECT
   ld -shared -soname=$BASE $LDFLAGS $OBJECT -o $SHARED_LIB

and in clsql/clsql-uffi.asd:

(defmethod perform ((o compile-op) (c clsql-uffi-source-file))
 (unless (operation-done-p o c)
   #-(or win32 mswindows)
   (unless (zerop (run-shell-command
                   #-(or netbsd freebsd) "cd ~A; make"
                   #+(or netbsd freebsd) "cd ~A; gmake"
                   (namestring (make-pathname :name nil
                                              :type nil
                                              :directory
*library-file-dir*))))
     (error 'operation-error :component c :operation o))))

and they seem to work, .so gets created, but it does not load the .so
file.

Any ideas guys?

If I can get this working I would like to submit my changes as a
patch, better in CVS then my home dir.

Thanks

marc