I am using:
R version: 3.3.3.
OS: RHEL 7.3 on EC2.
I am trying to install RMysql.
So in R terminal I submit command: install.packages("RMySQL")
First attempt was unsuccessful and gave error that libmysqlclient was not found.
Using PKG_LIBS=-lmysqlclient
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libmysqlclient was not found. Try installing:
* deb: libmariadb-client-lgpl-dev (Debian, Ubuntu 16.04)
libmariadbclient-dev (Ubuntu 14.04)
* rpm: mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mariadb-connector-c (OSX)
If libmysqlclient is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libmysqlclient.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘RMySQL’
* removing ‘/usr/lib64/R/library/RMySQL’
The downloaded source packages are in
‘/tmp/Rtmpx1vsUG/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("RMySQL") :
installation of package ‘RMySQL’ had non-zero exit status
So I installed mysql-devel. (sudo yum install mysql-devel)
After this I am trying to install RMysql again. But that does not work again. Something is wrong with PKG_LIBS -lmariadb.
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -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/lib64/ -lmariadb -lpthread -ldl -lm -lssl -lcrypto -L/usr/lib64/R/lib -lR /bin/ld: cannot find -lmariadb
Here is the whole R output.
* 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 -I/usr/include/mysql/mysql
Using PKG_LIBS=-L/usr/lib64/ -lmariadb -lpthread -ldl -lm -lssl -lcrypto
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RMySQL-init.c -o RMySQL-init.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c connection.c -o connection.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c db-apply.c -o db-apply.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c driver.c -o driver.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c exception.c -o exception.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c fields.c -o fields.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c result.c -o result.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include/mysql -I/usr/include/mysql/mysql -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c utils.c -o utils.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -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/lib64/ -lmariadb -lpthread -ldl -lm -lssl -lcrypto -L/usr/lib64/R/lib -lR
/bin/ld: cannot find -lmariadb
collect2: error: ld returned 1 exit status
make: *** [RMySQL.so] Error 1
ERROR: compilation failed for package ‘RMySQL’
* removing ‘/usr/lib64/R/library/RMySQL’
The downloaded source packages are in
‘/tmp/RtmpYEs7XA/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("RMySQL") :
installation of package ‘RMySQL’ had non-zero exit status