[R] Install RMySQL with R 2.4.0

Joe Byers joe-byers at utulsa.edu
Wed Nov 8 19:27:02 CET 2006


All,

After staring at this error message for an hour or so yesterday and this 
morning.  I decided to try something else.  Low and behold trying to 
build the package in cygwin causes R to try and build under linux/unix 
not windows.  I went to the command prompt and was able to build the 
package.

Download the RMySQL...tar.gz file and unzip somewhere like drive:/projects

Several notes
1.  make sure you have mysql directories on your computer somewhere with 
  the subdirs of include, bin, and lib.  You can just copy these from 
you actual server unless you want to install them.  I used d:/mysql/...
2.  Modify configure.win in RMySQL and Makevars.win ins RMySQL/src to 
have the mysql directories from (1)
3.  Copy and paste this script to a batch file and execute
**************
Rem build without --docs=normal tries to build chm help on windows this 
bombs
Rem if a zip program not installed the zip file will not be built
Rem go find the temp directory where R built the package and copy to 
../R/library
Rem temp directory will look something like C:\Temp\Rinst32098657\RMySQL

Rem if R bin directory in the path this will run otherwise add the 
drive:\Dir1\R\bin to the command
Rcmd build --binary \projects\RMySQL --docs=normal
***********************
4. Note that I have --docs=normal in the command line. This is needed to 
  get the package built.  Windows packages now default to chm files and 
RMySQL does not have any windows chm help files.  All txt, html, and 
latex help are built with this option.
5.  I am not sure where the RMySQL...zip file is stored, I think in 
...R\Bin.  I just copied the files from the temp\RinstXXXXXX\to the 
...\R\library to install.

This may or may  not work for you, it did for me.

I will try and update my website www.cba.utulsa.edu/byersj Research and 
Analytics section to include a link to the RMySQL zip file for others to 
download.

Good Luck
Joe


Joe Byers wrote:
> All,
> 
> I have tried to compile the RMySQL from source as specified in the 
> documentation.  I am receiving the following  errors
> ******************* beginning of cygwin window ****************************
> joe-byers at Byersj /cygdrive/d/Program Files/R/bin
> $ Rcmd build --binary ../library/RMySQL
> * checking for file '../library/RMySQL/DESCRIPTION' ... OK
> * preparing '../library/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 binary distribution
> WARNING
> * some HTML links may not be found
> installing R.css in c:/TEMP/Rinst346079904
> 
> Using auto-selected zip options ' RMySQL-HELP=ziponly'
> /bin/sh: latex: command not found
> /bin/sh: latex: command not found
> /bin/sh: latex: command not found
> 
> ---------- Making package RMySQL ------------
> ======================================================================
> RMySQL configure.win:
> * Using mysql libraries from d:/MySQL/lib/opt
> * Using mysql dll from d:/MySQL/bin
> * Copying runtime libMySQL.dll and libmysql.lib to inst/libs
> * Using an existing libmysql.a in d:/MySQL/lib/opt
> 
> joe-byers at Byersj /cygdrive/d/Program Files/R/bin
> $ Rcmd build --binary ../library/RMySQL
> * checking for file '../library/RMySQL/DESCRIPTION' ... OK
> * preparing '../library/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 binary distribution
> WARNING
> * some HTML links may not be found
> installing R.css in c:/TEMP/Rinst250866757
> 
> Using auto-selected zip options ' RMySQL-HELP=ziponly'
> /bin/sh: latex: command not found
> /bin/sh: latex: command not found
> /bin/sh: latex: command not found
> 
> ---------- Making package RMySQL ------------
> ======================================================================
> RMySQL configure.win:
> * Using mysql libraries from d:/MySQL/lib/opt
> * Using mysql dll from d:/MySQL/bin
> * Copying runtime libMySQL.dll and libmysql.lib to inst/libs
> * Using an existing libmysql.a in d:/MySQL/lib/opt
> ======================================================================
> /bin/sh: latex: command not found
>   adding build stamp to DESCRIPTION
> /bin/sh: latex: command not found
> /bin/sh: latex: command not found
>   making DLL ...
> /bin/sh: latex: command not found
> making RS-DBI.d from RS-DBI.c
> making RS-MySQL.d from RS-MySQL.c
> gcc  -Id:/mysql/include -Id:/PROGRA~1/R/include  -Wall -O2 -std=gnu99 
> -c RS-DB
> I.c -o RS-DBI.o
> gcc  -Id:/mysql/include -Id:/PROGRA~1/R/include  -Wall -O2 -std=gnu99 
> -c RS-My
> SQL.c -o RS-MySQL.o
> windres --include-dir d:/PROGRA~1/R/include  -i RMySQL_res.rc -o 
> RMySQL_res.o
> gcc  -shared -s  -o RMySQL.dll RMySQL.def RS-DBI.o RS-MySQL.o 
> RMySQL_res.o  -Ld:
> /PROGRA~1/R/bin -Ld:/mysql/lib/opt -lmysql -liberty  -lR
> RS-MySQL.o:RS-MySQL.c:(.text+0xf): undefined reference to 
> `_mysql_get_client_inf
> o'
> RS-MySQL.o:RS-MySQL.c:(.text+0x26b): undefined reference to `_mysql_init'
> RS-MySQL.o:RS-MySQL.c:(.text+0x288): undefined reference to `_mysql_options'
> RS-MySQL.o:RS-MySQL.c:(.text+0x2fd): undefined reference to `_mysql_options'
> RS-MySQL.o:RS-MySQL.c:(.text+0x33e): undefined reference to `_mysql_options'
> RS-MySQL.o:RS-MySQL.c:(.text+0x593): undefined reference to 
> `_mysql_real_connect
> 'S-MySQL.o:RS-MySQL.c:(.text+0x17ab): undefined reference to 
> `_mysql_get_client_
> RS-MySQL.o:RS-MySQL.c:(.text+0x76e): undefined reference to `_mysql_options'
> RS-MySQL.o:RS-MySQL.c:(.text+0x77f): undefined reference to 
> `_mysql_error'ost_in
> RS-MySQL.o:RS-MySQL.c:(.text+0x7dc): undefined reference to `_mysql_close'
> RS-MySQL.o:RS-MySQL.c:(.text+0xa7e): undefined reference to 
> `_mysql_close'erver_
> RS-MySQL.o:RS-MySQL.c:(.text+0xaff): undefined reference to 
> `_mysql_fetch_fields
> 'S-MySQL.o:RS-MySQL.c:(.text+0x19ac): undefined reference to 
> `_mysql_get_proto_i
> RS-MySQL.o:RS-MySQL.c:(.text+0xb18): undefined reference to 
> `_mysql_field_count'
> RS-MySQL.o:RS-MySQL.c:(.text+0x19bd): undefined reference to 
> `_mysql_thread_id'
> RS-MySQL.o:RS-MySQL.c:(.text+0xf14): undefined reference to 
> `_mysql_fetch_row''
> RS-MySQL.o:RS-MySQL.c:(.text+0xf2e): undefined reference to 
> `_mysql_fetch_length
> s'-MySQL.o:RS-MySQL.c:(.text+0x27cd): undefined reference to 
> `_mysql_fetch_lengt
> RS-MySQL.o:RS-MySQL.c:(.text+0x1141): undefined reference to `_mysql_errno'
> RS-MySQL.o:RS-MySQL.c:(.text+0x12d5): undefined reference to 
> `_mysql_errno'_id'
> RS-MySQL.o:RS-MySQL.c:(.text+0x12e0): undefined reference to 
> `_mysql_error'to-im
> RS-MySQL.o:RS-MySQL.c:(.text+0x1356): undefined reference to 
> `_mysql_fetch_row'
> RS-MySQL.o:RS-MySQL.c:(.text+0x1362): undefined reference to 
> `_mysql_free_result
> 'nfo: resolving _R_NamesSymbol by linking to __imp__R_NamesSymbol 
> (auto-import)
> RS-MySQL.o:RS-MySQL.c:(.text+0x143f): undefined reference to `_mysql_query'
> RS-MySQL.o:RS-MySQL.c:(.text+0x145a): undefined reference to 
> `_mysql_use_result'
> Info: resolving _R_NaInt by linking to __imp__R_NaInt (auto-import)
> RS-MySQL.o:RS-MySQL.c:(.text+0x146e): undefined reference to 
> `_mysql_field_count
> 'nfo: resolving _R_DotsSymbol by linking to __imp__R_DotsSymbol 
> (auto-import)
> RS-MySQL.o:RS-MySQL.c:(.text+0x152d): undefined reference to `_mysql_query'
> RS-MySQL.o:RS-MySQL.c:(.text+0x155d): undefined reference to `_mysql_error'
> RS-MySQL.o:RS-MySQL.c:(.text+0x159a): undefined reference to 
> `_mysql_affected_ro
> ws'e[1]: *** [all] Error 2
> RS-MySQL.o:RS-MySQL.c:(.text+0x17ab): undefined reference to 
> `_mysql_get_client_
> info'nstallation of RMySQL failed ***
> RS-MySQL.o:RS-MySQL.c:(.text+0x1959): undefined reference to 
> `_mysql_get_host_in
> fo'oving 'c:/TEMP/Rinst346079904/RMySQL'
> RS-MySQL.o:RS-MySQL.c:(.text+0x1981): undefined reference to 
> `_mysql_get_server_
> info'tallation failed
> RS-MySQL.o:RS-MySQL.c:(.text+0x19ac): undefined reference to 
> `_mysql_get_proto_i
> nfo'
> RS-MySQL.o:RS-MySQL.c:(.text+0x19bd): undefined reference to 
> `_mysql_thread_id'
> RS-MySQL.o:RS-MySQL.c:(.text+0x265d): undefined reference to 
> `_mysql_fetch_row'
> RS-MySQL.o:RS-MySQL.c:(.text+0x2687): undefined reference to `_mysql_errno'
> RS-MySQL.o:RS-MySQL.c:(.text+0x27cd): undefined reference to 
> `_mysql_fetch_lengt
> hs'
> RS-MySQL.o:RS-MySQL.c:(.text+0x2b1d): undefined reference to 
> `_mysql_insert_id'
> Info: resolving _R_RowNamesSymbol by linking to __imp__R_RowNamesSymbol 
> (auto-im
> port)
> Info: resolving _R_ClassSymbol by linking to __imp__R_ClassSymbol 
> (auto-import)
> Info: resolving _R_NamesSymbol by linking to __imp__R_NamesSymbol 
> (auto-import)
> Info: resolving _R_NilValue by linking to __imp__R_NilValue (auto-import)
> Info: resolving _R_NaReal by linking to __imp__R_NaReal (auto-import)
> Info: resolving _R_NaInt by linking to __imp__R_NaInt (auto-import)
> Info: resolving _R_NaString by linking to __imp__R_NaString (auto-import)
> Info: resolving _R_DotsSymbol by linking to __imp__R_DotsSymbol 
> (auto-import)
> collect2: ld returned 1 exit status
> make[3]: *** [RMySQL.dll] Error 1
> make[2]: *** [srcDynlib] Error 2
> make[1]: *** [all] Error 2
> make: *** [pkg-RMySQL] Error 2
> *** Installation of RMySQL failed ***
> 
> Removing 'c:/TEMP/Rinst250866757/RMySQL'
> ERROR
> * installation failed
> 
> 
> joe-byers at Byersj /cygdrive/d/Program Files/R/bin
> $
> ****************** end if cygwin window ***********************
> 
> Any help would be greatly appreciated.
> 
> Thank you
> Joe
> 
> Dan Rie wrote:
>  > I have not replied to the list with this response, because, it's kind 
> of vacuous.  But here are my thoughts:
>  >
>  > When I was working on getting RMySQL installed, I decided to do the 
> install on a machine on my LAN that did not have MySQL installed.  I 
> retrieved all the tools to do R builds with Windows (the biggest hurdle 
> I faced in the whole process of trying to install RMySQL was getting 
> prepared to build R packages under Windows).  So far I have not 
> succeeded on that machine. However, I did succeed on another machine 
> that had MySQL installed.
>  >
>  > So, I suggest that there are two possible approaches:  Copy the MySQL 
> files that you will need onto the machine that does not have MySQL 
> installed. That may sound weird, but it is actually not all that 
> demanding.  On Windows, these are the folders like "C:\Program 
> Files\MySQL\MYSQLS~1.0\lib", "C:\Program 
> Files\MySQL\MYSQLS~1.0\include", and "C:\Program 
> Files\MySQL\MYSQLS~1.0\bin" (there may be a few others as well).  You 
> will need to have the various header files (for C) and the library files 
> and definitions.  I was working with Windows and I think that you are 
> working with Linux, but the principle is the same - you need to have the 
> MySQL resource files available in order to build the RMySQL package. 
> There are lots of clues in the RMySQL readme and help files.
>  >
>  > It's probably easier to just install MySQL on your machine and then 
> you will have the files appropriate to building RMySQL available.  I 
> don't think that you actually need to have the same version of MySQL 
> installed as you may be accessing on a server.  However, you do have to 
> have some version of the libmysql library to link with the RMySQL 
> package in order to generate the appropriate messages to send to the server.
>  >
>  > It's not really very hard to install MySQL on your machine, even if 
> you don't plan to use it.  I believe that when you install it it will 
> default to running the MySQL server on boot, but you can fix that easily 
> if you don't want it running (a possible security and configuration issue).
>  >
>  > If you don't have MySQL installed on your machine at all, then you 
> have fewer issues of incompatibility to worry about than I did.  Perhaps 
> a fresh update of the RMySQL package will deliver a working install.  I 
> know that the package was recently rebuilt for distribution, and the 
> latest version may resolve the problem if it is different from the one 
> that you are using.
>  >
>  > If you are still having a problem, send more specific info, and I'll 
> try to comment, but I am certainly no expert in R package installation 
> (although I do have this one success to my credit).
>  >
>  > Dan Rie
>  > Scituate, MA
>  >
>  >
>  > ----- Original Message ----- From: "Joe Byers" <joe-byers at utulsa.edu>
>  > To: "Dan Rie" <drie at portfoliointelligence.com>
>  > Cc: <r-help at stat.math.ethz.ch>
>  > Sent: Monday, November 06, 2006 6:25 PM
>  > Subject: Re: [R] Install RMySQL with R 2.4.0
>  >
>  >
>  >>
>  >> Dan Rie wrote:
>  >>> I had a very similar problem installing RMySQL with R 2.4.0 on 
> Windows XP.
>  >>> I beleive that the cause may have been that the RMySQL build used a 
> slightly older version of the MySQL compiled library functions than was 
> installed on my machine (I updated both MySQL, DBI, and RMySQL to latest 
> versions prior to attempting the install).  Since RMySQL links to the 
> compiled MySQL library, slight differences could affect the linked 
> references.  I do not know that this is the source of the problem, but 
> it was one obvious point of fraility.
>  >>>
>  >>> The solution, suggested by Prof. Brian Ripley on the r-sig-db list, 
> was to rebuild the RMySQL library from source prior to doing the 
> install. After completing the recompilation of the RMySQL package, the 
> install worked as it should.  I believe that the binaries for RMySQL may 
> have been updated since I had those problems, so you might also want to 
> make sure that you have the latest version of all the packages.
>  >>>
>  >> What do you do if you are accessing the Mysql server remotely from 
> the machine that R is install upon.  No MYsql libraries or other files 
> are stored on either of my computers.
>  >>
>  >> Thank you
>  >>
>  >>>
>  >>> Date: Sat, 04 Nov 2006 23:53:11 -0600
>  >>> From: "Joe W. Byers" <Joe-Byers at utulsa.edu>
>  >>> Subject: Re: [R] Install RMySQL with R 2.4.0
>  >>> To: r-help at stat.math.ethz.ch
>  >>> Message-ID: <eiju5b$ruk$1 at sea.gmane.org>
>  >>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>  >>>
>  >>> Seth Falcon wrote:
>  >>>> "Joe W. Byers" <Joe-Byers at utulsa.edu> writes:
>  >>>>
>  >>>>> I am having trouble as well with the new version of R 2.4.  I 
> downloaded
>  >>>>> the gz file from the cran website,  followed the instructions in the
>  >>>>> README.win file and installed RMySQL.  I have mysql installed under
>  >>>>> c:\mysql not the program files directory which is the only 
> difference.
>  >>>>>
>  >>>>> I get the following error when I attempt to connect to the MySQL Db
>  >>>>>  > ## open a connection to a MySQL database
>  >>>>>  > con <- dbConnect(dbDriver("MySQL"),host='localhost',
>  >>>>> + username='XXXX',dbname = 'StorageSims');
>  >>>>> Error in function (classes, fdef, mtable)  :
>  >>>>>          unable to find an inherited method for function "dbConnect",
>  >>>>> for signature "MySQLDriver"
>  >>>>>  >
>  >>>>>
>  >>>>> Any help will be appreciated.  I would like to note that there are no
>  >>>>> problems with RMySQL on my linux system, only on XP's.
>  >>>>
>  >>>> Just to make sure:
>  >>>>
>  >>>> Before trying the code you posted, you did library("RMySQL"), right?
>  >>> YES
>  >>>>
>  >>>> Also, what versions of DBI and RMySQL are you using?
>  >>> RMySQL from 
> http://cran.r-project.org/src/contrib/Descriptions/RMySQL.html
>  >>> DBI Version 0.1-10 according to the NEWS file in ../R/library
>  >>>>
>  >>>> ______________________________________________
>  >>>> 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
>  >>>> and provide commented, minimal, self-contained, reproducible code.
>  >>>>
>  >>>
>  >>>
>  >>>
>  >>
>  >>
>  >>
>  >
>  >
> 
> Dan Rie wrote:
>> I had a very similar problem installing RMySQL with R 2.4.0 on  Windows XP.
>> I beleive that the cause may have been that the RMySQL build used a slightly 
>> older version of the MySQL compiled library functions than was installed on 
>> my machine (I updated both MySQL, DBI, and RMySQL to latest versions prior 
>> to attempting the install).  Since RMySQL links to the compiled MySQL 
>> library, slight differences could affect the linked references.  I do not 
>> know that this is the source of the problem, but it was one obvious point of 
>> fraility.
>>
>> The solution, suggested by Prof. Brian Ripley on the r-sig-db list, was to 
>> rebuild the RMySQL library from source prior to doing the install.  After 
>> completing the recompilation of the RMySQL package, the install worked as it 
>> should.  I believe that the binaries for RMySQL may have been updated since 
>> I had those problems, so you might also want to make sure that you have the 
>> latest version of all the packages.
>>
>>
>> Date: Sat, 04 Nov 2006 23:53:11 -0600
>> From: "Joe W. Byers" <Joe-Byers at utulsa.edu>
>> Subject: Re: [R] Install RMySQL with R 2.4.0
>> To: r-help at stat.math.ethz.ch
>> Message-ID: <eiju5b$ruk$1 at sea.gmane.org>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Seth Falcon wrote:
>>> "Joe W. Byers" <Joe-Byers at utulsa.edu> writes:
>>>
>>>> I am having trouble as well with the new version of R 2.4.  I downloaded
>>>> the gz file from the cran website,  followed the instructions in the
>>>> README.win file and installed RMySQL.  I have mysql installed under
>>>> c:\mysql not the program files directory which is the only difference.
>>>>
>>>> I get the following error when I attempt to connect to the MySQL Db
>>>>  > ## open a connection to a MySQL database
>>>>  > con <- dbConnect(dbDriver("MySQL"),host='localhost',
>>>> + username='XXXX',dbname = 'StorageSims');
>>>> Error in function (classes, fdef, mtable)  :
>>>>          unable to find an inherited method for function "dbConnect",
>>>> for signature "MySQLDriver"
>>>>  >
>>>>
>>>> Any help will be appreciated.  I would like to note that there are no
>>>> problems with RMySQL on my linux system, only on XP's.
>>> Just to make sure:
>>>
>>> Before trying the code you posted, you did library("RMySQL"), right?
>> YES
>>> Also, what versions of DBI and RMySQL are you using?
>> RMySQL from http://cran.r-project.org/src/contrib/Descriptions/RMySQL.html
>> DBI Version 0.1-10 according to the NEWS file in ../R/library
>>> ______________________________________________
>>> 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
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>> ______________________________________________
>> 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
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list