[R] RODBC installation: error message

gregory benison gbenison at gmail.com
Thu Jan 5 23:20:19 CET 2012


> As Duncan noted, the message is pretty clear in that the ODBC header files are missing, which are required to compile RODBC from source. On RH based Linuxen, this requires the installation of the unixODBC-devel RPM, much as one would need to have other *-devel RPMs (eg. readline-devel) installed for compiling many applications from source.
>

Since a lot of R users may not be familiar with these header files, I
think the configure script could go a step further in explaining why
it was looking for these headers (to find an installed ODBC driver
manager), and that it didn't find one.  To illustrate what I mean,
here is the result of running R CMD INSTALL on a system lacking an
installed dsm where I swapped the order of the tests in configure.ac
(see patch below) such that the library tests come before the header
tests:

> * installing *source* package 'RODBC' ...
> checking for library containing SQLTables... no
> configure: error: "no ODBC driver manager found"
> ERROR: configuration failed for package 'RODBC'

To me, that is a more helpful error message, because it makes it clear
that you need to install an ODBC driver manager.

Another example is found in the configure script for
mysql-connector-odbc.  Like RODBC, it requires an installed driver
manager including header files.  It can use either unixODBC or iodbc.
Here is the result of running its configure script, without arguments,
on a system without an installed driver manager:

...
checking if driver should be linked against odbcinst library... yes
checking for iodbc-config... no
checking for SQL_ATTR_UNIXODBC_VERSION in sqlext.h... not found
configure: error: no suitable driver manager selected or found

Again, I think that is a better error message, if only because it
includes the phrase "driver manager".

============== patch 1 -- swap order of tests in configure.ac ===============

diff --git a/configure.ac b/configure.ac
index 8f9fc6a..997da8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,13 +62,6 @@ if test -n "${ODBC_CONFIG}"; then
 fi
 CPPFLAGS="${CPPFLAGS} ${RODBC_CPPFLAGS}"

-dnl Check the headers can be found
-AC_CHECK_HEADERS(sql.h sqlext.h)
-if test "${ac_cv_header_sql_h}" = no ||
-   test "${ac_cv_header_sqlext_h}" = no; then
-   AC_MSG_ERROR("ODBC headers sql.h and sqlext.h not found")
-fi
-
 dnl search for a library containing an ODBC function
 if test [ -n "${odbc_mgr}" ] ; then
   AC_SEARCH_LIBS(SQLTables, ${odbc_mgr}, ,
@@ -78,6 +71,13 @@ else
                 AC_MSG_ERROR("no ODBC driver manager found"))
 fi

+dnl Check the headers can be found
+AC_CHECK_HEADERS(sql.h sqlext.h)
+if test "${ac_cv_header_sql_h}" = no ||
+   test "${ac_cv_header_sqlext_h}" = no; then
+   AC_MSG_ERROR("ODBC headers sql.h and sqlext.h not found")
+fi
+
 dnl for 64-bit ODBC need SQL[U]LEN, and it is unclear where they are defined.
 AC_CHECK_TYPES([SQLLEN, SQLULEN], , , [# include <sql.h>])
 dnl for unixODBC header



More information about the R-help mailing list