[plt-scheme] Load-extension troubles

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jan 9 17:26:30 EST 2008

I think you need to add 

   ++ldl -lmysqlclient

to your mzc command.

Matthew

At Wed, 09 Jan 2008 16:07:38 -0500, David Van Horn wrote:
> This is not really a PLT Scheme question but more of a Unix question.
> 
> I have a library that uses the C FFI.  It uses mysql.h at compile time 
> and libmysqlclient at run time.  I compile as follows:
> 
>  > mzc \
> ++ccf -I/usr/src/apps/mysql-4.0.13/include/ \
> ++cppf -I/usr/src/apps/mysql-4.0.13/include/ \
> --auto-dir mysqlclient.ss
> mzc v371 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.
> "mysqlclient.ss":
>   [output to "./compiled/native/i386-linux/3m/mysqlclient.so"]
> 
> OK, now I want to use it:
> 
>  > mzscheme -L mysqlclient.ss foo
> Welcome to MzScheme v371 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.
> load-extension: couldn't open 
> "/local/bar/.plt-scheme/371/collects/foo/compiled/native/i386-
> linux/3m/mysqlclient.so" 
> (/local/bar/.plt-scheme/371/collects/foo/compiled/native/i386-
> linux/3m/mysqlclient.so: 
> undefined symbol: mysql_fetch_field)
> 
> My environment has the following in it, which is where libmysqlclient.so 
> is located:
> 
> LD_LIBRARY_PATH=/usr/src/apps/mysql-4.0.13/libmysql/.libs/
> LD_RUN_PATH=/usr/src/apps/mysql-4.0.13/libmysql/.libs/
> 
> And, the offending symbol is defined:
> 
> nm $LD_LIBRARY_PATH/libmysqlclient.so | grep 'mysql_fetch_field$'
> 00006960 T mysql_fetch_field
> 
> Does anyone have clues as to what incantation I need to get this off the 
> ground?
> 
> Thanks in advance,
> David



Posted on the users mailing list.