[R] RMySQL install

Michaell Taylor Michaell.Taylor at boxwoodmeans.com
Mon Jan 30 22:32:44 CET 2006

I am having trouble installing RMySQL on a clean install of Fedora Core 4 64 
bit on a dual dual core machine (that is, two dual core processors).  Seems 
like the LD_LIBRARY_PATH is incorrect, but I don't seem to have it quite 
right yet. 

There are a few mentions of this problem in google, but thus far none of the 
"fixes" and fixed my problem.  I've tried defining the LD_LIBRARY_PATH 
environment variable, and setting the PKG_CPPFLAGS, and  PKG_LIBS environment 
variables as well.  No luck so far.

(initially would not compile, but specification of the PKG_CPPFLAGS, and  
PKG_LIBS got the compile to complete without errors).  I still cannot load 
the library.  My error message is:

> library(RMySQL)
Loading required package: DBI
Error in dyn.load(x, as.logical(local), as.logical(now)) :
        unable to load shared library 
  /usr/lib64/R/library/RMySQL/libs/RMySQL.so: undefined symbol: 
Error in library(RMySQL) : .First.lib failed for 'RMySQL'

Trying to install the newest RMySQL on the newest R.

> version
platform x86_64-redhat-linux-gnu
arch     x86_64
os       linux-gnu
system   x86_64, linux-gnu
major    2
minor    2.1
year     2005
month    12
day      20
svn rev  36812
language R

I find libmysqlclient.so in the following location(s).

[root at BX mtaylor]# locate libmysqlclient.so


I set the LD_LIBRARY_PATH according to these results, then double checked that 
it was set.  (I also set it to /usr/lib64/mysql3/mysql as another iteration)

[root at BX mtaylor]# printenv LD_LIBRARY_PATH

Just to be sure...

[root at BX mtaylor]# printenv PKG_CPPFLAGS

[root at BX mtaylor]# printenv PKG_LIBS

(also tried PKG_LIBS=-L/usr/lib64/mysql3/mysql and PKG_LIBS=-L/usr/lib/mysql)

I recompiled the package each time with R CMD INSTALL RMySQL_0.5-7.tar.gz, but 
I always get the same error message.  

appears to install ....

[root at BX mtaylor]# R CMD INSTALL RMySQL_0.5-7.tar.gz
* Installing *source* package 'RMySQL' ...
creating cache ./config.cache
checking how to run the C preprocessor... cc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... no
checking for mysql.h... no
updating cache ./config.cache
creating ./config.status
creating src/Makevars
** libs
gcc -I/usr/lib64/R/include -I/usr/include/mysql -I/usr/local/include   -fPIC  
-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m64 -mtune=nocona -c 
RS-DBI.c -o RS-DBI.o
gcc -I/usr/lib64/R/include -I/usr/include/mysql -I/usr/local/include   -fPIC  
-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m64 -mtune=nocona -c 
RS-MySQL.c -o RS-MySQL.o
gcc -shared -L/usr/local/lib64 -o RMySQL.so RS-DBI.o RS-MySQL.o 
-L/usr/lib/mysql -lz  -L/usr/lib64/R/lib -lR
** R
** inst
** save image
** building package indices ...

[root at BX mtaylor]# /sbin/ldconfig -v | grep mysql
        libmysqlclient.so.14 -> libmysqlclient.so.14.0.0
        libmysqlclient_r.so.14 -> libmysqlclient_r.so.14.0.0
        libmysqlclient_r.so.10 -> libmysqlclient_r.so.10.0.0
        libmysqlclient.so.14 -> libmysqlclient.so.14.0.0
        libmysqlclient_r.so.14 -> libmysqlclient_r.so.14.0.0
        libmysqlclient.so.10 -> libmysqlclient.so.10.0.0

just to make sure the headers are actually in the specified location...

[root at BX mtaylor]# ls /usr/include/mysql
chardefs.h  m_ctype.h    my_dir.h     my_no_pthread.h  mysql_embed.h    
my_xml.h     rlshell.h      sslopt-longopts.h
errmsg.h    m_string.h   my_getopt.h  my_pthread.h     mysql.h          raid.h       
rltypedefs.h   sslopt-vars.h
history.h   my_alloc.h   my_global.h  my_semaphore.h   mysql_time.h     
readline.h   sql_common.h   tilde.h
keycache.h  my_config.h  my_list.h    mysql_com.h      mysql_version.h  
rlmbutil.h   sql_state.h    typelib.h
keymaps.h   my_dbug.h    my_net.h     mysqld_error.h   my_sys.h         
rlprivate.h  sslopt-case.h  xmalloc.h

There is a dial in here somewhere that I think I am turning the wrong 
direction - just can't see it.  Any experience with this one?

Michaell Taylor, PhD.
Boxwood Means, Inc.

More information about the R-help mailing list