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.
Related
R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
I want to install devtools in the Rstudio server, but failed all the time. Here are the results running the install.packages.
> install.packages("devtools")
Installing package into ‘/GPUFS/smu_ymyu_1/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘gert’, ‘usethis’
trying URL 'https://cran.rstudio.com/src/contrib/gert_1.9.1.tar.gz'
Content type 'application/x-gzip' length 121017 bytes (118 KB)
==================================================
downloaded 118 KB
trying URL 'https://cran.rstudio.com/src/contrib/usethis_2.1.6.tar.gz'
Content type 'application/x-gzip' length 342349 bytes (334 KB)
==================================================
downloaded 334 KB
trying URL 'https://cran.rstudio.com/src/contrib/devtools_2.4.5.tar.gz'
Content type 'application/x-gzip' length 374718 bytes (365 KB)
==================================================
downloaded 365 KB
* installing *source* package ‘gert’ ...
** package ‘gert’ successfully unpacked and MD5 sums checked
** using staged installation
Using static libgit2 for Linux x86_64
Using PKG_CFLAGS=-DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include
Using PKG_LIBS=-L/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/lib -lgit2 -lrt -lpthread -lssh2 -lssl -lcrypto -ldl -lpcre -lz
Configuration OK!
** libs
rm -f gert.so branch.o clone.o commit.o config.o conflicts.o files.o init.o merge.o rebase.o stash.o submodules.o tag.o utils.o version.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c branch.c -o branch.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c clone.c -o clone.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c commit.c -o commit.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c config.c -o config.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c conflicts.c -o conflicts.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c files.c -o files.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c init.c -o init.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c merge.c -o merge.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c rebase.c -o rebase.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c stash.c -o stash.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c submodules.c -o submodules.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c tag.c -o tag.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c utils.c -o utils.o
gcc -std=gnu99 -I"/app/centos/R/4.1.1/lib64/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -I/usr/local/include -fvisibility=hidden -fpic -g -O2 -c version.c -o version.o
gcc -std=gnu99 -shared -L/app/centos/R/4.1.1/lib64/R/lib -L/usr/local/lib64 -o gert.so branch.o clone.o commit.o config.o conflicts.o files.o init.o merge.o rebase.o stash.o submodules.o tag.o utils.o version.o -L/tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/lib -lgit2 -lrt -lpthread -lssh2 -lssl -lcrypto -ldl -lpcre -lz -L/app/centos/R/4.1.1/lib64/R/lib -lR
/usr/bin/ld: /tmp/RtmpK20lPh/R.INSTALL10915eb5334/gert/libgit2/lib/libgit2.a(annotated_commit.c.o): unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [gert.so] Error 1
ERROR: compilation failed for package ‘gert’
* removing ‘/GPUFS/smu_ymyu_1/R/x86_64-pc-linux-gnu-library/4.1/gert’
Warning in install.packages :
installation of package ‘gert’ had non-zero exit status
ERROR: dependency ‘gert’ is not available for package ‘usethis’
* removing ‘/GPUFS/smu_ymyu_1/R/x86_64-pc-linux-gnu-library/4.1/usethis’
Warning in install.packages :
installation of package ‘usethis’ had non-zero exit status
ERROR: dependency ‘usethis’ is not available for package ‘devtools’
* removing ‘/GPUFS/smu_ymyu_1/R/x86_64-pc-linux-gnu-library/4.1/devtools’
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp7IpcmZ/downloaded_packages’
And I searched in the Internet, followed the previous suggestion to install the libgit2 in the Linux.
Linux version 3.10.0-957.el7.x86_64 (root#huawei-2u) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Sat Oct 12 02:01:43 CST 2019
> $yum install libgit2
> $yum info libgit2
Loaded plugins: fastestmirror, ovl
ovl: Error while doing RPMdb copy-up:
[Errno 13] Permission denied: '/var/lib/rpm/.dbenv.lock'
Loading mirror speeds from cached hostfile
* epel: epel.mirror.angkasa.id
Available Packages
Name : libgit2
Arch : x86_64
Version : 0.26.8
Release : 1.el7_9
Size : 430 k
Repo : extras/7/x86_64
Summary : C implementation of the Git core methods as a library with a solid API
URL : http://libgit2.github.com/
License : GPLv2 with exceptions
Description : libgit2 is a portable, pure C implementation of the Git core methods
: provided as a re-entrant linkable library with a solid API, allowing
: you to write native speed custom Git applications in any language
: with bindings.
After installing the libgit2, but I still can't install the devtools in Rstudio server. Please help me.
I need to install nlme as it is a dependency for the MSstats package I need. I currently run on R version 4.2.0. When I try to install with Bioc manager I get the following:
> BiocManager::install("MSstats")
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details
replacement repositories:
CRAN: https://cran.rstudio.com/
Bioconductor version 3.15 (BiocManager 1.30.18), R 4.2.0 (2022-04-22)
Old packages: 'nlme'
Update all/some/none? [a/s/n]:
a
There is a binary version available but the source version is later:
binary source needs_compilation
nlme 3.1-157 3.1-158 TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘nlme’
trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-158.tar.gz'
Content type 'application/x-gzip' length 845427 bytes (825 KB)
==================================================
downloaded 825 KB
* installing *source* package ‘nlme’ ...
** package ‘nlme’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c chol.f -o chol.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c corStruct.c -o corStruct.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c gnls.c -o gnls.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c init.c -o init.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c matrix.c -o matrix.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c nlOptimizer.c -o nlOptimizer.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c nlme.c -o nlme.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c nlmefit.c -o nlmefit.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c pdMat.c -o pdMat.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c pythag.c -o pythag.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c rs.f -o rs.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o nlme.so chol.o corStruct.o gnls.o init.o matrix.o nlOptimizer.o nlme.o nlmefit.o pdMat.o pythag.o rs.o -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nlme.so] Error 1
ERROR: compilation failed for package ‘nlme’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/nlme’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/nlme’
The downloaded source packages are in
‘/private/var/folders/qx/5klvf6g112zb1vzzp5bt8n9r0000gn/T/Rtmpz9mEK5/downloaded_packages’
Warning messages:
1: package(s) not installed when version(s) same as current; use `force = TRUE` to re-install: 'MSstats'
2: In install.packages(update[instlib == l, "Package"], l, repos = repos, :
installation of package ‘nlme’ had non-zero exit status
I'm trying to install devtools package in R, and as its dependency xml2 needs to be installed, but I'm getting the following error message.
> install.packages("xml2")
Installing package into ‘/Users/xlong3/Library/R/3.2/library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/xml2_0.1.2.tar.gz'
Content type 'application/x-gzip' length 74808 bytes (73 KB)
==================================================
downloaded 73 KB
* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/Users/xlong3/anaconda/include/libxml2
Using PKG_LIBS=-L/Users/xlong3/anaconda/lib -lxml2 -lz -liconv -lm
** libs
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c connection.cpp -o connection.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_doc.cpp -o xml2_doc.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_init.cpp -o xml2_init.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_namespace.cpp -o xml2_namespace.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_node.cpp -o xml2_node.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_url.cpp -o xml2_url.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_xpath.cpp -o xml2_xpath.o
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml_push.cpp -o xml_push.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 xml2.so RcppExports.o connection.o xml2_doc.o xml2_init.o xml2_namespace.o xml2_node.o xml2_url.o xml2_xpath.o xml_push.o -L/Users/xlong3/anaconda/lib -lxml2 -lz -liconv -lm -F/usr/local/Cellar/r/3.2.2_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation
installing to /Users/xlong3/Library/R/3.2/library/xml2/libs
** R
** inst
** 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 '/Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so':
dlopen(/Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so, 6): Library not loaded: libxml2.2.dylib
Referenced from: /Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/xlong3/Library/R/3.2/library/xml2’
The downloaded source packages are in
‘/private/tmp/RtmpJc4WKq/downloaded_packages’
Warning message:
In install.packages("xml2") :
installation of package ‘xml2’ had non-zero exit status
>
> version
_
platform x86_64-apple-darwin13.4.0
arch x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
version.string R version 3.2.2 (2015-08-14)
nickname Fire Safety
The problem is that 'pkg-config' is looking specifically for 'libxml2.pc' and the file that you have installed is named, "libxml-2.0.pc". If you manually create a symbolic link between the existing file and the one pkg-config expects, it should resolve that error.
Something like this (done in the same directory as the file) should work
$ ln -s libxml-2.0.pc libxml2.pc
I'm not sure how should I proceed from the following situation:
pkg-config --libs --cflags libxml2
Package libxml2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml2' found
brew ls libxml2
/usr/local/Cellar/libxml2/2.9.2/bin/xml2-config
/usr/local/Cellar/libxml2/2.9.2/bin/xmlcatalog
/usr/local/Cellar/libxml2/2.9.2/bin/xmllint
/usr/local/Cellar/libxml2/2.9.2/include/libxml2/ (47 files)
/usr/local/Cellar/libxml2/2.9.2/lib/libxml2.2.dylib
/usr/local/Cellar/libxml2/2.9.2/lib/cmake/libxml2/libxml2-config.cmake
/usr/local/Cellar/libxml2/2.9.2/lib/pkgconfig/libxml-2.0.pc
/usr/local/Cellar/libxml2/2.9.2/lib/ (3 other files)
/usr/local/Cellar/libxml2/2.9.2/share/aclocal/libxml.m4
/usr/local/Cellar/libxml2/2.9.2/share/doc/ (153 files)
/usr/local/Cellar/libxml2/2.9.2/share/gtk-doc/ (55 files)
/usr/local/Cellar/libxml2/2.9.2/share/man/ (4 files)
Try to change your CRAN mirror
I'm trying to learn how to use R in Finance, and I'm trying to install a package but keep getting the following errors. I've tried now with R 3.0.3 through every version to the current and still the same error. Somebody has confirmed for me that the install worked for them on 3.1.0 so I was hoping somebody here may have some input as to what to try next, as I'm really out of ideas and search queries at this point.
> install.packages("quantstrat", repos="http://R-Forge.R-project.org")
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository http://R-Forge.R-project.org/bin/macosx/contrib/3.1
package ‘quantstrat’ is available as a source package but not as a binary
Warning in install.packages :
package ‘quantstrat’ is not available (for R version 3.1.0)
Edit: Following the suggestion in the below comments I have tried entering:
install.packages("quantstrat", repos="http://R-Forge.R-project.org", type="source")
Which yields only this cryptic message after downloading a handful of files:
* installing *source* package ‘zoo’ ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c coredata.c -o coredata.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c init.c -o init.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c lag.c -o lag.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o zoo.so coredata.o init.o lag.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (zoo)
* installing *source* package ‘xts’ ...
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c add_class.c -o add_class.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c any.c -o any.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c attr.c -o attr.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c binsearch.c -o binsearch.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c coredata.c -o coredata.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c diff.c -o diff.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c dimnames.c -o dimnames.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c endpoints.c -o endpoints.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c extract_col.c -o extract_col.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c init.c -o init.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c isOrdered.c -o isOrdered.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c isXts.c -o isXts.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c leadingNA.c -o leadingNA.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/zoo/include" -fPIC -mtune=core2 -g -O2 -c merge.c -o merge.o
gfortran-4.2 -arch x86_64 -fPIC -g -O2 -c period.max.f -o period.max.o
make: gfortran-4.2: No such file or directory
make: *** [period.max.o] Error 1
ERROR: compilation failed for package ‘xts’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/xts’
Warning in install.packages :
installation of package ‘xts’ had non-zero exit status
ERROR: dependency ‘xts’ is not available for package ‘PerformanceAnalytics’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/PerformanceAnalytics’
Warning in install.packages :
installation of package ‘PerformanceAnalytics’ had non-zero exit status
ERROR: dependency ‘xts’ is not available for package ‘TTR’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/TTR’
Warning in install.packages :
installation of package ‘TTR’ had non-zero exit status
ERROR: dependencies ‘Defaults’, ‘xts’, ‘TTR’ are not available for package ‘quantmod’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/quantmod’
Warning in install.packages :
installation of package ‘quantmod’ had non-zero exit status
ERROR: dependencies ‘quantmod’, ‘xts’ are not available for package ‘FinancialInstrument’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/FinancialInstrument’
Warning in install.packages :
installation of package ‘FinancialInstrument’ had non-zero exit status
ERROR: dependencies ‘xts’, ‘FinancialInstrument’, ‘PerformanceAnalytics’, ‘quantmod’ are not available for package ‘blotter’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/blotter’
Warning in install.packages :
installation of package ‘blotter’ had non-zero exit status
ERROR: dependencies ‘xts’, ‘TTR’, ‘blotter’, ‘FinancialInstrument’ are not available for package ‘quantstrat’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/quantstrat’
Warning in install.packages :
installation of package ‘quantstrat’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/q3/0qq1vm5538l657ffhr1hxj6m0000gn/T/RtmpQ5VCcC/downloaded_packages’
Thanks In Advance,
Jason E.
A combination of the above comments was the solution...
I installed xcode in it's entirety, followed my gfortran, and then proceded to type the repos in as was mentioned before:
install.packages("quantstrat", repos="http://R-Forge.R-project.org", type="source")
I recently updated R to 3.1.0. I tried to move my packages over to 3.1 inside the R.Framework (I'm running OSX Mavericks) and somehow made a mess of it, so did a complete uninstall of everything before a clean install.
When reinstalling packages I had no issues until I hit the forecast package which yields the following error:
package ‘forecast’ is available as a source package but not as a binary
Warning in install.packages :
package ‘forecast’ is not available (for R version 3.1.0)
I actually had R 3.1.0 and both forecast and hts working together prior to the reinstall so I suspect the problem stems from something I've done, rather than a compatibility problem.
I ran the following to see if I could unearth some more details about the install fail: install.packages("forecast", type = "source", verbose = T, quiet = F)
The output of which is a little beyond me, but may be of help in diagnosis:
system (cmd0): /Library/Frameworks/R.framework/Resources/bin/R CMD INSTALL
trying URL 'http://cran.rstudio.com/src/contrib/forecast_5.3.tar.gz'
Content type 'application/x-gzip' length 150395 bytes (146 Kb)
opened URL
==================================================
downloaded 146 Kb
foundpkgs: forecast, /var/folders/0y/_13fkvws0tn5xh4m8wsymkdh0000gp/T//RtmpzTzSpG/downloaded_packages/forecast_5.3.tar.gz
files: /var/folders/0y/_13fkvws0tn5xh4m8wsymkdh0000gp/T//RtmpzTzSpG/downloaded_packages/forecast_5.3.tar.gz
* installing *source* package ‘forecast’ ...
** package ‘forecast’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c calcBATS.cpp -o calcBATS.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c calcTBATS.cpp -o calcTBATS.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c etsTargetFunction.cpp -o etsTargetFunction.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c etsTargetFunctionWrapper.cpp -o etsTargetFunctionWrapper.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c etscalc.c -o etscalc.o
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c etspolyroot.c -o etspolyroot.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c makeBATSMatrices.cpp -o makeBATSMatrices.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c makeTBATSMatrices.cpp -o makeTBATSMatrices.o
makeTBATSMatrices.cpp:11:6: warning: unused variable 'lengthSeasonal' [-Wunused-variable]
int lengthSeasonal = 0;
^
1 warning generated.
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c updateMatrices.cpp -o updateMatrices.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RcppArmadillo/include" -fPIC -Wall -mtune=core2 -g -O2 -c updateTBATSMatrices.cpp -o updateTBATSMatrices.o
updateTBATSMatrices.cpp:38:10: warning: unused variable 'gammaVector' [-Wunused-variable]
double *gammaVector;
^
1 warning generated.
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o forecast.so calcBATS.o calcTBATS.o etsTargetFunction.o etsTargetFunctionWrapper.o etscalc.o etspolyroot.o makeBATSMatrices.o makeTBATSMatrices.o updateMatrices.o updateTBATSMatrices.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [forecast.so] Error 1
ERROR: compilation failed for package ‘forecast’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/forecast’
Warning in install.packages :
installation of package ‘forecast’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/0y/_13fkvws0tn5xh4m8wsymkdh0000gp/T/RtmpzTzSpG/downloaded_packages’
I'd really appreciate some help here. Much of the code I've been working on lately relies on functions in forecast.
Here is what I did (RcppArmadillo Compile Errors on OS X Mavericks)
Install gfortran from brew (if you don't have brew, Google it. Installation is straightforward):
brew install gfortran
If it's installed, upgrade to latest with:
brew upgrade gfortran
Then do one of the following:
ln -s /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.* /usr/local/lib/
or add this line to the ~/.R/Makevars file:
FLIBS=-L/usr/local/Cellar/gfortran/4.8.2/gfortran
I did the second option.
Now run install.packages("forecast", type = "source") again and it should work.
In my case, I was trying to install the latest version of {forecast} package with devtools::install_github("robjhyndman/forecast") and had the similar error.
Then, although I am not sure if what I did is right, following mchangun's answer I did as follows and the error was resolved:
brew upgrade gcc
Error: gcc 5.2.0 already installed
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
ls /usr/local/Cellar/gcc
4.9.2 4.9.2_1 5.2.0
Add the line FLIBS=-L/usr/local/Cellar/gcc/5.2.0 to the ~/.R/Makevars file
Run devtools::install_github("robjhyndman/forecast") and it worked.
Terminal
brew install gcc
gcc --version
ls /usr/local/Cellar/gcc
6.3.0_1
sudo vi /Library/Frameworks/R.framework/Resources/etc/Makeconf
Add the line FLIBS=-L/usr/local/Cellar/gcc/6.3.0_1
Rstudio:
install.packages("forecast"
Download gfortran from https://gcc.gnu.org/wiki/GFortranBinariesMacOS
sudo rm -r /usr/local/gfortran /usr/local/bin/gfortran
Then install gfortran
sudo vi /Library/Frameworks/R.framework/Resources/etc/Makeconf
change all gfortran-4.8 to gfortran
FC = gfortran
FCFLAGS = -Wall -g -O2 $(LTO)
FCLIBS =
F77 = gfortran
F77_VISIBILITY =
FFLAGS = -g -O2 $(LTO)
FLIBS = -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm
change above FLIBS to the below
FLIBS = -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
To install gfortran, use
brew cask install gfortran