Skip to content

RMySQL and MySQL 5.0

4 messages · Christopher Fonnesbeck, Simon Urbanek

#
Has anyone managed to get RMySQL working with MySQL 5.0? I have  
successfully built and installed the module, but run into an error  
when loading:

 > library(RMySQL)
Loading required package: DBI
Error in dyn.load(x, as.logical(local), as.logical(now)) :
	unable to load shared library '/Library/Frameworks/R.framework/ 
Resources/library/RMySQL/libs/RMySQL.so':
   dlopen(/Library/Frameworks/R.framework/Resources/library/RMySQL/ 
libs/RMySQL.so, 6): Symbol not found: _fprintf$LDBLStub
   Referenced from: /Library/Frameworks/R.framework/Resources/library/ 
RMySQL/libs/RMySQL.so
   Expected in: flat namespace
Error in library(RMySQL) : .First.lib failed for 'RMySQL'


--
Christopher J. Fonnesbeck

Population Ecologist, Marine Mammal Section
Fish & Wildlife Research Institute (FWC)
St. Petersburg, FL

Adjunct Assistant Professor
Warnell School of Forest Resources
University of Georgia
Athens, GA

T: 727.235.5570
E: chris at trichech.us


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20060113/d9a1c78b/smime.bin
#
On Jan 13, 2006, at 12:14 PM, Christopher Fonnesbeck wrote:

            
I didn't test MySQL, but AFAIR this problem is caused by compiler  
mismatch (it started with Xcode 2.2 I believe). Did you run sudo  
gcc_select 3.3 before compiling? The real reason for the above is  
that you're missing -lSystemStubs (which is static) when compiling  
RMySQL. Adding that to the LIBS for the package should work.

Cheers,
Simon
#
On Jan 13, 2006, at 12:22 PM, Simon Urbanek wrote:

            
I can confirm now that I was using gcc 3.3, but there were some  
warnings. Here is the build log:

* 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-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/ 
include -I/usr/local/mysql/include -I/usr/local/include   -fno- 
common  -g -O2 -c RS-DBI.c -o RS-DBI.o
gcc-3.3 -no-cpp-precomp -I/Library/Frameworks/R.framework/Resources/ 
include -I/usr/local/mysql/include -I/usr/local/include   -fno- 
common  -g -O2 -c RS-MySQL.c -o RS-MySQL.o
gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/local/lib - 
o RMySQL.so RS-DBI.o RS-MySQL.o -L/usr/local/mysql/lib -lmysqlclient - 
lz -lcc_dynamic -F/Library/Frameworks/R.framework/.. -framework R
ld: warning multiple definitions of symbol _compress
/usr/lib/libz.dylib(compress.o) definition of _compress
/Library/Frameworks/R.framework/../R.framework/R(compress.lo)  
definition of _compress
ld: warning multiple definitions of symbol _compressBound
/usr/lib/libz.dylib(compress.o) definition of _compressBound
/Library/Frameworks/R.framework/../R.framework/R(compress.lo)  
definition of _compressBound
ld: warning multiple definitions of symbol _compress2
/usr/lib/libz.dylib(compress.o) definition of _compress2
/Library/Frameworks/R.framework/../R.framework/R(compress.lo)  
definition of _compress2
ld: warning multiple definitions of symbol _deflateEnd
/usr/lib/libz.dylib(deflate.o) definition of _deflateEnd
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflateEnd
ld: warning multiple definitions of symbol _deflate
/usr/lib/libz.dylib(deflate.o) definition of _deflate
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflate
ld: warning multiple definitions of symbol _deflateCopy
/usr/lib/libz.dylib(deflate.o) definition of _deflateCopy
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflateCopy
ld: warning multiple definitions of symbol _deflateParams
/usr/lib/libz.dylib(deflate.o) definition of _deflateParams
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflateParams
ld: warning multiple definitions of symbol _deflatePrime
/usr/lib/libz.dylib(deflate.o) definition of _deflatePrime
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflatePrime
ld: warning multiple definitions of symbol _deflateReset
/usr/lib/libz.dylib(deflate.o) definition of _deflateReset
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflateReset
ld: warning multiple definitions of symbol _deflateSetDictionary
/usr/lib/libz.dylib(deflate.o) definition of _deflateSetDictionary
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflateSetDictionary
ld: warning multiple definitions of symbol _deflateInit_
/usr/lib/libz.dylib(deflate.o) definition of _deflateInit_
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflateInit_
ld: warning multiple definitions of symbol _deflateInit2_
/usr/lib/libz.dylib(deflate.o) definition of _deflateInit2_
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflateInit2_
ld: warning multiple definitions of symbol _deflateBound
/usr/lib/libz.dylib(deflate.o) definition of _deflateBound
/Library/Frameworks/R.framework/../R.framework/R(deflate.lo)  
definition of _deflateBound
ld: warning multiple definitions of symbol _inflateSyncPoint
/usr/lib/libz.dylib(inflate.o) definition of _inflateSyncPoint
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflateSyncPoint
ld: warning multiple definitions of symbol _inflateReset
/usr/lib/libz.dylib(inflate.o) definition of _inflateReset
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflateReset
ld: warning multiple definitions of symbol _inflateCopy
/usr/lib/libz.dylib(inflate.o) definition of _inflateCopy
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflateCopy
ld: warning multiple definitions of symbol _inflate
/usr/lib/libz.dylib(inflate.o) definition of _inflate
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflate
ld: warning multiple definitions of symbol _inflateInit_
/usr/lib/libz.dylib(inflate.o) definition of _inflateInit_
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflateInit_
ld: warning multiple definitions of symbol _inflateSetDictionary
/usr/lib/libz.dylib(inflate.o) definition of _inflateSetDictionary
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflateSetDictionary
ld: warning multiple definitions of symbol _inflateSync
/usr/lib/libz.dylib(inflate.o) definition of _inflateSync
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflateSync
ld: warning multiple definitions of symbol _inflateInit2_
/usr/lib/libz.dylib(inflate.o) definition of _inflateInit2_
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflateInit2_
ld: warning multiple definitions of symbol _inflateEnd
/usr/lib/libz.dylib(inflate.o) definition of _inflateEnd
/Library/Frameworks/R.framework/../R.framework/R(inflate.lo)  
definition of _inflateEnd
ld: warning multiple definitions of symbol _uncompress
/usr/lib/libz.dylib(uncompr.o) definition of _uncompress
/Library/Frameworks/R.framework/../R.framework/R(uncompr.lo)  
definition of _uncompress
ld: warning multiple definitions of symbol _crc32
/Library/Frameworks/R.framework/../R.framework/R(crc32.lo) definition  
of _crc32
/usr/lib/libz.dylib(crc32.o) definition of _crc32
ld: warning multiple definitions of symbol _get_crc_table
/Library/Frameworks/R.framework/../R.framework/R(crc32.lo) definition  
of _get_crc_table
/usr/lib/libz.dylib(crc32.o) definition of _get_crc_table
ld: warning multiple definitions of symbol _adler32
/usr/lib/libz.dylib(adler32.o) definition of _adler32
/Library/Frameworks/R.framework/../R.framework/R(adler32.lo)  
definition of _adler32
ld: warning multiple definitions of symbol _zlibCompileFlags
/usr/lib/libz.dylib(zutil.o) definition of _zlibCompileFlags
/Library/Frameworks/R.framework/../R.framework/R(zutil.lo) definition  
of _zlibCompileFlags
ld: warning multiple definitions of symbol _zError
/usr/lib/libz.dylib(zutil.o) definition of _zError
/Library/Frameworks/R.framework/../R.framework/R(zutil.lo) definition  
of _zError
ld: warning multiple definitions of symbol _zlibVersion
/usr/lib/libz.dylib(zutil.o) definition of _zlibVersion
/Library/Frameworks/R.framework/../R.framework/R(zutil.lo) definition  
of _zlibVersion
ld: warning multiple definitions of symbol _signgam
/Library/Frameworks/R.framework/../R.framework/R(lgamma.lo)  
definition of _signgam
/usr/lib/libSystem.dylib(gamma9.o) definition of _signgam



--
Christopher J. Fonnesbeck

Population Ecologist, Marine Mammal Section
Fish & Wildlife Research Institute (FWC)
St. Petersburg, FL

Adjunct Assistant Professor
Warnell School of Forest Resources
University of Georgia
Athens, GA

T: 727.235.5570
E: chris at trichech.us


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20060113/7c18788e/smime.bin
1 day later
#
On Jan 13, 2006, at 12:30 PM, Christopher Fonnesbeck wrote:

            
I'm sorry that I probably didn't make myself clear - as I was trying  
to say the problem is (and your build log confirms it) that you have  
Xcode 2.2 and you didn't add -lSystemStubs. You need to do so,  
because R was configured with a different compiler. I just checked  
and the following worked for me with the latest MySQL (5.0.18) and  
latest Xcode (2.2.1):

PKG_CPPFLAGS=-I/usr/local/mysql/include PKG_LIBS='-L/usr/local/mysql/ 
lib -lmysqlclient -lSystemStubs' R CMD INSTALL RMySQL

Cheers,
Simon