5

I'm trying to install dplyr from its repository, but I getting the following error. I'm using MBP with Yosemite and Xcode 6.2 (it's a bit outdate). I found this curious, apparently, it's not a common issue as I didn't find any thread on this error message. I'm wondering what is the build tools I'm lacking here.

> devtools::install_github("hadley/dplyr")
Downloading GitHub repo hadley/dplyr@master
from URL https://api.github.com/repos/hadley/dplyr/zipball/master
Error: Could not find build tools necessary to build dplyr

This is the error I'm receiving from terminal when I try to install a package from source locally:

clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -DPLATFORM_PKGTYPE='"mac.binary.mavericks"'    -fPIC  -Wall -mtune=core2 -g -O2  -c pause.c -o pause.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/X11/lib -L/usr/local/lib /usr/local/lib/libcairo.a /usr/local/lib/libpixman-1.a /usr/local/lib/libfreetype.a /usr/local/lib/libfontconfig.a -lxml2 /usr/local/lib/libreadline.a -o profvis.so pause.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
clang: error: no such file or directory: '/usr/local/lib/libreadline.a'
Marie-Eve
  • 565
  • 4
  • 15
  • Did you install the Command Line Tools? I believe they're included with Xcode, but not necessarily installed. You can either install them from Xcode (I think), or directly from the Apple Developer site. – alistaire Jan 30 '16 at 01:00
  • Yes, I did install the Command Line Tools. – Marie-Eve Jan 30 '16 at 02:23
  • I reinstalled from source, and the only compiler I saw it call was `clang++`. You can check if it's installed by typing `clang++ --version` into Terminal; you should get back something like `Apple LLVM version 7.0.2 (clang-700.1.81)`. – alistaire Jan 30 '16 at 02:54
  • `gfortran` is also available on the CRAN website, and necessary for building R itself from source. I don't think it's necessary for `dplyr`, but that's the only other thing I can think of... – alistaire Jan 30 '16 at 03:05
  • I see: clang++ --version Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) – Marie-Eve Jan 30 '16 at 03:27
  • And gfortran --version GNU Fortran (Homebrew gcc 5.3.0) 5.3.0 Copyright (C) 2015 Free Software Foundation, Inc. – Marie-Eve Jan 30 '16 at 03:28
  • You could try updating CLT by downloading a newer version from [Apple](https://developer.apple.com/downloads/), though I'm dubious that's the problem. Looking at the [dplyr GitHub](https://github.com/hadley/dplyr), it does say that you should install his `lazyeval` package first (if you haven't already). I think it handles all the NSE in `dplyr`, and thus may be necessary to build from source. – alistaire Jan 30 '16 at 03:50
  • I do have `lazyeval` installed. The problem very likely is related to the error I'm receiving (I update the question because there is not much space here). – Marie-Eve Jan 30 '16 at 06:37

3 Answers3

1

You can go to this address to download and install a newer version of Command Line Tools as well as XCode as mentioned by @alistaire, but the one you have is fine.

By the message you posted, it suggests a linkage problem. You want to create a symlink for the readline lib. Homebrew does this for us, but for some reason it didn't; so you may be able to solve this by creating the link manually with --force option as:

brew link readline --force

daniel
  • 1,186
  • 2
  • 12
  • 21
0

As a GNU project, R probably is accustomed to using GNU tools and the GCC compiler suite. I would recommend that you download the standard compilers and GNU coreutils through Homebrew: https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/

libreadline is a GNU library as well, so I would assume you may encounter more problems should you not obtain GNU libraries and utility tools through a package manager.

CinchBlue
  • 6,046
  • 1
  • 27
  • 58
  • I think your answer would also solve the problem, but that one line command of the other answer by @daniel just made it. – Marie-Eve Jan 30 '16 at 13:28
0

I just fell over this problem under macOS Sierra, with Xcode installed.

I went to check that I had the gcc C compiler installed properly, so I typed

gcc --version

This resulted in the error message

xcrun: error: active developer path ("/Users/richierocks/Downloads/Xcode-beta.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.

I typed

sudo xcode-select --switch /Applications/Xcode.app/

Then I entered my macOS password.

After this, installing dplyr worked correctly.

Richie Cotton
  • 118,240
  • 47
  • 247
  • 360