git2r icon indicating copy to clipboard operation
git2r copied to clipboard

Unable to install git2r on mac ( el capitan )

Open code-rana opened this issue 8 years ago • 9 comments

I was trying to install "devtools" which failed showing its dependancy on git2r. Tried installing git2r both from source and R console but it gives following error.

`*** installing help indices ** building package indices ** testing if installed package can be loaded Error: package or namespace load failed for ‘git2r’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/usr/local/lib/R/3.4/site-library/git2r/libs/git2r.so': dlopen(/usr/local/lib/R/3.4/site-library/git2r/libs/git2r.so, 6): Library not loaded: @rpath/libz.1.dylib Referenced from: /usr/local/lib/R/3.4/site-library/git2r/libs/git2r.so Reason: image not found Error: loading failed Execution halted ERROR: loading failed

  • removing ‘/usr/local/lib/R/3.4/site-library/git2r’

The downloaded source packages are in ‘/private/var/folders/n_/yhpf28vs0d18yv_d1yqbpd_h0000gn/T/RtmpSN20L6/downloaded_packages’ Warning message: In install.packages("git2r") : installation of package ‘git2r’ had non-zero exit status`

I've tried a lot of other options to install it but failed with the same message. Is there a way to install git2r successfully ? Thanks.

code-rana avatar May 12 '17 07:05 code-rana

I have the same issue.

willtownes avatar May 12 '17 13:05 willtownes

I have almost the same problem, except that my error message refers to libz.1.dylib

Error: package or namespace load failed for ‘git2r’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/3.4/site-library/git2r/libs/git2r.so':
  dlopen(/usr/local/lib/R/3.4/site-library/git2r/libs/git2r.so, 6): Library not loaded: libz.1.dylib
  Referenced from: /usr/local/lib/R/3.4/site-library/git2r/libs/git2r.so
  Reason: image not found

winni2k avatar May 15 '17 15:05 winni2k

Hmm, this went away after I cleaned up my lib and include paths.

winni2k avatar May 15 '17 15:05 winni2k

Try brew doctor.

Clearing out all the extraneous header files as @wkretzsch suggested got it working for me.

ngwelch avatar Jun 15 '17 21:06 ngwelch

Hi, This issue persists from macOS 10.12.3 to 10.12.5 and from R 3.3.2 to 3.4.0. Even completely re-installing R (and rstudio) via homebrew doesn't solve this issue.

Here is my error:

install.packages.auto <- function(x) {
+      x <- as.character(substitute(x))
+      if(isTRUE(x %in% .packages(all.available = TRUE))) {
+           eval(parse(text = sprintf("require(\"%s\")", x)))
+      } else {
+           # Update installed packages - this may mean a full upgrade of R, which in turn
+           # may not be warrented.
+           #update.install.packages.auto(ask = FALSE)
+           eval(parse(text = sprintf("install.packages(\"%s\", dependencies = TRUE, repos = \"http://cran-mirror.cs.uu.nl/\")", x)))
+      }
+      if(isTRUE(x %in% .packages(all.available = TRUE))) {
+           eval(parse(text = sprintf("require(\"%s\")", x)))
+      } else {
+           source("http://bioconductor.org/biocLite.R")
+           # Update installed packages - this may mean a full upgrade of R, which in turn
+           # may not be warrented.
+           #biocLite(character(), ask = FALSE)
+           eval(parse(text = sprintf("biocLite(\"%s\")", x)))
+           eval(parse(text = sprintf("require(\"%s\")", x)))
+      }
+ }
>
> install.packages.auto("optparse")
Loading required package: optparse
> install.packages.auto("tools")
Loading required package: tools
> install.packages.auto("devtools")
Installing package into ‘/usr/local/lib/R/3.4/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘pkgmaker’, ‘rngtools’, ‘ggplot2’, ‘reshape2’, ‘NMF’, ‘stringr’, ‘igraph’, ‘stringi’, ‘git2r’, ‘rmarkdown’, ‘knitr’, ‘lintr’, ‘roxygen2’, ‘evaluate’

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/pkgmaker_0.22.tar.gz'
Content type 'application/x-gzip' length 351479 bytes (343 KB)
==================================================
downloaded 343 KB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/rngtools_1.2.4.tar.gz'
Content type 'application/x-gzip' length 120986 bytes (118 KB)
==================================================
downloaded 118 KB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/ggplot2_2.2.1.tar.gz'
Content type 'application/x-gzip' length 2213308 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/reshape2_1.4.2.tar.gz'
Content type 'application/x-gzip' length 34688 bytes (33 KB)
==================================================
downloaded 33 KB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/NMF_0.20.6.tar.gz'
Content type 'application/x-gzip' length 1764466 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/stringr_1.2.0.tar.gz'
Content type 'application/x-gzip' length 94095 bytes (91 KB)
==================================================
downloaded 91 KB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/igraph_1.0.1.tar.gz'
Content type 'application/x-gzip' length 3328353 bytes (3.2 MB)
==================================================
downloaded 3.2 MB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/stringi_1.1.5.tar.gz'
Content type 'application/x-gzip' length 3645872 bytes (3.5 MB)
==================================================
downloaded 3.5 MB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/git2r_0.18.0.tar.gz'
Content type 'application/x-gzip' length 1122935 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/rmarkdown_1.6.tar.gz'
Content type 'application/x-gzip' length 2077665 bytes (2.0 MB)
==================================================
downloaded 2.0 MB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/knitr_1.16.tar.gz'
Content type 'application/x-gzip' length 1031259 bytes (1007 KB)
==================================================
downloaded 1007 KB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/lintr_1.0.0.tar.gz'
Content type 'application/x-gzip' length 51014 bytes (49 KB)
==================================================
downloaded 49 KB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/roxygen2_6.0.1.tar.gz'
Content type 'application/x-gzip' length 150580 bytes (147 KB)
==================================================
downloaded 147 KB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/evaluate_0.10.1.tar.gz'
Content type 'application/x-gzip' length 22177 bytes (21 KB)
==================================================
downloaded 21 KB

trying URL 'http://cran-mirror.cs.uu.nl/src/contrib/devtools_1.13.2.tar.gz'
Content type 'application/x-gzip' length 486355 bytes (474 KB)
==================================================
downloaded 474 KB

* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for local ICUDT_DIR... icu55/data
checking for R_HOME... /usr/local/Cellar/r/3.4.0_1/R.framework/Resources
checking for R... /usr/local/Cellar/r/3.4.0_1/R.framework/Resources/bin/R
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... no
checking for cat... /bin/cat
checking for gcc... /usr/local/opt/llvm/bin/clang -fopenmp
checking whether the C compiler works... no
configure: error: in `/private/var/folders/xk/dfj20kgd56xg8796xh874tjr0000gn/T/Rtmp6UDe3o/R.INSTALL1532e596960ef/stringi':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/usr/local/lib/R/3.4/site-library/stringi’
* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
checking build system type... x86_64-apple-darwin16.6.0
checking host system type... x86_64-apple-darwin16.6.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for brew... yes
checking for library containing inflate... no
configure: error: in `/private/var/folders/xk/dfj20kgd56xg8796xh874tjr0000gn/T/Rtmp923ClJ/R.INSTALL156eb3ddcd84e/git2r':
configure: error:
  ---------------------------------------------
   The zlib library that is required to build
   git2r was not found.

   Please install:
     zlib1g-dev (package on e.g. Debian and Ubuntu)
     zlib-devel (package on e.g. Fedora, CentOS and RHEL)
   and try again.

   If the zlib library is installed on your
   system but the git2r configuration is
   unable to find it, you can specify the
   include and lib path to zlib with:
   R CMD INSTALL --configure-args='--with-zlib-include=INCLUDE_PATH --with-zlib-lib=LIB_PATH' git2r
  ---------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/usr/local/lib/R/3.4/site-library/git2r’
ERROR: dependency ‘stringi’ is not available for package ‘stringr’
* removing ‘/usr/local/lib/R/3.4/site-library/stringr’
ERROR: dependency ‘git2r’ is not available for package ‘devtools’
* removing ‘/usr/local/lib/R/3.4/site-library/devtools’
ERROR: dependency ‘stringr’ is not available for package ‘pkgmaker’
* removing ‘/usr/local/lib/R/3.4/site-library/pkgmaker’
ERROR: dependency ‘stringr’ is not available for package ‘reshape2’
* removing ‘/usr/local/lib/R/3.4/site-library/reshape2’
ERROR: dependencies ‘stringr’, ‘stringi’ are not available for package ‘roxygen2’
* removing ‘/usr/local/lib/R/3.4/site-library/roxygen2’
ERROR: dependency ‘stringr’ is not available for package ‘evaluate’
* removing ‘/usr/local/lib/R/3.4/site-library/evaluate’
ERROR: dependencies ‘pkgmaker’, ‘stringr’ are not available for package ‘rngtools’
* removing ‘/usr/local/lib/R/3.4/site-library/rngtools’
ERROR: dependency ‘reshape2’ is not available for package ‘ggplot2’
* removing ‘/usr/local/lib/R/3.4/site-library/ggplot2’
ERROR: dependencies ‘evaluate’, ‘stringr’ are not available for package ‘knitr’
* removing ‘/usr/local/lib/R/3.4/site-library/knitr’
ERROR: dependencies ‘pkgmaker’, ‘rngtools’, ‘stringr’, ‘ggplot2’, ‘reshape2’ are not available for package ‘NMF’
* removing ‘/usr/local/lib/R/3.4/site-library/NMF’
ERROR: dependencies ‘knitr’, ‘evaluate’, ‘stringr’ are not available for package ‘rmarkdown’
* removing ‘/usr/local/lib/R/3.4/site-library/rmarkdown’
ERROR: dependency ‘NMF’ is not available for package ‘igraph’
* removing ‘/usr/local/lib/R/3.4/site-library/igraph’
ERROR: dependencies ‘igraph’, ‘knitr’ are not available for package ‘lintr’
* removing ‘/usr/local/lib/R/3.4/site-library/lintr’

The downloaded source packages are in
	‘/private/var/folders/xk/dfj20kgd56xg8796xh874tjr0000gn/T/RtmpbS6iTm/downloaded_packages’
Bioconductor version 3.5 (BiocInstaller 1.26.0), ?biocLite for help
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.5 (BiocInstaller 1.26.0), R 3.4.0 (2017-04-21).
Installing package(s) ‘devtools’
also installing the dependency ‘git2r’

trying URL 'http://mirror.ibcp.fr/pub/CRAN/src/contrib/git2r_0.18.0.tar.gz'
Content type 'application/x-gzip' length 1122935 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'http://mirror.ibcp.fr/pub/CRAN/src/contrib/devtools_1.13.2.tar.gz'
Content type 'application/x-gzip' length 486355 bytes (474 KB)
==================================================
downloaded 474 KB

* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
checking build system type... x86_64-apple-darwin16.6.0
checking host system type... x86_64-apple-darwin16.6.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for brew... yes
checking for library containing inflate... no
configure: error: in `/private/var/folders/xk/dfj20kgd56xg8796xh874tjr0000gn/T/RtmpvYzc8t/R.INSTALL1597f3a18c2db/git2r':
configure: error:
  ---------------------------------------------
   The zlib library that is required to build
   git2r was not found.

   Please install:
     zlib1g-dev (package on e.g. Debian and Ubuntu)
     zlib-devel (package on e.g. Fedora, CentOS and RHEL)
   and try again.

   If the zlib library is installed on your
   system but the git2r configuration is
   unable to find it, you can specify the
   include and lib path to zlib with:
   R CMD INSTALL --configure-args='--with-zlib-include=INCLUDE_PATH --with-zlib-lib=LIB_PATH' git2r
  ---------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/usr/local/lib/R/3.4/site-library/git2r’
ERROR: dependency ‘git2r’ is not available for package ‘devtools’
* removing ‘/usr/local/lib/R/3.4/site-library/devtools’

The downloaded source packages are in
	‘/private/var/folders/xk/dfj20kgd56xg8796xh874tjr0000gn/T/RtmpbS6iTm/downloaded_packages’
Loading required package: devtools
There were 18 warnings (use warnings() to see them)

And my previous post on https://stackoverflow.com/questions/41955129/r-cant-install-devtools-or-git2r-due-to-lack-of-zlib-on-macos-10-12-3-and-10-12/42202863#42202863.

Does anyone have a solution that is definitive?

swvanderlaan avatar Jul 05 '17 07:07 swvanderlaan

By the way: brew doctor results in the following messages:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
  /Users/swvanderlaan/miniconda2/bin/python-config
  /Users/swvanderlaan/miniconda2/bin/python2-config
  /Users/swvanderlaan/miniconda2/bin/python2.7-config

I'm no expert, but I suspect this is not an issue that affects the ability for R to install git2r. Or does it? In either case, @wkretzsch and @ngwelch how do I go about cleaning my lib and include?

This is my R session info:

R version 3.4.0 (2017-04-21)
Platform: x86_64-apple-darwin16.6.0 (64-bit)
Running under: macOS Sierra 10.12.5

Matrix products: default
BLAS/LAPACK: /usr/local/Cellar/openblas/0.2.19_1/lib/libopenblasp-r0.2.19.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] optparse_1.3.2       BiocInstaller_1.26.0

loaded via a namespace (and not attached):
[1] compiler_3.4.0 getopt_1.20.0

My R libraries are installed here:

.Library
/usr/local/Cellar/r/3.4.0_1/R.framework/Resources/library

Zlib info

zlib: stable 1.2.11 (bottled) [keg-only]
General-purpose lossless data-compression library
https://zlib.net/
/usr/local/Cellar/zlib/1.2.11 (12 files, 374KB)
  Poured from bottle on 2017-07-05 at 09:42:08
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/zlib.rb
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/zlib/lib
    CPPFLAGS: -I/usr/local/opt/zlib/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/zlib/lib/pkgconfig

swvanderlaan avatar Jul 05 '17 07:07 swvanderlaan

I am using macOS 10.12.6 and R 3.4.1. I have the same issue!

configure: error: Unsupported architecture See `config.log' for more details ERROR: configuration failed for package ‘git2r’

yejiawei1234 avatar Aug 23 '17 15:08 yejiawei1234

I too was running into this issue, brew doctor didn't help, uninstalling and reinstalling R didn't help either. I had anaconda installed, however, and completely removing my anaconda installation allowed me to finally install git2r.

akruchte avatar Sep 15 '17 14:09 akruchte

I had a version of this issue (macOS 10.13.3). For some reason, during link, my Anaconda folder is being picked up:

clang-5.0 -std=gnu99 <...> -L/Users/kevin/anaconda3/lib <...>

I suspect this is because Anaconda is on my PATH:

$ echo $PATH
/Users/kevin/anaconda3/bin:<...>

If I remove Anaconda from my PATH before attempting installation, then installation succeeds. I suspect the configure script is accidentally pick up some junk from the Anaconda installation and this is causing the issue.

The main thing I notice is that curl-config is picked up in the Anaconda directory -- from config.log:

configure:5545: found /Users/kevin/anaconda3/bin/curl-config
configure:5557: result: /Users/kevin/anaconda3/bin/curl-config

kevinushey avatar Mar 08 '18 02:03 kevinushey