[R] RMySQL install

David James dj at research.bell-labs.com
Mon Jan 30 23:45:48 CET 2006


Michaell Taylor wrote:
> 
> 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':
>   /usr/lib64/R/library/RMySQL/libs/RMySQL.so: undefined symbol: 
> mysql_field_count
> 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
> status
> 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
> /usr/lib/mysql/libmysqlclient.so.14.0.0
> /usr/lib/mysql/libmysqlclient.so.14
> /usr/lib64/mysql/libmysqlclient.so.10.0.0
> /usr/lib64/mysql/libmysqlclient.so.10
> /usr/lib64/mysql/libmysqlclient.so.14.0.0
> /usr/lib64/mysql/libmysqlclient.so.14
> /usr/lib64/mysql/libmysqlclient.so
> /usr/lib64/mysql3/mysql/libmysqlclient.so.10.0.0
> /usr/lib64/mysql3/mysql/libmysqlclient.so.10
> /usr/lib64/mysql3/mysql/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
> /usr/lib64/mysql3/
> 
> Just to be sure...
> 
> [root at BX mtaylor]# printenv PKG_CPPFLAGS
> -I/usr/include/mysql
> 
> [root at BX mtaylor]# printenv PKG_LIBS
> -L/usr/lib64/mysql
> 
> (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
> .
> snip
> .
> ** building package indices ...
> * DONE (RMySQL)
> 
> 
> [root at BX mtaylor]# /sbin/ldconfig -v | grep mysql
> /usr/lib/mysql:
>         libmysqlclient.so.14 -> libmysqlclient.so.14.0.0
>         libmysqlclient_r.so.14 -> libmysqlclient_r.so.14.0.0
> /usr/lib64/mysql:
>         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.
> Principal
> Boxwood Means, Inc.
> 203.653.4100
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

We did have similar problems, but it turned out to be a MySQL 
installation problem -- for unknown reasons (to me, at least) 
the symbolic link to libmysqlclient.so.14 was pointing nowhere.
After re-installing the client and devel RPMS things worked fine:

export PKG_LIBS='-L/usr/lib64/mysql  -lmysqlclient'
export PKG_CPPFLAGS=-I/usr/include/mysql

R CMD INSTALL -l /tmp/R RMySQL_0.5-7.tar.gz
...

> library(RMySQL, lib.loc="/tmp/R")
Loading required package: DBI
> sessionInfo()
R version 2.2.1, 2005-12-20, x86_64-unknown-linux-gnu

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils" "datasets"
[7] "base"

other attached packages:
RMySQL     DBI
"0.5-7" "0.1-9"


Hope this helps,

-- 
David




More information about the R-help mailing list