[R] RMySQL under FreeBSD 4.8 - is solution acceptable ????

Arend P. van der Veen apv at capital.net
Fri Mar 12 18:28:44 CET 2004


Hi,

I had been having problems with RMySQL 0.5-3 under FreeBSD 4.8.  I think
I have found a work around but wanted to see if anybody had any
comments.  This may also be applicable to OS X.  The error I got was:

> library(RMySQL)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
        unable to load shared library
"/usr/local/R/lib/R/library/RMySQL/libs/RMySQL.so":
  /usr/local/R/lib/R/library/RMySQL/libs/RMySQL.so: Undefined symbol
"getopt_long"
Error in library(RMySQL) : .First.lib failed
>

The problem was that getopt_long is undefined.  I read the README files
and found that this is may be a problem with non-gnu systems like
FreeBSD.  I have also heard that OS-X users have the same problem.

In the RMySQL distribution there is a new version of getopt.c.  I tried
to compile this with RMySQL by moving it to the src directory but was
not very successful. 

I finally decided to remove the code associate with getopt_long from the
driver and see what impact it would have.  I analyzed RS-MySQL and
disable the section of the program that uses getopt_long.  I made the
following patch to RS-MySQL.c:

243c243,244
< #ifndef WIN32
---
>   /*#ifndef WIN32*/
> #if 0 /* Arend van der Veen, Mar 12, 2004 */

I have been able to competely determine what impact this will have.  I
use a ~/.my.cnf file with connection information in it to connect to my
mysql database:

lConnection <- dbConnect("MySQL",group="mysection")

I initially thought that this may stop working based on the modification
that I made but it still works.

What I am hoping to find out is what is the impact of this change on the
functionality of the driver.

Thanks,
Arend van der Veen




More information about the R-help mailing list