From ripley at stats.ox.ac.uk  Sat Jun  7 14:11:54 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat, 7 Jun 2008 13:11:54 +0100 (BST)
Subject: [Rd] Fail to call AC_CACHE_CHECK on R 2.7.0 for Solaris
In-Reply-To: <484A6EEB.10704@onetel.net>
References: <484A6EEB.10704@onetel.net>
Message-ID: <alpine.LFD.1.10.0806071308510.13253@gannet.stats.ox.ac.uk>

This is covered in the 'R Installation and Administration' manual that
INSTALL asked you to read.  Specifically for Solaris:

  Modern Solaris systems allow a large selection of Open Source software
  to be installed via @command{pkg-get}: a Sparc Solaris 10 system came
  with @code{libreadline} and @code{libiconv} and a choice of @code{gcc3}
  and @code{gcc4} compilers, installed under @file{/opt/csw}.  (You will
  need GNU @code{libiconv}: the Solaris version of @code{iconv} is not
  sufficiently powerful.)

R 2.7.0 is documented to build on several versions of Solaris in that 
manual, so the problem is definitely not 'R on Solaris'.

You analysis is plain wrong.  Search for r_cv_iconv_latin1 in 
configure and you will see three lines which set it (plus one that checks 
if it was set in the cache).

On Sat, 7 Jun 2008, Dr. David Kirkby wrote:

> I've tried to build R 2.6.1 and 2.7.0 on Solaris 10 update 4 (SPARC) and both 
> configure ok, so you might ask why I suspect there is a problem.
>
> I tried to build the maths program Sage
>
> http://www.sagemath.org/
>
> version 3.0.3alpha1. Sage fails when building R 2.6.1 - (Sage includes R in 
> the package). The relavant bit of Sage, which is only using an unmodified R 
> configure script is:
>
> checking iconv.h usability... yes
> checking iconv.h presence... yes
> checking for iconv.h... yes
> checking for iconv... in libiconv
> checking whether iconv accepts "UTF-8", "latin1" and "UCS-*"... no
> checking for iconvlist... yes
> configure: error: --with-iconv=yes (default) and a suitable iconv is
> not available
>
> Looking at the Sage problem in detail, I believe I know the reason and are 
> somewhat surprised R builds at all on Solaris. I think this problem is an R 
> problem, not a Sage problem.
>
> For some reason the R "configure" script was not happy with my readline, but 
> after trying to configure with the configure option
>
> --with-readline=no
>
> The R 2.6.1 source configured ok. I did not bother running 'make' but there 
> were
> no failures when the configure script was run.  I then repeated this
> with the latest version of R (2.7.0) and got similar results.
>
> Looking at the file configure.ac in R (both 2.6.1 and 2.7.0), I see:
>
> ## iconv headers and function.
> if test "${use_iconv}" = yes; then
> R_ICONV
> if test "$r_cv_iconv_latin1" != yes; then
>   AC_MSG_ERROR([--with-iconv=yes (default) and a suitable iconv is
> not available])
> fi
> else
>   AC_MSG_WARN([--with-iconv=no is deprecated and will be withdrawn
> shortly])
> fi
>
> Clearly the value of r_cv_iconv_latin1 determines if this test passes
> or fails and so whether the error message that I get is printed or not.
>
> The variable r_cv_iconv_latin1 is never set directly in configure, but
> by in a Macro called AC_CACHE_CHECK in the file m4/R.m4.
>
> Looking in that macro r4/R.m4 we see:
>
> AC_CACHE_CHECK([whether iconv accepts "UTF-8", "latin1" and "UCS-
> *"],
> [r_cv_iconv_latin1],
>
> So it would appear to me that AC_CACHE_CHECK needs to be run in order
> that r_cv_iconv_latin will be set properly. But looking at
> configure.ac, I think AC_CACHE_CHECK is only called on Linux, and not
> on Solaris. Obviously this could explain why this bit of Sage works on
> Linux, but not Solaris.
>
> ## check for visible __libc_stack_end on Linux
> case "${host_os}" in
> linux*)
>   AC_CACHE_CHECK([for visible __lib_stack_end],
>   [r_cv_libc_stack_end],
>   [AC_RUN_IFELSE([AC_LANG_SOURCE([[
> #include "confdefs.h"
> #include <stdlib.h>
> extern void * __libc_stack_end;
>
> So it seems to me this will never work, as the the relevant macro is
> not run on Solaris. It begs the obvious question why does this work
> when I download the source of R. I can't see the answer to that one,
> but there are reports of R failing to build on Solaris, but for me at
> least, it configures ok.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Fail to call AC_CACHE_CHECK on R 2.7.0 for Solaris
Prof Brian Ripley