Trouble connecting to a MySQL database on local host
Michael Velik <[email protected]> Sun, 2 Jan 2011 17:10:04 -0500
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'm pretty much a beginner in Lisp and in CLSQL so the following questions are really basic.
Quick background on the relevant parts of my setup
* system is Mac OS X 10.6
* CL implementation is SBCL 1.0.44 at /usr/local/bin/sbcl libraries in /usr/local/lib/sbcl/
* CL libraries in /usr/local/lib/cl/
* CLSQL libraries are in /usr/local/lib/cl/clsql/
* MySQL is installed at /usr/local/mysql/
I'm using Emacs and SLIME for my development environment. I've got symbolic links for all the relevant *ASD files in /usr/local/lib/sbcl/site-systems/ (e.g. lrwxr-xr-x 1 root wheel 38 Dec 29 00:08 clsql-uffi.asd -> /usr/local/lib/cl/clsql/clsql-uffi.asd)
In Emacs/SLIME:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CL-USER> (require 'clsql)
; loading system definition from /usr/local/lib/sbcl/site-systems/uffi.asd
; into #<PACKAGE "ASDF1">
; registering #<SYSTEM UFFI> as UFFI
; loading system definition from
; /usr/local/lib/sbcl/site-systems/cffi-uffi-compat.asd into
; #<PACKAGE "ASDF1">
; registering #<SYSTEM CFFI-UFFI-COMPAT> as CFFI-UFFI-COMPAT
; loading system definition from /usr/local/lib/sbcl/site-systems/cffi.asd
; into #<PACKAGE "ASDF1">
; registering #<SYSTEM CFFI> as CFFI
; loading system definition from
; /usr/local/lib/sbcl/site-systems/babel.asd into #<PACKAGE "ASDF1">
; registering #<SYSTEM BABEL> as BABEL
; loading system definition from
; /usr/local/lib/sbcl/site-systems/alexandria.asd into #<PACKAGE "ASDF1">
; registering #<SYSTEM :ALEXANDRIA> as ALEXANDRIA
; loading system definition from
; /usr/local/lib/sbcl/site-systems/trivial-features.asd into
; #<PACKAGE "ASDF1">
; registering #<SYSTEM TRIVIAL-FEATURES> as TRIVIAL-FEATURES
NIL
CL-USER>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
That seems okay ... but why the return value of NIL ? Shouldn't it return T?
anyway forging on ..
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CL-USER> (in-package :clsql)
#<PACKAGE "CLSQL">
CLSQL> (connect '("localhost" "test" "root" "") :database-type :mysql)
; compiling file "/usr/local/lib/cl/clsql-5.2.0/uffi/clsql-uffi.lisp" (written 07 NOV 2010 11:52:03 AM):
; compiling (IN-PACKAGE #:CLSQL-UFFI)
; compiling (DEFUN CANONICALIZE-TYPE-LIST ...)
; file: /usr/local/lib/cl/clsql-5.2.0/uffi/clsql-uffi.lisp
; in: DEFUN CANONICALIZE-TYPE-LIST
; (LENGTH CLSQL-UFFI::TYPES)
;
; note: unable to
; optimize
; due to type uncertainty:
; The first argument is a SEQUENCE, not a (SIMPLE-ARRAY * (*)).
;
; note: unable to
; optimize
; due to type uncertainty:
; The first argument is a SEQUENCE, not a VECTOR.
; (LENGTH CLSQL-UFFI::AUTO-LIST)
;
; note: unable to
; optimize
; due to type uncertainty:
; The first argument is a SEQUENCE, not a (SIMPLE-ARRAY * (*)).
;
; note: unable to
; optimize
; due to type uncertainty:
; The first argument is a SEQUENCE, not a VECTOR.
; compiling (DEF-FUNCTION "atoi" ...)
; compiling (DEF-FUNCTION ("strtoul" C-STRTOUL) ...)
; compiling (DEF-FUNCTION "atol" ...)
; compiling (DEF-FUNCTION "atof" ...)
; compiling (DEF-FUNCTION "atol64" ...)
; compiling (DEF-CONSTANT +2^32+ ...)
; compiling (DEF-CONSTANT +2^64+ ...)
; compiling (DEF-CONSTANT +2^32-1+ ...)
; compiling (DEFMACRO MAKE-64-BIT-INTEGER ...)
; compiling (DEFMACRO MAKE-128-BIT-INTEGER ...)
; compiling (DEFMACRO SPLIT-64-BIT-INTEGER ...)
; compiling (DEF-TYPE CHAR-PTR-DEF ...)
; compiling (DEFUN STRTOUL ...)
; compiling (DEFUN CONVERT-RAW-FIELD ...)
; file: /usr/local/lib/cl/clsql-5.2.0/uffi/clsql-uffi.lisp
; in: DEFUN CONVERT-RAW-FIELD
; (CFFI-UFFI-COMPAT:CONVERT-FROM-FOREIGN-STRING CLSQL-UFFI::CHAR-PTR
; :NULL-TERMINATED-P NIL :LENGTH
; LENGTH :ENCODING
; CLSQL-UFFI::ENCODING)
;
; caught ERROR:
; (in macroexpansion of (CONVERT-FROM-FOREIGN-STRING CHAR-PTR :NULL-TERMINATED-P ...))
; (hint: For more precise location, try *BREAK-ON-SIGNALS*.)
; error while parsing arguments to DEFMACRO CONVERT-FROM-FOREIGN-STRING:
; unknown keyword: :ENCODING; expected one of :NULL-TERMINATED-P, :LOCALE, :LENGTH
; (CFFI-UFFI-COMPAT:CONVERT-FROM-FOREIGN-STRING CLSQL-UFFI::CHAR-PTR
; :NULL-TERMINATED-P T :ENCODING
; CLSQL-UFFI::ENCODING)
;
; caught ERROR:
; (in macroexpansion of (CONVERT-FROM-FOREIGN-STRING CHAR-PTR :NULL-TERMINATED-P ...))
; (hint: For more precise location, try *BREAK-ON-SIGNALS*.)
; error while parsing arguments to DEFMACRO CONVERT-FROM-FOREIGN-STRING:
; unknown keyword: :ENCODING; expected one of :NULL-TERMINATED-P, :LOCALE, :LENGTH
; (CFFI-UFFI-COMPAT:WITH-FOREIGN-OBJECT (CLSQL-UFFI::HIGH32-PTR :UNSIGNED-INT)
; (LET ((CLSQL-UFFI::LOW32
; (CLSQL-UFFI:ATOL64 CLSQL-UFFI::CHAR-PTR CLSQL-UFFI::HIGH32-PTR))
; (CLSQL-UFFI::HIGH32
; (CFFI-UFFI-COMPAT:DEREF-POINTER CLSQL-UFFI::HIGH32-PTR
; :UNSIGNED-INT)))
; (IF (ZEROP CLSQL-UFFI::HIGH32)
; CLSQL-UFFI::LOW32
; (CLSQL-UFFI:MAKE-64-BIT-INTEGER CLSQL-UFFI::HIGH32
; CLSQL-UFFI::LOW32))))
; --> CFFI:WITH-FOREIGN-OBJECT CFFI-SYS:WITH-FOREIGN-POINTER LET* *
; ==>
; (* SB-C::Y 1)
;
; note: unable to
; optimize
; due to type uncertainty:
; The first argument is a NUMBER, not a FLOAT.
;
; note: unable to
; convert x*2^k to shift
; due to type uncertainty:
; The first argument is a NUMBER, not a INTEGER.
;
; note: unable to
; fold identity operations
; due to type uncertainty:
; The first argument is a NUMBER, not a (OR RATIONAL (COMPLEX RATIONAL)).
;
; note: unable to
; recode as leas, shifts and adds
; due to type uncertainty:
; The first argument is a NUMBER, not a (UNSIGNED-BYTE 64).
; The result is a (VALUES NUMBER &OPTIONAL), not a (VALUES (UNSIGNED-BYTE 64)
; &REST T).
;
; note: unable to
; recode as leas, shifts and adds
; due to type uncertainty:
; The first argument is a NUMBER, not a FIXNUM.
; The result is a (VALUES NUMBER &OPTIONAL), not a (VALUES FIXNUM &REST T).
; (ZEROP CLSQL-UFFI::HIGH32)
; ==>
; (= CLSQL-UFFI::HIGH32 0)
;
; note: unable to
; open-code FLOAT to RATIONAL comparison
; due to type uncertainty:
; The first argument is a NUMBER, not a FLOAT.
;
; note: unable to open code because: The operands might not be the same type.
; (CFFI-UFFI-COMPAT:WITH-FOREIGN-OBJECT (CLSQL-UFFI::HIGH32-PTR :UNSIGNED-INT)
; (LET ((CLSQL-UFFI::LOW32
; (CLSQL-UFFI:ATOL64 CLSQL-UFFI::CHAR-PTR CLSQL-UFFI::HIGH32-PTR))
; (CLSQL-UFFI::HIGH32
; (CFFI-UFFI-COMPAT:DEREF-POINTER CLSQL-UFFI::HIGH32-PTR
; :UNSIGNED-INT)))
; (IF (ZEROP CLSQL-UFFI::HIGH32)
; CLSQL-UFFI::LOW32
; (CLSQL-UFFI:MAKE-64-BIT-INTEGER CLSQL-UFFI::HIGH32
; CLSQL-UFFI::LOW32))))
; --> CFFI:WITH-FOREIGN-OBJECT CFFI-SYS:WITH-FOREIGN-POINTER LET* *
; ==>
; (* SB-C::Y 1)
;
; note: forced to do GENERIC-* (cost 30)
; unable to do inline fixnum arithmetic (cost 3) because:
; The first argument is a NUMBER, not a FIXNUM.
; The result is a (VALUES NUMBER &OPTIONAL), not a (VALUES FIXNUM &REST T).
; unable to do inline (signed-byte 64) arithmetic (cost 4) because:
; The first argument is a NUMBER, not a (SIGNED-BYTE 64).
; The result is a (VALUES NUMBER &OPTIONAL), not a (VALUES (SIGNED-BYTE 64)
; &REST T).
; etc.
; (CLSQL-UFFI:MAKE-64-BIT-INTEGER CLSQL-UFFI::HIGH32 CLSQL-UFFI::LOW32)
; --> IF ZEROP = LDB SB-KERNEL:%LDB LOGAND
; ==>
; (ASH INT (- SB-C::POSN))
;
; note: forced to do full call
; unable to do inline ASH (cost 2) because:
; The first argument is a INTEGER, not a FIXNUM.
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES FIXNUM &REST T).
; unable to do inline ASH (cost 3) because:
; The first argument is a INTEGER, not a (UNSIGNED-BYTE 64).
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES
; (UNSIGNED-BYTE 64)
; &REST T).
; etc.
; --> IF ZEROP = LDB SB-KERNEL:%LDB
; ==>
; (LOGAND (ASH INT (- SB-C::POSN)) (ASH 18446744073709551615 (- SB-C::SIZE 64)))
;
; note: forced to do static-fun Two-arg-and (cost 53)
; unable to do inline fixnum arithmetic (cost 1) because:
; The first argument is a INTEGER, not a FIXNUM.
; unable to do inline fixnum arithmetic (cost 2) because:
; The first argument is a INTEGER, not a FIXNUM.
; etc.
; --> IF +
; ==>
; (ASH CLSQL-UFFI::HIGH32 32)
;
; note: forced to do full call
; unable to do inline ASH (cost 2) because:
; The first argument is a INTEGER, not a FIXNUM.
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES FIXNUM &REST T).
; unable to do inline ASH (cost 3) because:
; The first argument is a INTEGER, not a (UNSIGNED-BYTE 64).
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES
; (UNSIGNED-BYTE 64)
; &REST T).
; etc.
; --> IF
; ==>
; (+ CLSQL-UFFI::LOW32 (ASH CLSQL-UFFI::HIGH32 32))
;
; note: forced to do GENERIC-+ (cost 10)
; unable to do inline fixnum arithmetic (cost 2) because:
; The second argument is a INTEGER, not a FIXNUM.
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES FIXNUM &REST T).
; unable to do inline (signed-byte 64) arithmetic (cost 5) because:
; The second argument is a INTEGER, not a (SIGNED-BYTE 64).
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES
; (SIGNED-BYTE 64) &REST
; T).
; etc.
; --> IF - +
; ==>
; (ASH CLSQL-UFFI::HIGH32 32)
;
; note: forced to do full call
; unable to do inline ASH (cost 2) because:
; The first argument is a INTEGER, not a FIXNUM.
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES FIXNUM &REST T).
; unable to do inline ASH (cost 3) because:
; The first argument is a INTEGER, not a (UNSIGNED-BYTE 64).
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES
; (UNSIGNED-BYTE 64)
; &REST T).
; etc.
; --> IF -
; ==>
; (+ CLSQL-UFFI::LOW32 (ASH CLSQL-UFFI::HIGH32 32))
;
; note: forced to do GENERIC-+ (cost 10)
; unable to do inline fixnum arithmetic (cost 2) because:
; The second argument is a INTEGER, not a FIXNUM.
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES FIXNUM &REST T).
; unable to do inline (signed-byte 64) arithmetic (cost 5) because:
; The second argument is a INTEGER, not a (SIGNED-BYTE 64).
; The result is a (VALUES INTEGER &OPTIONAL), not a (VALUES
; (SIGNED-BYTE 64) &REST
; T).
; etc.
; (CFFI-UFFI-COMPAT:WITH-FOREIGN-OBJECT (CLSQL-UFFI::HIGH32-PTR :UNSIGNED-INT)
; (LET ((CLSQL-UFFI::LOW32
; (CLSQL-UFFI:ATOL64 CLSQL-UFFI::CHAR-PTR CLSQL-UFFI::HIGH32-PTR))
; (CLSQL-UFFI::HIGH32
; (CFFI-UFFI-COMPAT:DEREF-POINTER CLSQL-UFFI::HIGH32-PTR
; :UNSIGNED-INT)))
; (IF (ZEROP CLSQL-UFFI::HIGH32)
; CLSQL-UFFI::LOW32
; (CLSQL-UFFI:MAKE-64-BIT-INTEGER CLSQL-UFFI::HIGH32
; CLSQL-UFFI::LOW32))))
; --> CFFI:WITH-FOREIGN-OBJECT CFFI-SYS:WITH-FOREIGN-POINTER LET*
; --> CFFI-SYS:%FOREIGN-ALLOC BLOCK
; ==>
; (ALIEN-SAP (MAKE-ALIEN (UNSIGNED 8) CFFI-SYS::SIZE))
;
; note: doing SAP to pointer coercion (cost 20) to SB-C::SAP
; /Users/michaelvelik/.cache/common-lisp/sbcl-1.0.44-darwin-x86-64/usr/local/lib/cl/clsql-5.2.0/uffi/ASDF-TMP-clsql-uffi.fasl written
; compilation finished in 0:00:00.252
WARNING:
COMPILE-FILE warned while performing
#<COMPILE-OP (:VERBOSE NIL) {1004E945E1}> on
#<CL-SOURCE-FILE "clsql-uffi" "uffi" "clsql-uffi">.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oh no, an error pops up in another buffer , (yikes !!)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
erred while invoking #<COMPILE-OP (:VERBOSE NIL) {1004E945E1}>
on #<CL-SOURCE-FILE "clsql-uffi" "uffi" "clsql-uffi">
[Condition of type ASDF:COMPILE-FAILED]
Restarts:
0: [TRY-RECOMPILING] Try recompiling clsql-uffi
1: [RETRY] Retry compiling component ("clsql-uffi" "uffi" "clsql-uffi").
2: [ACCEPT] Continue, treating compiling component ("clsql-uffi" "uffi" "clsql-uffi") as having been successful.
3: [RETRY] Retry SLIME REPL evaluation request.
4: [ABORT] Return to SLIME's top level.
5: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {1003480911}>)
Backtrace:
0: ((SB-PCL::FAST-METHOD ASDF:PERFORM (ASDF:COMPILE-OP ASDF:CL-SOURCE-FILE)) ..)
1: ((SB-PCL::EMF ASDF:PERFORM) #<unavailable argument> #<unavailable argument> #<ASDF:COMPILE-OP (:VERBOSE NIL) {1004E945E1}> #<ASDF:CL-SOURCE-FILE "clsql-uffi" "uffi" "clsql-uffi">)
2: ((SB-PCL::FAST-METHOD ASDF::PERFORM-WITH-RESTARTS (ASDF:COMPILE-OP ASDF:CL-SOURCE-FILE)) ..)
3: ((LAMBDA ()))
4: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK))
5: ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-RECURSIVE-LOCK]324))
6: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK ..)
7: ((FLET SB-C::WITH-IT))
8: ((SB-PCL::FAST-METHOD ASDF:OPERATE (T T)) #<unavailable argument> #<unavailable argument> ASDF:LOAD-OP :CLSQL-MYSQL)[:EXTERNAL]
9: (CONNECT ("localhost" "test" "root" ""))[:EXTERNAL]
10: (SB-INT:SIMPLE-EVAL-IN-LEXENV (CONNECT '("localhost" "test" "root" "") :DATABASE-TYPE :MYSQL) #<NULL-LEXENV>)
--more--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
press 4 to abort
Thinking ... thinking .... thinking. Ah remembered something about SBCL looking for dynamic libraries in /usr/local/lib, so ...
login as root and from /usr/local/lib/cl/clsql
sh-3.2# find . -name '*dylib' | grep -v z.dylib | while read A; do cp $A /usr/local/lib/$(basename $A); done;
so back to Emacs/SLIME
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
; compilation unit aborted
; caught 1 fatal ERROR condition
; caught 2 ERROR conditions
; printed 19 notes
; Evaluation aborted.
CLSQL> (connect '("localhost" "test" "root" "") :database-type :mysql)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Huh, another error pops up? ... scratches head ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The function CLSQL-UFFI:ATOL64 is undefined.
[Condition of type UNDEFINED-FUNCTION]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [ABORT] Return to SLIME's top level.
2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {1003480911}>)
Backtrace:
0: (SYMBOL-FUNCTION CLSQL-UFFI:ATOL64)
1: ((SB-PCL::FAST-METHOD ASDF:OPERATION-DONE-P (ASDF:LOAD-OP CLSQL-UFFI-SYSTEM::CLSQL-UFFI-SOURCE-FILE)) #<unavailable argument> #<unavailable argument> #<unavailable argument> #<unavailable argument>)
2: ((SB-PCL::FAST-METHOD ASDF::DO-TRAVERSE (ASDF:OPERATION ASDF:COMPONENT T)) ..)
3: (ASDF::DO-ONE-DEP ..)
4: ((FLET ASDF::DEP) ASDF:LOAD-OP "clsql_uffi" NIL)
5: (ASDF::DO-DEP ..)
6: ((SB-PCL::FAST-METHOD ASDF::DO-TRAVERSE (ASDF:OPERATION ASDF:COMPONENT T)) ..)
7: (ASDF::DO-ONE-DEP ..)
8: ((FLET ASDF::DEP) ASDF:LOAD-OP "clsql-uffi-loader" NIL)
9: (ASDF::DO-DEP ..)
10: ((SB-PCL::FAST-METHOD ASDF::DO-TRAVERSE (ASDF:OPERATION ASDF:COMPONENT T)) ..)
11: ((SB-PCL::FAST-METHOD ASDF::DO-TRAVERSE (ASDF:OPERATION ASDF:COMPONENT T)) ..)
12: ((SB-PCL::FAST-METHOD ASDF::DO-TRAVERSE (ASDF:OPERATION ASDF:COMPONENT T)) ..)
13: (ASDF::DO-ONE-DEP #<ASDF:COMPILE-OP (:VERBOSE NIL) {1003FCA3D1}> #<ASDF:SYSTEM "clsql-mysql"> #<CLOSURE (FLET ASDF::COLLECT) {1003FBBF19}> ASDF:COMPILE-OP CLSQL-MYSQL-SYSTEM::CLSQL-UFFI NIL)
14: ((FLET ASDF::DEP) ASDF:COMPILE-OP CLSQL-MYSQL-SYSTEM::CLSQL-UFFI NIL)
15: (ASDF::DO-DEP ..)
16: ((SB-PCL::FAST-METHOD ASDF::DO-TRAVERSE (ASDF:OPERATION ASDF:COMPONENT T)) ..)
17: (ASDF::DO-ONE-DEP #<ASDF:LOAD-OP (:VERBOSE NIL) {10031F8C21}> #<ASDF:SYSTEM "clsql-mysql"> #<CLOSURE (FLET ASDF::COLLECT) {1003FBBF19}> ASDF:COMPILE-OP "clsql-mysql" NIL)
18: ((FLET ASDF::DEP) ASDF:COMPILE-OP "clsql-mysql" NIL)
19: (ASDF::DO-DEP #<ASDF:LOAD-OP (:VERBOSE NIL) {10031F8C21}> #<ASDF:SYSTEM "clsql-mysql"> #<CLOSURE (FLET ASDF::COLLECT) {1003FBBF19}> ASDF:COMPILE-OP ("clsql-mysql"))
--more--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
press 1 to abort ... check the source code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mac-Daddy:clsql michaelvelik$ find . -name '*lisp' | xargs grep -n 'atol64'
./uffi/clsql-uffi-package.lisp:28: #:atol64
./uffi/clsql-uffi.lisp:82:(uffi:def-function "atol64"
./uffi/clsql-uffi.lisp:131: (let ((low32 (atol64 char-ptr high32-ptr))
Mac-Daddy:clsql michaelvelik$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now I'm mystified, the code is there I checked the file ....
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(uffi:def-function "atol64"
((str (* :unsigned-char))
(high32 (* :unsigned-int)))
:module "clsql-uffi"
:returning :unsigned-int)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If anyone has any insight into what I might be doing wrong, I would appreciate any help.
Michael Velik
-- take this REPL, brother, may it serve you well