Cannot install data.table package on R 3.3.0 - r

I tried to install the 'data.table' package with R 3.3.0, but it returns the given error as below. I installed all required packages, but it did not help me at all.
I googled for the same issue, but there's nothing.
Please share your experience to fix it, if you had the same problem. It is very strange to me now.
Thanks a lot,
Sean
> install.packages('data.table')
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3233k 100 3233k 0 0 2098k 0 0:00:01 0:00:01 --:--:-- 2205k
* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** libs
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c assign.c -o assign.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c between.c -o between.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c bmerge.c -o bmerge.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c chmatch.c -o chmatch.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c dogroups.c -o dogroups.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c fastmean.c -o fastmean.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c fcast.c -o fcast.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c fmelt.c -o fmelt.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/zlib -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/xz -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include/bzip2 -I/builddir/build/BUILD/R-3.3.0/port/Linux-X64/include -fopenmp -fpic -g -O2 -c forder.c -o forder.o
forder.c: In function ‘range_str’:
forder.c:296: error: expected end of line before ‘update’
make: *** [forder.o] Error 1
ERROR: compilation failed for package ‘data.table’
* removing ‘/usr/lib64/R/library/data.table’
The downloaded source packages are in
‘/tmp/RtmpCfSYUU/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("data.table") :
installation of package ‘data.table’ had non-zero exit status

Related

Problem with installation of vegan package - cannot find -lgfortran

I was installing another package called vcfR where it says vegan is source package and needs to be installed, then it showed errors when installing. So I decided to install vegan package first.
This is an online R studio, the package I need to analyse is too big to be done on my laptop. The online R studio is by my school server, which was in-built in a ssh server account.
below is the error message:
Installing package into ‘/home/joyzheng/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/vegan_2.5-7.tar.gz'
Content type 'application/x-gzip' length 2074611 bytes (2.0 MB)
==================================================
downloaded 2.0 MB
* installing *source* package ‘vegan’ ...
** package ‘vegan’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c data2hill.c -o data2hill.o
gfortran -fpic -g -O2 -c decorana.f -o decorana.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c getF.c -o getF.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c goffactor.c -o goffactor.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c init.c -o init.o
gfortran -fpic -g -O2 -c monoMDS.f -o monoMDS.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c nestedness.c -o nestedness.o
gfortran -fpic -g -O2 -c ordering.f -o ordering.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c pnpoly.c -o pnpoly.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c stepacross.c -o stepacross.o
gcc -std=gnu99 -I"/opt/R/4.0.3/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c vegdist.c -o vegdist.o
gcc -std=gnu99 -shared -L/opt/R/4.0.3/lib/R/lib -L/usr/local/lib -o vegan.so data2hill.o decorana.o getF.o goffactor.o init.o monoMDS.o nestedness.o ordering.o pnpoly.o stepacross.o vegdist.o -L/opt/R/4.0.3/lib/R/lib -lRlapack -L/opt/R/4.0.3/lib/R/lib -lRblas -lgfortran -lm -lquadmath -lgfortran -lm -lquadmath -L/opt/R/4.0.3/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [vegan.so] Error 1
ERROR: compilation failed for package ‘vegan’
* removing ‘/home/joyzheng/R/x86_64-pc-linux-gnu-library/4.0/vegan’
Warning in install.packages :
installation of package ‘vegan’ had non-zero exit status```

R install package curl: "handle.c:30:1: error: unknown type name 'curl_sslbackend'"

Oracle Linux 7, R 3.3.0
[oracle#ildar ~]$ yum list | grep curl
curl.x86_64 7.29.0-54.0.1.el7 installed
libcurl.x86_64 7.29.0-54.0.1.el7 installed
libcurl-devel.x86_64 7.29.0-54.0.1.el7 installed
python-pycurl.x86_64 7.19.0-19.el7 #odadom1
libcurl.i686 7.29.0-54.0.1.el7 ol7_latest
libcurl-devel.i686 7.29.0-54.0.1.el7 ol7_latest
[oracle#ildar ~]$
i.e. libcurl installed.
next try to install curl package in R:
[oracle#ildar ~]$ ORE CMD INSTALL curl_4.1.tar.gz
* installing to library '/u01/app/oracle/product/19.0.0.0/dbhome_1/R/library'
* installing *source* package 'curl' ...
** package 'curl' successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
** libs
rm -f curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o interrupt.o multi.o nslookup.o reflist.o split.o ssl.o typechecking.o utils.o version.o winidn.o writer.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -DSTRICT_R_HEADERS -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include -fvisibility=hidden -fpic -g -O2 -c callbacks.c -o callbacks.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -DSTRICT_R_HEADERS -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include -fvisibility=hidden -fpic -g -O2 -c curl.c -o curl.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -DSTRICT_R_HEADERS -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include -fvisibility=hidden -fpic -g -O2 -c download.c -o download.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -DSTRICT_R_HEADERS -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include -fvisibility=hidden -fpic -g -O2 -c escape.c -o escape.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -DSTRICT_R_HEADERS -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include -fvisibility=hidden -fpic -g -O2 -c fetch.c -o fetch.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -DSTRICT_R_HEADERS -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include -fvisibility=hidden -fpic -g -O2 -c form.c -o form.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -DSTRICT_R_HEADERS -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include -fvisibility=hidden -fpic -g -O2 -c getdate.c -o getdate.o
gcc -m64 -std=gnu99 -I/usr/lib64/R/../../include/R -DNDEBUG -DSTRICT_R_HEADERS -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include -fvisibility=hidden -fpic -g -O2 -c handle.c -o handle.o
handle.c:30:1: error: unknown type name 'curl_sslbackend'
curl_sslbackend default_ssl_backend;
^
make: *** [handle.o] Error 1
ERROR: compilation failed for package 'curl'
* removing '/u01/app/oracle/product/19.0.0.0/dbhome_1/R/library/curl'
no matter if I install from local file or from cloud, I get the same error
handle.c:30:1: error: unknown type name 'curl_sslbackend'
How to install curl without errors?
I found solution.
The reason is that curl 4.1 has error.
4.0 should be installed instead:
https://github.com/jeroen/curl/issues/204#issuecomment-532162699
install.packages("https://cran.r-project.org/src/contrib/Archive/curl/curl_4.0.tar.gz",repo=NULL,type="source")

R 3.5.1 - Building data.table from source fails on Travis CI

I'm currently trying to set up continuous integration for a bookdown-project
The project bundles dependencies with packrat, so Travis CI needs to build the required packages from source. This seems to go okay for many packages, but the build is failing for data.table.
I am using the current version of data.table (1.11.8) and R (3.5.1)
Maybe I specified the wrong Version of C-compilers in my Makevars
What else could I check to get this working?
...
Installing curl (3.2) ...
OK (built source)
Installing data.table (1.11.8) ...
[1] "Command failed (1)\n\nFailed to run system command:\n\n\t'/home/travis/R-bin/lib/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmpiHzV25/data.table' --library='/home/travis/build/henningsway/Advanced-R-Solutions/packrat/lib/x86_64-pc-linux-gnu/3.5.1' --install-tests --no-docs --no-multiarch --no-demo \n\nThe command failed with output:\n* installing *source* package 'data.table' ...\n** package 'data.table' successfully unpacked and MD5 sums checked\n** libs\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c assign.c -o assign.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c between.c -o between.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c bmerge.c -o bmerge.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c chmatch.c -o chmatch.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c dogroups.c -o dogroups.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c fastmean.c -o fastmean.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c fcast.c -o fcast.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c fmelt.c -o fmelt.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c forder.c -o forder.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c frank.c -o frank.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c fread.c -o fread.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c freadR.c -o freadR.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c fsort.c -o fsort.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c fwrite.c -o fwrite.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c fwriteR.c -o fwriteR.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c gsumm.c -o gsumm.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c ijoin.c -o ijoin.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c init.c -o init.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c inrange.c -o inrange.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c nqrecreateindices.c -o nqrecreateindices.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c openmp-utils.c -o openmp-utils.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c quickselect.c -o quickselect.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c rbindlist.c -o rbindlist.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c reorder.c -o reorder.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c shift.c -o shift.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c subset.c -o subset.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c transpose.c -o transpose.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c uniqlist.c -o uniqlist.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c vecseq.c -o vecseq.o\nclang -I\"/home/travis/R-bin/lib/R/include\" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c wrappers.c -o wrappers.o\nclang -shared -L/home/travis/R-bin/lib/R/lib -L/home/travis/R-bin/lib -o data.table.so assign.o between.o bmerge.o chmatch.o dogroups.o fastmean.o fcast.o fmelt.o forder.o frank.o fread.o freadR.o fsort.o fwrite.o fwriteR.o gsumm.o ijoin.o init.o inrange.o nqrecreateindices.o openmp-utils.o quickselect.o rbindlist.o reorder.o shift.o subset.o transpose.o uniqlist.o vecseq.o wrappers.o -fopenmp -L/home/travis/R-bin/lib/R/lib -lR\nmv data.table.so datatable.so\nif [ \"\" != \"Windows_NT\" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -id datatable.so datatable.so; fi\ninstalling to /home/travis/build/henningsway/Advanced-R-Solutions/packrat/lib/x86_64-pc-linux-gnu/3.5.1/data.table/libs\n** R\n** inst\n** tests\n** byte-compile and prepare package for lazy loading\n** help\n*** installing help indices\n** building package indices\n** installing vignettes\n** testing if installed package can be loaded\nError: package or namespace load failed for 'data.table' in dyn.load(file, DLLpath = DLLpath, ...):\n unable to load shared object '/home/travis/build/henningsway/Advanced-R-Solutions/packrat/lib/x86_64-pc-linux-gnu/3.5.1/data.table/libs/datatable.so':\n libomp.so: cannot open shared object file: No such file or directory\nError: loading failed\nExecution halted\nERROR: loading failed\n* removing '/home/travis/build/henningsway/Advanced-R-Solutions/packrat/lib/x86_64-pc-linux-gnu/3.5.1/data.table'"
Error: Command failed (1)
Failed to run system command:
'/home/travis/R-bin/lib/R/bin/R' --vanilla CMD INSTALL '/tmp/RtmpiHzV25/data.table' --library='/home/travis/build/henningsway/Advanced-R-Solutions/packrat/lib/x86_64-pc-linux-gnu/3.5.1' --install-tests --no-docs --no-multiarch --no-demo
The command failed with output:
* installing *source* package 'data.table' ...
** package 'data.table' successfully unpacked and MD5 sums checked
** libs
clang -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c assign.c -o assign.o
clang -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c between.c -o between.o
clang -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c bmerge.c -o bmerge.o
clang -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I/home/travis/R-bin/include -fopenmp -fpic -g -O2 -c chmatch.c -o chmatch.o
clang -I"/home/
Execution halted
The command "R -e "0" --args --bootstrap-packrat" failed and exited with 1 during .
Your build has been stopped.
Setting CC=gcc actually solved the data.table-compilation problem for me.
(I think setting some other arguments for clang would have also been an option, as indicated in #jaaps comment above)

digest package not installing in R - lgfortran not found

I am trying to install the digest package in R. However the installation is failing, apparently because the compiler does not recognize the -lgfortran flag. I have been unable to find any information on this. Any help is appreciated.
> install.packages('digest', repos='http://cran.us.r-project.org')
trying URL 'http://cran.us.r-project.org/src/contrib/digest_0.6.12.tar.gz'
Content type 'application/x-gzip' length 120337 bytes (117 KB)
==================================================
downloaded 117 KB
* installing *source* package ‘digest’ ...
** package ‘digest’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c aes.c -o aes.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c crc32.c -o crc32.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c digest.c -o digest.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c init.c -o init.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c md5.c -o md5.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c pmurhash.c -o pmurhash.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c raes.c -o raes.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c sha1.c -o sha1.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c sha2.c -o sha2.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c sha256.c -o sha256.o
gcc -std=gnu99 -I/home/alexander/anaconda3/lib/R/include -DNDEBUG -I/home/alexander/anaconda3/include -fpic -I/home/alexander/anaconda3/include -c xxhash.c -o xxhash.o
gcc -std=gnu99 -shared -L/home/alexander/anaconda3/lib/R/lib -L/home/alexander/anaconda3/lib -lgfortran -o digest.so aes.o crc32.o digest.o init.o md5.o pmurhash.o raes.o sha1.o sha2.o sha256.o xxhash.o -L/home/alexander/anaconda3/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/home/alexander/anaconda3/lib/R/share/make/shlib.mk:6: recipe for target 'digest.so' failed
make: *** [digest.so] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/home/alexander/anaconda3/lib/R/library/digest’
* restoring previous ‘/home/alexander/anaconda3/lib/R/library/digest’
use homebrew to install gcc, gfortrain
Create folder /Users/YOURNAME/.R
Create text file /Users/YOURNAME/.R/Makevars
Put this into that file:
FC = usr/local/opt/gcc/bin/gfortran
F77 = /usr/local/opt/gcc/bin/gfortran
FLIBS = -L/usr/local/opt/gcc/lib

For R, error in installing RMySQL package

I'm trying to install the the RMySQL package using
bash > R
...
> install.packages('RMySQL', repos='http://cran.us.r-project.org')
and get the following output with an error at the end:
Installing package into ‘/usr/local/lib/R/3.2/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/RMySQL_0.10.6.tar.gz'
Content type 'application/x-gzip' length 52407 bytes (51 KB)
==================================================
downloaded 51 KB
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
Found mysql_config cflags and libs!
Using PKG_CFLAGS=-I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64
Using PKG_LIBS=-L/usr/local/mysql/lib -lmysqlclient
** libs
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c RMySQL-init.c -o RMySQL-init.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c connection.c -o connection.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c db-apply.c -o db-apply.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c driver.c -o driver.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c exception.c -o exception.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c fields.c -o fields.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c result.c -o result.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c utils.c -o utils.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -o RMySQL.so RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o -L/usr/local/mysql/lib -lmysqlclient -F/usr/local/Cellar/r/3.2.2_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
installing to /usr/local/lib/R/3.2/site-library/RMySQL/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/3.2/site-library/RMySQL/libs/RMySQL.so':
dlopen(/usr/local/lib/R/3.2/site-library/RMySQL/libs/RMySQL.so, 6): Library not loaded: libmysqlclient.18.dylib
Referenced from: /usr/local/lib/R/3.2/site-library/RMySQL/libs/RMySQL.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/3.2/site-library/RMySQL’
The downloaded source packages are in
‘/private/var/folders/87/wkgwm0754tn9csz8295qjmmc000bxz/T/RtmpxlEAlo/downloaded_packages’
Warning message:
In install.packages("RMySQL", repos = "http://cran.us.r-project.org") :
installation of package ‘RMySQL’ had non-zero exit status
>
> install.packages('RMySQL', repos='http://cran.us.r-project.org')
Installing package into ‘/usr/local/lib/R/3.2/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/RMySQL_0.10.6.tar.gz'
Content type 'application/x-gzip' length 52407 bytes (51 KB)
==================================================
downloaded 51 KB
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
Found mysql_config cflags and libs!
Using PKG_CFLAGS=-I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64
Using PKG_LIBS=-L/usr/local/mysql/lib -lmysqlclient
** libs
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c RMySQL-init.c -o RMySQL-init.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c connection.c -o connection.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c db-apply.c -o db-apply.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c driver.c -o driver.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c exception.c -o exception.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c fields.c -o fields.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c result.c -o result.o
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/mysql/include -g -fno-omit-frame-pointer -fno-strict-aliasing -arch x86_64 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -fPIC -g -O2 -c utils.c -o utils.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -o RMySQL.so RMySQL-init.o connection.o db-apply.o driver.o exception.o fields.o result.o utils.o -L/usr/local/mysql/lib -lmysqlclient -F/usr/local/Cellar/r/3.2.2_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
installing to /usr/local/lib/R/3.2/site-library/RMySQL/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/local/lib/R/3.2/site-library/RMySQL/libs/RMySQL.so':
dlopen(/usr/local/lib/R/3.2/site-library/RMySQL/libs/RMySQL.so, 6): Library not loaded: libmysqlclient.18.dylib
Referenced from: /usr/local/lib/R/3.2/site-library/RMySQL/libs/RMySQL.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/3.2/site-library/RMySQL’
The downloaded source packages are in
‘/private/var/folders/87/wkgwm0754tn9csz8295qjmmc000bxz/T/RtmpxlEAlo/downloaded_packages’
Warning message:
In install.packages("RMySQL", repos = "http://cran.us.r-project.org") :
installation of package ‘RMySQL’ had non-zero exit status
Any idea?
You need to give more details about your installation. I guess you are using a homebrew version of R? You are strongly recommended to use the official R package for mac instead, which is what the CRAN build servers (and most users) are using.
That said, there seems to be something odd with your libmysqlclient installation. Assuming this is brew, try reinstalling:
brew remove mysql-connector-c
brew upgrade
brew install mysql-connector-c
Verify that libmysqlclient.18.dylib is installed:
ls /usr/local/opt/mysql-connector-c/lib
Alternatively you can try linking to mariadb:
brew remove mysql-connector-c
brew install mariadb
If this doesn't work it might be a bug in the brew version of R. The compiler fails to record the path to libmysqlclient.18.dylib. Maybe R not passing the correct RPATH flags to the linker.

Resources