r - 如何在 macOS 上安装和定位 ODBC 头文件 sql.h 和 sqlext.h

标签 r header rodbc

我正在尝试安装包 RODBC在 OS 10.12 的 MacBook Air 上通过 CRAN。

我收到以下错误:

Installing package into ‘/Users/aaron.samuels/Library/R/3.3/library’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of
  C/C++/Fortran: ‘RODBC’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘RODBC’

trying URL 'https://cran.rstudio.com/src/contrib/RODBC_1.3-14.tar.gz'
Content type 'application/x-gzip' length 1163799 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

* installing *source* package ‘RODBC’ ...
** package ‘RODBC’ successfully unpacked and MD5 sums checked
checking for gcc... clang
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 clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... 
rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sql.h usability... no
checking sql.h presence... no
checking for sql.h... no
checking sqlext.h usability... no
checking sqlext.h presence... no
checking for sqlext.h... no
configure: error: "ODBC headers sql.h and sqlext.h not found"
ERROR: configuration failed for package ‘RODBC’
* removing ‘/Users/aaron.samuels/Library/R/3.3/library/RODBC’
Warning in install.packages :
  installation of package ‘RODBC’ had non-zero exit status

下载的源码包在

/private/var/folders/3l/nrtzvm592736jz_qh_5l1wbmffq3bz/T/RtmpeuPUR0/downloaded_packages

关于如何轻松安装这些 header 并随后成功安装 RODBC 有什么建议吗?

最佳答案

我找到了启用 ODBC driver 的官方 Microsoft 源代码.

你只需要在终端上运行这行

/usr/bin/ruby -e "$(curl -fsSL 
https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install --no-sandbox msodbcsql17 mssql-tools

关于r - 如何在 macOS 上安装和定位 ODBC 头文件 sql.h 和 sqlext.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41569272/

相关文章:

Rodbc 错误 : Error in sqlSave(DataConnection, dataframeInput,表名 = tableNameString,:无法附加到表

mysql - 如何在 Mac OS 10.10.3 (Yosemite) 上使用 ODBC 将 R 连接到 MySQL 数据库

r - Knitr:将代码块中的文本打印为R markdown

r - 使用 plotly 中的标记将抖动添加到箱线图

c++ - 为什么我们需要 *.lib 文件?

javascript - 更改 H3 标签的颜色 onclick

r - 通过 RODBC 连接到 SQLite

css - R shinyDashboard 自定义框状态颜色

r - 使用 permute 包计算分块设计中的所有排列

c - 头文件中的结构体和结构体类型函数