Re: [R] RODBC installation: error message
Hi Gregory, See below. On Jan 5, 2012, at 4:20 PM, gregory benison wrote: 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. snipped other content To split hairs, there are two issues at play here, irrespective of the ordering of the tests: 1. If you do not have unixODBC installed, you will get an error message regarding a missing ODBC driver manager, if as you have done here, that test is first rather than second. 2. If you have unixODBC installed (so you pass the first test in your scenario), but do not have the 'devel' part, which is a separate install on most Linuxen with package managers (RHEL/CentOS, Fedora, Debian and derivatives like Ubuntu and Mint, etc.), you will still get the error message regarding the missing header files. That is an entirely different error than missing the actual ODBC driver manager. So you can argue about the ordering of the tests, but the end result is the same. Only if you have some knowledge about compiling source code (on ANY operating system), will you understand the meaning of missing header files AND only if you have some lower level knowledge of development on Linuxen specifically, will you know that the header files are contained in a separate binary package that needs to be installed as well, the details of which will be specific to the Linux distribution that you have chosen to install. On top of that, if as with most Linuxen today, you don't have the software development packages installed (you are a naive user of Linux and only did a default install of the distribution), you won't have compilers and other associated tools (eg. make, etc.) installed either. At some point, the user has to be responsible for obtaining the requisite knowledge of their operating system, independent of the use of R. Despite the protestations by some on the web that their grandmothers are running Linux, it is still largely a geek's platform (with a 1% to 1.5% marketshare on the desktop) and due to the marketplace fragmentation of the plethora of distributions and desktop environments, further requires distribution and even version specific knowledge as well. As I noted earlier, if you are going to use Linux, you are generally going to be expected to have a more technical level of knowledge than somebody who is running Windows or OSX, where for the most part, one can install pre-compiled binary packages from CRAN, thanks in large measure to folks like Kurt, Uwe, Duncan, Simon and Prof. Ripley (I may be missing others) who have taken the time over the years to put the testing and build infrastructure in place to automate much of that process. Since there are over 3,500 packages on CRAN and some proportion (I don't know the number) have C/C++ and/or FORTRAN code in them, which will require compilation when installing source packages using either install.packages() or R CMD INSTALL on Linuxen, addressing RODBC in isolation is ultimately not helpful, since like most CRAN packages, it has a finite audience of users (me being very thankful to Prof. Ripley to be one of them). I cannot speak for Prof. Ripley here, but since you seem to have the requisite skills, he may be open to accepting a patch against his package that would narrowly address the issue that you raise. However, that does not change the defacto behavior for all of the other CRAN packages that will have similar requirements when being installed from source and will, as is the case with Linux generally, output relatively terse error messages when faced with these kinds of issues. Also as Duncan noted, perhaps there may be a better mechanism in gaining access to install time requirements for CRAN packages. In the case of RODBC, Prof. Ripley has taken the time to create a vignette which covers much of this material. That is directly available from the CRAN page for the package,
Re: [R] RODBC installation: error message
1. If you do not have unixODBC installed, you will get an error message regarding a missing ODBC driver manager, if as you have done here, that test is first rather than second. If the test for the headers comes first, and no driver manager is installed, configure exits with an error before the library test is run (hence the error message regarding a missing driver manager is not displayed). I cannot speak for Prof. Ripley here, but since you seem to have the requisite skills, he may be open to accepting a patch against his package that would narrowly address the issue that you raise. OK, here's my shot at such a patch (below), together with the resulting configure output in cases where the library or the headers are missing. I realize that there are matters of style preference here, that this approach errs on the side of verbosity rather than terseness, and that it's entirely up to the R package maintainers which style to adopt. Thanks for the replies! Greg Case 1, no ODBC driver manager installed = 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 checking for library containing SQLTables... no configure: error: No ODBC driver manager found; see section Installation in inst/doc/RODBC.pdf (also at http://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf) ERROR: configuration failed for package 'RODBC' == Case 2, driver manager installed but no headers 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 checking for library containing SQLTables... -lodbc configure: error: Found ODBC driver manager library (-lodbc), but not required ODBC headers sql.h and sqlext.h. (Need -devel version of ODBC driver manager?) ERROR: configuration failed for package 'RODBC' = patch follows diff --git a/configure.ac b/configure.ac index 8f9fc6a..8661e8f 100644 --- a/configure.ac +++ b/configure.ac @@ -64,10 +64,6 @@ 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 @@ -75,9 +71,23 @@ if test [ -n ${odbc_mgr} ] ; then AC_MSG_ERROR(ODBC driver manager '${odbc_mgr}' not found)) else AC_SEARCH_LIBS(SQLTables, odbc odbc32 iodbc, , -AC_MSG_ERROR(no ODBC driver manager found)) +AC_MSG_ERROR([ +No ODBC driver manager found; +see section Installation in inst/doc/RODBC.pdf +(also at http://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf)])) +fi + +dnl Exit with error if ODBC headers were not found +if test ${ac_cv_header_sql_h} = no || + test ${ac_cv_header_sqlext_h} = no; then + AC_MSG_ERROR([ +Found ODBC driver manager library ($ac_cv_search_SQLTables), +but not required ODBC headers sql.h and sqlext.h. +(Need -devel version of ODBC driver manager?) +]) 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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RODBC installation: error message
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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RODBC installation: error message
On 12-01-03 2:39 PM, gregory benison wrote: If one attempts to install RODBC (via install.packages('RODBC')) without having an ODBC driver installed, this error message results: 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 '/usr/lib/R/library/RODBC' Yes, the RODBC README describes the needed prerequisites, but for someone who just wants to use RODBC and tries to install it in the most natural way, i.e. from R Installation and Administration: For most users it suffices to call ‘install.packages(pkgname)’ the result is the above error message, which could be more informative. RODBC is not my package, but I can say from experience that it's hard to put together error messages that satisfy everyone. Here, the problem is that configuration couldn't find the files sql.h and sqlext.h, and that's what the error says. Not installing ODBC is one reason that might happen; another is installing it improperly, and there are probably others, too. I think it's best if the error messages describe the problems; trying to diagnose the solution is something that needs human intervention. One thing R could do better is to provide a standard way to view README and similar files before installing a package. That might have helped here. Duncan Murdoch Greg Benison __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RODBC installation: error message
Le mardi 03 janvier 2012 à 11:39 -0800, gregory benison a écrit : If one attempts to install RODBC (via install.packages('RODBC')) without having an ODBC driver installed, this error message results: 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 '/usr/lib/R/library/RODBC' Yes, the RODBC README describes the needed prerequisites, but for someone who just wants to use RODBC and tries to install it in the most natural way, i.e. from R Installation and Administration: For most users it suffices to call ‘install.packages(pkgname)’ I guess this applies only to users installing binary packages. If you build packages from source, the build system runs ./configure, which returns this automated message. Ideally, you shouldn't need to build packages from source when all you want is use them... (Distributions could ship binary packages that R would detect and install automatically?) Cheers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RODBC installation: error message
On Jan 4, 2012, at 8:02 AM, Milan Bouchet-Valat wrote: Le mardi 03 janvier 2012 à 11:39 -0800, gregory benison a écrit : If one attempts to install RODBC (via install.packages('RODBC')) without having an ODBC driver installed, this error message results: 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 '/usr/lib/R/library/RODBC' Yes, the RODBC README describes the needed prerequisites, but for someone who just wants to use RODBC and tries to install it in the most natural way, i.e. from R Installation and Administration: For most users it suffices to call ‘install.packages(pkgname)’ I guess this applies only to users installing binary packages. If you build packages from source, the build system runs ./configure, which returns this automated message. Ideally, you shouldn't need to build packages from source when all you want is use them... (Distributions could ship binary packages that R would detect and install automatically?) That is up to the resources available for each Linux distribution. Debian based distributions have done a better job of this for R than most, largely due to Dirk et al making the commitment and taking the time over the years to support a large number of CRAN packages via apt. However, there is not the same level of commitment for others (eg. Fedora, RHEL/CentOS, etc.), leaving most others to install from source, thus requiring users to manually satisfy pre-requisites for installation. R itself is available for installation via binary, but the selection of CRAN packages is much more limited. 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. In years past, the *-devel RPMs were frequently installed by default, but as the Linux community has evolved, current defaults tend to not install 'development' related packages, which include compilers and related tools. This allows for smaller footprints for the installed OS for non-technical end users. If you are going to use R on Linux, you need to be prepared to get your hands dirty under the hood at a lower level than if you are using Windows or OSX. In this particular case, Prof. Ripley has taken great pains to provide documents to guide the user on the installation of not only RODBC itself, but other components of the ODBC ecosystem to get things working. Regards, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RODBC installation: error message
One thing R could do better is to provide a standard way to view README and similar files before installing a package. That might have helped here. Agreed... right now, the R documentation points to a straightforward, one-line way to download and install packages from the R command line, but not to a similarly straightforward way to view a package's README content (as far as I can tell). __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RODBC installation: error message
If one attempts to install RODBC (via install.packages('RODBC')) without having an ODBC driver installed, this error message results: 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 '/usr/lib/R/library/RODBC' Yes, the RODBC README describes the needed prerequisites, but for someone who just wants to use RODBC and tries to install it in the most natural way, i.e. from R Installation and Administration: For most users it suffices to call ‘install.packages(pkgname)’ the result is the above error message, which could be more informative. Greg Benison __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.