r-dbi / RMySQL

Legacy DBI interface for MySQL

Home Page:http://cran.r-project.org/package=RMySQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connecting to mysqld 5.7 using RMySQL 0.10.9 binaries, weirdness when compiling from source

dlizotte-uwo opened this issue · comments

I had some trouble connecting to the mysqld that comes with Ubuntu 16.04.1 LTS. I determined that at least in my configuration, the mysql 5.5 libraries that the binaries are compiled against seem to be the problem. Checking the version of the binary RMySQL 0.10.9 package, I get:

> mysqlClientLibraryVersions()
5.5.1 5.5.1 
50501 50501 

And my connections all fail. I figured out that on my mac, if use brew to get mysql and I install from source, RMySQL builds against mysql 5.7 and all is well:

> mysqlClientLibraryVersions()
5.7.16 5.7.16 
 50716  50716 

Attempting the same on my Ubuntu 16.04.1 LTS machine, I found something strange. If I have the libmariadb-client-lgpl-dev installed (as is suggested) I get

> install.packages("RMySQL", type = "source", verbose = TRUE)
Installing package into ‘/home/dlizotte/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
system (cmd0): /usr/lib/R/bin/R CMD INSTALL
--2016-11-02 19:19:50--  https://cran.rstudio.com/src/contrib/RMySQL_0.10.9.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 52.84.138.36
Connecting to cran.rstudio.com (cran.rstudio.com)|52.84.138.36|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 54012 (53K) [application/x-gzip]
Saving to: ‘/tmp/Rtmp9Pa4qH/downloaded_packages/RMySQL_0.10.9.tar.gz’

     0K .......... .......... .......... .......... .......... 94% 4.13M 0s
    50K ..                                                    100% 62.0M=0.01s

2016-11-02 19:19:50 (4.34 MB/s) - ‘/tmp/Rtmp9Pa4qH/downloaded_packages/RMySQL_0.10.9.tar.gz’ saved [54012/54012]

foundpkgs: RMySQL, /tmp/Rtmp9Pa4qH/downloaded_packages/RMySQL_0.10.9.tar.gz
files: /tmp/Rtmp9Pa4qH/downloaded_packages/RMySQL_0.10.9.tar.gz
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
Found mysql_config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized
Using PKG_LIBS=-L/usr/lib/x86_64-linux-gnu -lmariadb
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c RMySQL-init.c -o RMySQL-init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c connection.c -o connection.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c db-apply.c -o db-apply.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c driver.c -o driver.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c exception.c -o exception.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c fields.c -o fields.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c result.c -o result.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c utils.c -o utils.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RMySQL.so RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o -L/usr/lib/x86_64-linux-gnu -lmariadb -L/usr/lib/R/lib -lR
installing to /home/dlizotte/R/x86_64-pc-linux-gnu-library/3.2/RMySQL/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RMySQL)
1): succeeded '/usr/lib/R/bin/R CMD INSTALL -l '/home/dlizotte/R/x86_64-pc-linux-gnu-library/3.2' /tmp/Rtmp9Pa4qH/downloaded_packages/RMySQL_0.10.9.tar.gz'

The downloaded source packages are in
	‘/tmp/Rtmp9Pa4qH/downloaded_packages’
> library("RMySQL")
Loading required package: DBI
> mysqlClientLibraryVersions()
5.5.0 5.5.0 
50500 50500 

You can see that -lmariadb is used to satisfy the mysql dependencies. This seems to result in client version 5.5.0. This is true even though I also have libmysqlclient-dev installed. If I remove the libmariadb-client-lgpl-dev package and build from source, I get:

> install.packages("RMySQL", type = "source", verbose = TRUE)
Installing package into ‘/home/dlizotte/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
system (cmd0): /usr/lib/R/bin/R CMD INSTALL
--2016-11-02 19:28:46--  https://cran.rstudio.com/src/contrib/RMySQL_0.10.9.tar.gz
Resolving cran.rstudio.com (cran.rstudio.com)... 52.84.138.36
Connecting to cran.rstudio.com (cran.rstudio.com)|52.84.138.36|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 54012 (53K) [application/x-gzip]
Saving to: ‘/tmp/RtmpJeHRrF/downloaded_packages/RMySQL_0.10.9.tar.gz’

     0K .......... .......... .......... .......... .......... 94% 8.45M 0s
    50K ..                                                    100% 5238G=0.006s

2016-11-02 19:28:46 (8.91 MB/s) - ‘/tmp/RtmpJeHRrF/downloaded_packages/RMySQL_0.10.9.tar.gz’ saved [54012/54012]

foundpkgs: RMySQL, /tmp/RtmpJeHRrF/downloaded_packages/RMySQL_0.10.9.tar.gz
files: /tmp/RtmpJeHRrF/downloaded_packages/RMySQL_0.10.9.tar.gz
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
Found mysql_config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer
Using PKG_LIBS=-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c RMySQL-init.c -o RMySQL-init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c connection.c -o connection.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c db-apply.c -o db-apply.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c driver.c -o driver.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c exception.c -o exception.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c fields.c -o fields.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c result.c -o result.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql -fabi-version=2 -fno-omit-frame-pointer     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c utils.c -o utils.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RMySQL.so RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl -L/usr/lib/R/lib -lR
installing to /home/dlizotte/R/x86_64-pc-linux-gnu-library/3.2/RMySQL/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RMySQL)
1): succeeded '/usr/lib/R/bin/R CMD INSTALL -l '/home/dlizotte/R/x86_64-pc-linux-gnu-library/3.2' /tmp/RtmpJeHRrF/downloaded_packages/RMySQL_0.10.9.tar.gz'

The downloaded source packages are in
	‘/tmp/RtmpJeHRrF/downloaded_packages’
> library("RMySQL")
Loading required package: DBI
> mysqlClientLibraryVersions()
5.7.16 5.7.16 
 50716  50716 

and all is well. I don't know how much of an issue this is for people, but it seemed weird so I thought I would pass it along.