[R] RMySQL : Not loading

Don MacQueen macq at llnl.gov
Wed Jan 14 20:02:16 CET 2004


Geoff,

I can offer a work-around.

I have been encountering this same problem on one of two OS X 
systems, and one Solaris system. I've been corresponding with the 
RMySQL maintainer, David James (who I CC'd), and he knows everything 
that I do (and more, of course!). We don't have a proper solution 
yet, but here is a work-around that I found.

To get RMySQL working on the OS X system where it did not, I 
installed the gnugetopt package from fink, and then explicitly told 
RMySQL about it when installing RMySQL. In order to do this you first 
need to have a local copy of the RMySQL distribution file, 
RMySQL_0.5-3.tar.gz. Then, in the directory where that file resides 
define environment variables PKG_CPPFLAGS and PKG_LIBS so that:

    [198]% printenv | grep PKG
    PKG_CPPFLAGS=-I/usr/local/mysql/include -I/sw/include/gnugetopt
    PKG_LIBS=-L/usr/local/mysql/lib -lmysqlclient -lgnugetopt

Then,

R CMD INSTALL --configure-args='--with-mysql-dir=/usr/local/mysql' 
RMySQL_0.5-3.tar.gz

Be sure to replace /usr/local/mysql with whatever is correct for you.

This is only a work-around; there are a number of reasons to believe 
that getopt_long should be present and available when RMySQL is 
installed--but as long as it's not, this is one way to get it.

I have mysql 4.0.16-standard (binary distribution downloaded from 
www.mysql.com),  R 1.8.1 Patched (2004-01-12) (installed from source 
code), and OS X 10.2.8. The gcc is:

[205]% gcc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
Thread model: posix
gcc version 3.3 20030304 (Apple Computer, Inc. build 1493)



On my other OS X system, where I did not encounter this problem, I'm 
still at R 1.8.0; the mysql is 4.0.15, and it is the version 
distributed by Server Logistics at 
http://www.macintoshhosting.net/mysql.php. That machine is OS X 
10.3.something. I don't have the gcc version information handy.

David James has a successful installation with mysql installed from 
fink in 10.2.8, and R 1.8.1.

I hope this helps; stay tuned as I plan to keep working on this.

-Don


At 12:33 AM +1300 1/15/04, Geoff Grimwood wrote:
>Hello,
>
>I'm tearing my hair out over this. Any help will be very much 
>appreciated. It's been two long nights battling with RMySQL.
>
>>  library(RMySQL)
>Error in dyn.load(x, as.logical(local), as.logical(now)) :
>         unable to load shared library 
>"/usr/local/lib/R/library/RMySQL/libs/RMySQL.so":
>   dlcompat: dyld: /usr/local/lib/R/bin/R.bin Undefined symbols:
>_getopt_long
>Error in library(RMySQL) : .First.lib failed
>
>I am running Mac OS 10.2.8, R 1.8.1, RMySQL 0.5-3, MySQL 4.0.17. R 
>and MySQL are well otherwise
>
>I have moved away from the Fink sourced (ie /sw) version of R and 
>MySQL to regular /usr/local types. Mainly because the Fink R is 1.7 
>and can't do the MySQL business. And I was wondering if the RMySQL 
>install was comin to grief because it couldn't find the /sw mysql 
>files.
>
>Anyway, RMySQL seems to have install OK. I see it with 
>installed.packages(). There was the apparent inability to find 
>lmysqlclient and mysql.h but that seems to be a red herring (see 
>below).
>
>Regards
>
>Geoff Grimwood
>Wellington
>New Zealand
>
>
>[SIDLAW02:~/Desktop] geoff% sudo R CMD INSTALL 
>--configure-args='--with-mysql-inc=/usr/local/mysql/include 
>--with-mysql-lib=/usr/local/mysql/lib' RMySQL_0.5-3.tar.gz
>* Installing *source* package 'RMySQL' ...
>creating cache ./config.cache
>checking how to run the C preprocessor... cc -E
>checking for mysql_init in -lmysqlclient... no
>checking for mysql.h... no
>updating cache ./config.cache
>creating ./config.status
>creating src/Makevars
>** libs
>gcc -no-cpp-precomp -I/usr/local/lib/R/include 
>-I/usr/local/mysql/include -I/sw/include   -fno-common  -g -O2 -c 
>RS-DBI.c -o RS-DBI.o
>gcc -no-cpp-precomp -I/usr/local/lib/R/include 
>-I/usr/local/mysql/include -I/sw/include   -fno-common  -g -O2 -c 
>RS-MySQL.c -o RS-MySQL.o
>gcc -bundle -flat_namespace -undefined suppress -L/sw/lib 
>-L/usr/local/lib -o RMySQL.so RS-DBI.o RS-MySQL.o 
>-L/usr/local/mysql/lib -lmysqlclient -lz -lcc_dynamic 
>-L/usr/local/lib/R/bin -lR
>[SNIP]
>
>SIDLAW02:library/RMySQL/libs] geoff% ls -ltr
>total 500
>-rwxr-xr-x    1 root     staff      254816 Jan 14 23:45 RMySQL.so
>-rwxr-xr-x    1 root     staff      249856 Jan 14 23:46 libmySQL.dll
>-rw-r--r--    1 root     staff         155 Jan 14 23:46 libMySQL_4.0.16.txt
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA




More information about the R-help mailing list