Re: [Rd] R Tools & Vista_x64: Problem compiling RMySQL?

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri, 26 Nov 2010 20:44:26 +0000 (GMT)

I've removed R-sig-db. PLEASE don't cross-post, not least because the R-sig-db moderator (me) ends up having to approve all the non-subscribed replies such as Duncan's.

On Fri, 26 Nov 2010, Duncan Murdoch wrote:

> On 26/11/2010 1:06 PM, Spencer Graves wrote:
>> Hello:
>>
>>
>> What do I need to do to compile R packages (especially RMySQL) for
>> the 64-bit version of R 2.12.0 under Vista_x64?
>
> The symptoms you're seeing are because the linker can't functions in
>
> libmySQL.dll
>
> which it is looking for in the somewhat strange path
>
> C:/PROGRA~2/MySQL/MYSQLS~1.1//bin/libmySQL.dll
>
>
> Does that file exist? Is it a 64 bit dll, compatible with MinGW? Is it
> compiled under the same convention as R, where no underscores are used in
> external names? (The latter two questions can probably be answered by
> looking at "objdump -x libmySQL.dll". objdump.exe is distributed as part of
> the MinGW distribution in Rtools.)

For x64, you need (or at least, it is more correct to use) x86_64-w64-mingw32-objdump. But I think he has pretty much told us that it is a 32-bit DLL. To install RMySQL on x64 Windows you need the 64-bit client DLLs. The standard MySQL installers do not allow you to install 32-bit and 64-bit MySQL on the same machine, but once you manage that, 32bit RMySQL can talk to a 64-bit MySQL server, and v.v.

BTW, the underscore convention does not matter for DLLs, only object files (.o, .a).

This does all work (I passed patches back to the maintainer so that it does). I do have a bi-arch Windows install of RMySQL on my machine talking to a 64-bit MySQL server. But we've had far too much frustration with (even very minor) MySQL version mismatches to even think about distributing such a build.

> Duncan Murdoch
>
>>
>> I upgraded to "Rtools212.exe" yesterday but immediately got errors
>> from "R CMD check RMySQL_0.7-5.tar.gz". After the first error, I
>> installed it a second time, then got "undefined reference to" roughly 50
>> different names beginning "mysql_"; copied below. I see two possible
>> sources for this problem:
>>
>>
>> (1) RTools212 may not be installed properly.
>>
>>
>> (2) RMySQL may be incompatible with R x64 2.12.0,
>> especially with
>> a 32-bit version of MySQL.
>>
>>
>> NOTE: RMySQL worked with R2.11.1 (and MySQL 5.1.50-community
>> server)

But you failed to tell us the 'at a minimum' information we asked for about either version of R. If that was i386 R, then yes, your MySQL is 32-bit.

>> before I installed R2.12.0. I'm reasonably sure that my local
>> installation of MySQL is only 32-bit.
>>
>>
>> What do you suggest? I use the 32-bit version of R2.12.0?
>>
>>
>> Thanks,
>> Spencer
>> #####################################
>> * installing *source* package 'RMySQL' ...
>> checking for $MYSQL_HOME... C:/PROGRA~2/MySQL/MYSQLS~1.1/
>> cygwin warning:
>> MS-DOS style path detected: C:/PROGRA~2/MySQL/MYSQLS~1.1/
>> Preferred POSIX equivalent is: /cygdrive/c/PROGRA~2/MySQL/MYSQLS~1.1/
>> CYGWIN environment variable option "nodosfilewarning" turns off this
>> warning.
>> Consult the user's guide for more details about POSIX paths:
>> http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
>> ** libs
>> Warning: this package has a non-empty 'configure.win' file,
>> so building only the main architecture
>>
>> cygwin warning:
>> MS-DOS style path detected:
>> C:/Users/sgraves/R/R-212~1.0/etc/x64/Makeconf
>> Preferred POSIX equivalent is:
>> /cygdrive/c/Users/sgraves/R/R-212~1.0/etc/x64/Makeconf
>> CYGWIN environment variable option "nodosfilewarning" turns off this
>> warning.
>> Consult the user's guide for more details about POSIX paths:
>> http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
>> x86_64-w64-mingw32-gcc -I"C:/Users/sgraves/R/R-212~1.0/include"
>> -I"C:/PROGRA~2/MySQL/MYSQLS~1.1/"/include -O2 -Wall -std=gnu99
>> -c RS-DBI.c -o RS-DBI.o
>> x86_64-w64-mingw32-gcc -I"C:/Users/sgraves/R/R-212~1.0/include"
>> -I"C:/PROGRA~2/MySQL/MYSQLS~1.1/"/include -O2 -Wall -std=gnu99
>> -c RS-MySQL.c -o RS-MySQL.o
>> x86_64-w64-mingw32-gcc -shared -s -static-libgcc -o RMySQL.dll tmp.def
>> RS-DBI.o RS-MySQL.o C:/PROGRA~2/MySQL/MYSQLS~1.1//bin/libmySQL.dll
>> -LC:/Users/sgraves/R/R-212~1.0/bin/x64 -lR
>> RS-MySQL.o:RS-MySQL.c:(.text+0xb0): undefined reference to
>> `mysql_more_results'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2c6): undefined reference to `mysql_init'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2d9): undefined reference to `mysql_options'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2ef): undefined reference to `mysql_options'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x305): undefined reference to `mysql_options'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x338): undefined reference to
>> `mysql_real_connect'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x399): undefined reference to `mysql_close'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x3d1): undefined reference to `mysql_error'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x7a2): undefined reference to `mysql_close'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x80f): undefined reference to
>> `mysql_fetch_fields'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x823): undefined reference to
>> `mysql_field_count'
>> RS-MySQL.o:RS-MySQL.c:(.text+0xae7): undefined reference to
>> `mysql_next_result'
>> RS-MySQL.o:RS-MySQL.c:(.text+0xb0b): undefined reference to
>> `mysql_use_result'
>> RS-MySQL.o:RS-MySQL.c:(.text+0xb16): undefined reference to
>> `mysql_field_count'
>> RS-MySQL.o:RS-MySQL.c:(.text+0xbff): undefined reference to
>> `mysql_affected_rows'
>> RS-MySQL.o:RS-MySQL.c:(.text+0xd27): undefined reference to
>> `mysql_fetch_row'
>> RS-MySQL.o:RS-MySQL.c:(.text+0xd3d): undefined reference to
>> `mysql_fetch_lengths'
>> RS-MySQL.o:RS-MySQL.c:(.text+0xf2e): undefined reference to `mysql_errno'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x1093): undefined reference to `mysql_errno'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x109e): undefined reference to `mysql_error'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x1114): undefined reference to
>> `mysql_fetch_row'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x1121): undefined reference to
>> `mysql_free_result'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x11f0): undefined reference to `mysql_query'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x1200): undefined reference to
>> `mysql_use_result'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x120b): undefined reference to
>> `mysql_field_count'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x128f): undefined reference to `mysql_query'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x12ac): undefined reference to `mysql_error'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x133c): undefined reference to
>> `mysql_affected_rows'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x1539): undefined reference to
>> `mysql_get_client_info'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x172d): undefined reference to
>> `mysql_get_host_info'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x174b): undefined reference to
>> `mysql_get_server_info'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x176d): undefined reference to
>> `mysql_get_proto_info'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x177c): undefined reference to
>> `mysql_thread_id'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x23db): undefined reference to
>> `mysql_fetch_row'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x23fd): undefined reference to `mysql_errno'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x252a): undefined reference to
>> `mysql_fetch_lengths'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x28fd): undefined reference to
>> `mysql_insert_id'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x29cd): undefined reference to
>> `mysql_real_escape_string'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2a7a): undefined reference to
>> `mysql_get_client_info'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2ab8): undefined reference to
>> `mysql_get_client_version'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2afc): undefined reference to
>> `mysql_server_init'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2b01): undefined reference to
>> `mysql_get_client_version'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2b29): undefined reference to
>> `mysql_get_client_info'
>> RS-MySQL.o:RS-MySQL.c:(.text+0x2b69): undefined reference to
>> `mysql_server_end'
>> collect2: ld returned 1 exit status
>> ERROR: compilation failed for package 'RMySQL'
>> * removing 'C:/Users/sgraves/Rpkgs/RMySQL/RMySQL.Rcheck/RMySQL'
>>
>> ______________________________________________
>> R-devel_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 26 Nov 2010 - 20:47:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 27 Nov 2010 - 10:20:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive