11

When installing the R package RODBC in RStudio on OS X Yosemite, I get the following error:

configure: error: "ODBC headers sql.h and sqlext.h not found"

This is a common error and indicates that ODBC drivers haven't been installed (iODBC headers aren't included in OS 10.9 hence the separate install required). So, I install unixODBC and confirm that the header files are present in the PATH.

Sys.getenv("PATH") gives me the correct path including where the two files are found.

However, when I try install.packages("RODBC",type = "source") again, the same error persists. Have tested this with iODBC as well as unixODBC.

Are there any other tests I can perform to help diagnose the issue?

12
  • Have you tried following the advice from here?
    – joran
    Jan 22, 2015 at 5:17
  • Absolutely tried that. The header files required are present and in the PATH. Just that when RStudio builds RODBC it can't find them.
    – Carl
    Jan 22, 2015 at 5:26
  • Did you try moving the files themselves rather than simply setting the path?
    – joran
    Jan 22, 2015 at 5:27
  • Yep, they're in /usr/include. There is no libiodbc.a file in the iODBC source, but I'm thinking one step at a time here. :) Have tried with both iODBC and unixODBC with the same error.
    – Carl
    Jan 22, 2015 at 5:34
  • 3
    brew update && brew install unixODBC && wget "http://cran.r-project.org/src/contrib/RODBC_1.3-10.tar.gz" && R CMD INSTALL RODBC_1.3-10.tar.gz from the terminal worked on all our Yosemite systems (R3.1.2, latest Yosemite, latest Xcode/Xcode cmd line tools). I realize that requires Homebrew, but it required no tweaking.
    – hrbrmstr
    Jan 22, 2015 at 11:35

4 Answers 4

22

We have a bunch of Yosemite systems with R 3.1.2 that are all up-to-date with Xcode & Xcode command-line tools. The following consistently works with each major R update or new system install (at the Terminal):

brew update && brew install unixODBC && \
  wget "http://cran.r-project.org/src/contrib/RODBC_1.3-10.tar.gz" && \
  R CMD INSTALL RODBC_1.3-10.tar.gz 

It (obviously) requires Homebrew, but that's what we've standardized on in our shop.

As RODBC is updated, the version number (1.3-10, 1.3-11, ...) will change. To find out the current version, look at https://cran.r-project.org/web/packages/RODBC/index.html.

6
  • I believe that you are a confirmed user of brew and even compile R with it. Do you have any idea whether this works for those of use who are using the CRAN R binaries and hte tools from the r.att.research.com site?
    – IRTFM
    Apr 18, 2016 at 23:39
  • 1
    it now version 1.3-13 Jul 20, 2016 at 16:04
  • 2
    And for some of, we need to brew install wget before using this.
    – Ben
    Nov 24, 2016 at 17:04
  • Your answer was really helpful. Do you know if it's possible to include RODBC in a package via packrat or another method such that all recipients of the package won't need to do these steps?
    – Bobby
    Nov 25, 2016 at 16:38
  • By "in a package", do you mean actually having the RODBC package actually be in source tree of another package? It's technically possible and will require some fiddling with the library location paths, but it won't be CRAN-able and leaves you in the position to ensure all RODBC updates & fixes get put into your source pkg.
    – hrbrmstr
    Nov 25, 2016 at 16:52
3

I got a 404 when calling RODBC_1.3-10.tar.gz so I made a tiny change to the script above and it worked perfectly: brew update && brew install unixODBC && wget "http://cran.r-project.org/src/contrib/RODBC_1.3-11.tar.gz" && R CMD INSTALL RODBC_1.3-11.tar.gz

1
  • and now it's version 1.3-14
    – Abe
    Oct 12, 2016 at 4:01
3

I'm using OS X Yosemite 10.10.5, R version 3.2.2. By following below steps, I'm able to make it work.

  1. brew install unixodbc
  2. brew link unixodbc (if missing this step, R still can not find those header files)
  3. install.packages('RODBC', type='source')
1

On my OS X Yosemite system with unixODBC installed from MacPorts and R 3.3.2, install.packages() failed (whether from repo or from a tarball I had saved locally) but R CMD INSTALL RODBC_1.3-14.tar.gz did the job.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.