[R] RMySQL load error

Dick Beyer dbeyer at u.washington.edu
Wed Mar 21 00:10:25 CET 2007


I got some great help from Phil Spector on how to solve this:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/mysql

and/or add this to the /usr/bin/R script.

Life is good,
Dick
*******************************************************************************
Richard P. Beyer, Ph.D.	University of Washington
Tel.:(206) 616 7378	Env. & Occ. Health Sci. , Box 354695
Fax: (206) 685 4696	4225 Roosevelt Way NE, # 100
			Seattle, WA 98105-6099
http://depts.washington.edu/ceeh/ServiceCores/FC5/FC5.html
http://staff.washington.edu/~dbeyer
*******************************************************************************

On Tue, 20 Mar 2007, Dick Beyer wrote:

> I'm having trouble getting RMySQL to load.  I was able to build it and
> install it (RMySQL_0.5-11.tar.gz).  I was also able to build and install
> mysql-5.0.37.
>
> I've read many postings about this but have not found a mention of my
> particular problem (some closely related).  I get the "unable to load shared
> library, no such file" error, but all the files do exist, RMySQL.so and
> libmysqlclient.so.15.
>
> I set these environment variables:
>
> PKG_LIBS=-L/usr/local/lib/mysql -lmysqlclient
> PKG_CPPFLAGS=-I/usr/local/include/mysql
>
> If anyone had any suggestions, ideas, or pointers, I would be eternally
> grateful for the help.  Here is the relevant output from my R session and
> from building the RMySQL package (I am using gcc version 3.4.6 and RedHat
> AS4 2.6.9-42.0.10.ELsmp):
>
>> 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':
>  libmysqlclient.so.15: cannot open shared object file: No such file or
> directory Error in library(RMySQL) : .First.lib failed for 'RMySQL'
>
>> sessionInfo()
> R version 2.4.1 (2006-12-18) x86_64-redhat-linux-gnu
>
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages: [1] "stats"     "graphics"  "grDevices" "utils"
> "datasets"  "methods" [7] "base"
>
> other attached packages:
>     DBI "0.1-12"
>
> [root at ws-bioinf-01 MySQL]# ls -l /usr/lib64/R/library/RMySQL/libs/ total 124
> -rwxr-xr-x  1 root root 122497 Mar 20 11:49 RMySQL.so
>
> [root at ws-bioinf-01 MySQL]# ll /usr/local/lib/mysql/ total 2632 -rw-r--r--  1
> root root  27208 Mar 20 11:47 libdbug.a -rw-r--r--  1 root root  71144 Mar
> 20 11:47 libheap.a -rw-r--r--  1 root root 465944 Mar 20 11:47 libmyisam.a
> -rw-r--r--  1 root root  41842 Mar 20 11:47 libmyisammrg.a -rw-r--r--  1
> root root 734880 Mar 20 11:47 libmysqlclient.a -rwxr-xr-x  1 root root
> 873 Mar 20 11:47 libmysqlclient.la lrwxrwxrwx  1 root root     24 Mar 20
> 11:47 libmysqlclient.so -> libmysqlclient.so.15.0.0 lrwxrwxrwx  1 root root
> 24 Mar 20 11:47 libmysqlclient.so.15 -> libmysqlclient.so.15.0.0 -rwxr-xr-x
> 1 root root 495952 Mar 20 11:47 libmysqlclient.so.15.0.0 -rw-r--r--  1 root
> root 349328 Mar 20 11:47 libmystrings.a -rw-r--r--  1 root root 450234 Mar
> 20 11:47 libmysys.a -rw-r--r--  1 root root  11962 Mar 20 11:47 libvio.a
>
>
> [root at ws-bioinf-01 MySQL]# R CMD build RMySQL * checking for file
> 'RMySQL/DESCRIPTION' ... OK * preparing 'RMySQL': * checking DESCRIPTION
> meta-information ... OK * cleaning src * removing junk files * checking for
> LF line-endings in source files * checking for empty or unneeded directories
> * building 'RMySQL_0.5-11.tar.gz'
>
> [root at ws-bioinf-01 MySQL]# R CMD INSTALL RMySQL_0.5-11.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/lib64/R/include -I/usr/local/include/mysql -I/usr/local/include
> -fpic -O2 -g -std=gnu99 -c RS-DBI.c -o RS-DBI.o gcc -I/usr/lib64/R/include
> -I/usr/lib64/R/include -I/usr/local/include/mysql -I/usr/local/include
> -fpic -O2 -g -std=gnu99 -c RS-MySQL.c -o RS-MySQL.o gcc -shared -Wl,-O1 -o
> RMySQL.so RS-DBI.o RS-MySQL.o -L/usr/local/lib/mysql -lmysqlclient -lz
> -L/usr/lib64/R/lib -lR ** R ** inst ** save image Loading required package:
> DBI [1] "dbObjectId" [1] "format" [1] "show" [1] "print" [1] "MySQLObject"
> [1] "MySQLDriver" [1] "dbUnloadDriver" [1] "dbGetInfo" [1]
> "dbListConnections" [1] "summary" [1] "MySQLConnection" [1] "dbConnect" [1]
> "dbConnect" [1] "dbConnect" [1] "dbDisconnect" [1] "dbSendQuery" [1]
> "dbGetQuery" [1] "dbGetException" [1] "dbGetInfo" [1] "dbListResults" [1]
> "summary" [1] "dbListTables" [1] "dbReadTable" [1] "dbWriteTable" [1]
> "dbWriteTable" [1] "dbExistsTable" [1] "dbRemoveTable" [1] "dbListFields"
> [1] "dbCommit" [1] "dbRollback" [1] "dbCallProc" [1] "MySQLResult" [1]
> "dbClearResult" [1] "fetch" [1] "fetch" [1] "dbGetInfo" [1] "dbGetStatement"
> [1] "dbListFields" [1] "dbColumnInfo" [1] "dbGetRowsAffected" [1]
> "dbGetRowCount" [1] "dbHasCompleted" [1] "dbGetException" [1] "summary" [1]
> "dbDataType" [1] "make.db.names" [1] "SQLKeywords" [1] "isSQLKeyword" [1]
> "dbApply" [1] "dbApply" ** help
>>>> Building/Updating help pages for package 'RMySQL'
>     Formats: text html latex example
>  MySQL                             text    html    latex   example
>  MySQLConnection-class             text    html    latex   example
>  MySQLDriver-class                 text    html    latex   example
>  MySQLObject-class                 text    html    latex   example
>  MySQLResult-class                 text    html    latex   example
>  RMySQL-package                    text    html    latex   example
>  S4R                               text    html    latex   example
>  dbApply-methods                   text    html    latex   example
>  dbApply                           text    html    latex   example
>  dbBuildTableDefinition            text    html    latex
>  dbCallProc-methods                text    html    latex
>  dbCommit-methods                  text    html    latex   example
>  dbConnect-methods                 text    html    latex   example
>  dbDataType-methods                text    html    latex   example
>  dbDriver-methods                  text    html    latex   example
>  dbGetInfo-methods                 text    html    latex   example
>  dbListTables-methods              text    html    latex   example
>  dbObjectId-class                  text    html    latex   example
>  dbReadTable-methods               text    html    latex   example
>  dbSendQuery-methods               text    html    latex   example
>  dbSetDataMappings-methods         text    html    latex   example
>  fetch-methods                     text    html    latex   example
>  isIdCurrent                       text    html    latex   example
>  make.db.names-methods             text    html    latex   example
>  mysqlDBApply                      text    html    latex   example
>  mysqlSupport                      text    html    latex
>  safe.write                        text    html    latex   example
>  summary-methods                   text    html    latex ** building package
> indices ... * DONE (RMySQL)
>
> Thanks very much, Dick
> *******************************************************************************
> Richard P. Beyer, Ph.D. University of Washington Tel.:(206) 616 7378 Env. &
> Occ. Health Sci. , Box 354695 Fax: (206) 685 4696 4225 Roosevelt Way NE, #
> 100
>   Seattle, WA 98105-6099
> http://depts.washington.edu/ceeh/ServiceCores/FC5/FC5.html
> http://staff.washington.edu/~dbeyer
> *******************************************************************************
>
>
>



More information about the R-help mailing list