[plt-scheme] Re: error trying to use mysqlclient.ss

From: Geoffrey S. Knauth (geoff at knauth.org)
Date: Fri Jun 26 02:09:28 EDT 2009

On Jun 25, 2009, at 23:43, Scott Hickey wrote:
> I would like to get a mysql client working with the current version of
> PLT-Scheme.

I am using DrScheme version 4.2.0.2-svn27may2009 [3m], and the  
interface to MySQL5 is working on my Mac.  I can try Ubuntu Jaunty  
tomorrow, but last I checked, that worked too.  The setup script  
mentioned below probably needs tweaking for Linux.

> I tried used the code mentioned in a post a few months back at
> http://knauth.org/plt/mysql/
>
> (require (lib "mysqlclient.ss" "mysqlclient"))
> load-extension: couldn't open "/usr/local/plt/lib/plt/collects/
> mysqlclient/compiled/native/i386-linux/3m/mysqlclient_ss.so" (/usr/
> local/plt/lib/plt/collects/mysqlclient/compiled/native/i386-linux/3m/
> mysqlclient_ss.so: undefined symbol: mysql_field_count)

After I build DrScheme from SVN (through make install), I do the  
following:

cd ~/test/plt/projects/mysqlclient
./setup svn

The mysqlclient directory looks like this:

$ find . -ls
11177982        0 drwxr-xr-x    9 gknauth  staff         306 Jun 26  
02:01 .
10822037        8 -rw-r--r--    1 gknauth  wheel         824 Sep  6   
2007 ./c-syntax-transformer.ss
10821995       16 -rw-r--r--    1 gknauth  wheel        4437 Sep  6   
2007 ./c-syntax.ss
11194697        0 drwxr-xr-x    5 gknauth  staff         170 Sep  9   
2007 ./copied-headers
11194699        8 -rw-r--r--    1 gknauth  staff        3866 May 28  
06:07 ./copied-headers/errmsg.h
11194698       72 -rw-r--r--    1 gknauth  staff       33581 May 28  
06:07 ./copied-headers/mysql.h
11194700       40 -rw-r--r--    1 gknauth  staff       16845 May 28  
06:07 ./copied-headers/mysqld_error.h
17123018       40 -rw-r--r--    1 gknauth  staff       18412 Nov 13   
2007 ./mysqlclient.ss
27239871        8 -rw-r--r--    1 gknauth  staff          82 Mar  2   
2008 ./README
85231228        8 -rwxr-xr-x    1 gknauth  staff        1303 Mar  3  
15:52 ./setup
11195294        0 drwxr-xr-x    4 gknauth  staff         136 Mar  2   
2008 ./test
11195304        8 -rw-r--r--    1 gknauth  staff         102 Sep  9   
2007 ./test/gcc-test.c
11195301        0 drwxr-xr-x    3 gknauth  staff         102 Sep  9   
2007 ./test/obscure
11195315        8 -rw-r--r--    1 gknauth  staff          38 Sep  9   
2007 ./test/obscure/hidden-message.h

The ./setup script I wrote looks like this:

#!/bin/sh

LPLT=/usr/local/plt
SPLT="/Applications/PLT Scheme v4.2"

# I run this after I have rebuilt DrScheme from SVN sources,
# to make sure I still have connectivity to MySQL.

usage () {
   echo "usage: setup {svn|std}"
   echo ""
   echo "  Builds and installs mysqlclient.ss."
   echo ""
   echo "  setup svn    # for $LPLT"
   echo "  setup std    # for $SPLT"
   echo ""
   exit 1
}

if [ $# -ne 1 ]; then
   usage
fi

case $1 in
   svn) BASE=${LPLT} ;;
   std) BASE="${SPLT}" ;;
   *) echo $usage; exit 1 ;;
esac

MZC="${BASE}/bin/mzc"
TARGET="${BASE}/collects/mysqlclient"
NATIVEDIR="${TARGET}/compiled/native/i386-macosx/3m"
MYSQLINC=/opt/local/include/mysql5/mysql
MYSQLLDIR=/opt/local/lib/mysql5/mysql
MYSQLLIB=libmysqlclient.dylib
MYSQLHFILES="mysql.h errmsg.h mysqld_error.h"
DBOPTS="-v --save-temps --debug ++ccf -save-temps"

mkdir -p "${TARGET}"
mkdir -p copied-headers
for i in ${MYSQLHFILES}; do
   cp ${MYSQLINC}/$i copied-headers/
done

cp c-syntax-transformer.ss "${TARGET}"
cp c-syntax.ss "${TARGET}"
cp mysqlclient.ss "${TARGET}"

echo Generated C files will be in:
echo "  ${NATIVEDIR}"
echo ""
echo cd "${TARGET}"
cd "${TARGET}"
CMD="${MZC} ${DBOPTS} --auto-dir --extension ++ldf ${MYSQLLDIR}/$ 
{MYSQLLIB} \
   ++cppf -I${MYSQLINC} ++ccf -I${MYSQLINC} mysqlclient.ss"
echo ${CMD}
${CMD}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090626/7ce29860/attachment.html>

Posted on the users mailing list.