[Rd] (PR#8017) build of REventLoop package crashes with 2.1 due

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Wed Jul 20 09:53:45 CEST 2005


Looking at the REventLoop_0.2-3 sources, the problem _is_ in the package. 
It include IOStuff.h (which includes Defn.h) without including config.h, 
which should always be included before R's internal headers. The package 
tries to get around this by defining some entries from config.h, but not 
enough for current R versions.  It seems to work if you add -DHAVE_WCHAR_H 
to the defines.  (I did not spot how SUPPORT_MBCS got defined, but it 
seems it is.)

Incidentally, I was unable to get the package to build unless R was built 
in its source dir, and there is a mismatch between the version of the tar 
file (0.2-3) and declared in the DESCRIPTION and hence in the PACKAGES 
file (0.2).

What Duncan is trying to do here is extremely tricky, so please do not 
file bug reports against R when such things do not work for you: they are 
not deficiencies in R.

On Wed, 20 Jul 2005 ripley at stats.ox.ac.uk wrote:

> In what way is this a bug in R?   It looks like a bug in the package, and
> as Defn.h is not part of R's API any packge using it is `at risk' (and
> cannot be installed in a binary-only installation, or even an installed
> version of R).
>
> In particular, Defn,.h depends on config.h, and it seems you installed a
> binary version of R and used separate sources.   I would suggest building
> R from the sources, and then seeing if you can install your package into
> the build tree.
>
> mbstate_t will be defined in wchar.h, and if configure is working
> correctly that will be included by Defn.h.  (And we have heard no reports
> to the contrary.)
>
> On Tue, 19 Jul 2005 boycer at u.washington.edu wrote:
>
>> Full_Name: Richard Boyce
>> Version: 2.1.-1
>> OS: Debian testing/unstable
>> Submission from: (NULL) (128.95.123.29)
>>
>>
>> While building a custom package using a modified version of Duncan's
>> REventLoop with R version 2.1 (Debian package r-base, r-base-dev) and R
>> source from apt-get source 2.1.1 I get the following error:
>>
>> $ R CMD build vjREventLoop
>> * checking for file 'vjREventLoop/DESCRIPTION' ... OK
>> * preparing 'vjREventLoop':
>> * cleaning src
>> * checking whether 'INDEX' is up-to-date ... NO
>> * use '--force' to overwrite the existing 'INDEX'
>> * removing junk files
>> * building 'vjREventLoop_0.2.tar.gz'
>>
>> $ su
>> # R CMD INSTALL vjREventLoop_0.2.tar.gz
>> gcc -I/usr/lib/R/include    -I/usr/src/r-base-2.1.1/src/include -fPIC  -g -O2
>> -c Reventloop.c -o Reventloop.o
>> In file included from /usr/src/r-base-2.1.1/src/include/IOStuff.h:30,
>>                 from Reventloop.c:8:
>> /usr/src/r-base-2.1.1/src/include/Defn.h:886: error: syntax error before
>> "mbstate_t"
>> Reventloop.c: In function `R_mainLoop':
>> Reventloop.c:112: warning: assignment from incompatible pointer type
>> Reventloop.c:156: warning: assignment from incompatible pointer type
>> make: *** [Reventloop.o] Error 1
>> ERROR: compilation failed for package 'vjREventLoop'
>> ** Removing '/usr/local/lib/R/site-library/vjREventLoop'
>> ** Restoring previous '/usr/local/lib/R/site-library/vjREventLoop'
>>
>> *Build works correctly with R-2.0.0 installed from source* with
>> $ ./configure --prefix=/usr/local --enable-R-shlib
>> $ make
>> $ su
>> # make install
>>
>> Inspection of Defn.h does not identify syntax error but I am not familiar with
>> all the details. Diff (probably not useful):
>> $ diff /usr/src/r-base-2.1.1/src/include/Defn.h
>> /opt/Downloads/r-cran/R-2.0.0/src/include/Defn.h
>>
>> 4c4
>> <  *  Copyright (C) 1998--2005  The R Development Core Team.
>> ---
>>>  *  Copyright (C) 1998--2004  The R Development Core Team.
>> 472c472
>> < LibExtern char*       R_Home;             /* Root of the R tree */
>> ---
>>> extern char*  R_Home;             /* Root of the R tree */
>> 499c499
>> < extern int    R_Expressions   INI_as(5000);   /* options(expressions) */
>> ---
>>> extern int    R_Expressions   INI_as(500);    /* options(expressions) */
>> 514,515c514
>> < LibExtern char*       R_TempDir       INI_as(NULL);   /* Name of per-session
>> dir */
>> < extern char   R_StdinEnc[31]  INI_as("");     /* Encoding assumed for stdin
>> */
>> ---
>>> extern char*  R_TempDir       INI_as(NULL);   /* Name of per-session dir */
>> 530d528
>> < extern void   R_setupHistory();
>> 541,542c539
>> < LibExtern Rboolean utf8locale  INI_as(FALSE);  /* is this a UTF-8 locale? */
>> < LibExtern Rboolean mbcslocale  INI_as(FALSE);  /* is this a MBCS locale? */
>> ---
>>> extern Rboolean utf8locale  INI_as(FALSE);  /* is this a UTF-8 locale? */
>> 596a594
>>> # define duplicated           Rf_duplicated
>> 633c631
>> < # define Mbrtowc              Rf_mbrtowc
>> ---
>>> # define match                        Rf_match
>> 686a685
>>> int   R_ShowFile(char*, char*);
>> 799,800c798
>> < SEXP R_data_class(SEXP , Rboolean);
>> < SEXP R_data_class2(SEXP);
>> ---
>>> SEXP R_data_class(SEXP , int);
>> 864,869d861
>> < typedef enum {
>> <     Rprt_adj_left = 0,
>> <     Rprt_adj_right = 1,
>> <     Rprt_adj_centre = 2
>> < } Rprt_adj;
>> <
>> 872,939c864
>> < char *EncodeString(SEXP, int, int, Rprt_adj);
>> <
>> <
>> < #if defined(HAVE_WCHAR_H) && defined(SUPPORT_MBCS)
>> < #include <wchar.h>
>> < #endif
>> <
>> < /* main/util.c */
>> < void UNIMPLEMENTED_TYPE(char *s, SEXP x);
>> < void UNIMPLEMENTED_TYPEt(char *s, SEXPTYPE t);
>> < Rboolean utf8strIsASCII(char *str);
>> < #ifdef SUPPORT_MBCS
>> < int utf8clen(char c);
>> < #define mbs_init(x) memset(x, 0, sizeof(mbstate_t))
>> < size_t Mbrtowc(wchar_t *wc, const char *s, size_t n, mbstate_t *ps);
>> < void mbcsToLatin1(char *in, char *out);
>> < Rboolean mbcsValid(char *str);
>> < char *Rf_strchr(const char *s, int c);
>> < char *Rf_strrchr(const char *s, int c);
>> < #else
>> < #define Rf_strchr(s, c) strchr(s, c)
>> < #define Rf_strrchr(s, c) strrchr(s, c)
>> < #endif
>> < #ifdef Win32
>> < void R_fixslash(char *s);
>> < void R_fixbackslash(char *s);
>> < #endif
>> < #if defined(Win32) && defined(SUPPORT_UTF8)
>> < #define mbrtowc(a,b,c,d) Rmbrtowc(a,b)
>> < #define wcrtomb(a,b,c) Rwcrtomb(a,b)
>> < #define mbstowcs(a,b,c) Rmbstowcs(a,b,c)
>> < #define wcstombs(a,b,c) Rwcstombs(a,b,c)
>> < size_t Rmbrtowc(wchar_t *wc, const char *s);
>> < size_t Rwcrtomb(char *s, const wchar_t wc);
>> < size_t Rmbstowcs(wchar_t *wc, const char *s, size_t n);
>> < size_t Rwcstombs(char *s, const wchar_t *wc, size_t n);
>> < #endif
>> <
>> < /* used in relop.c and sort.c */
>> < #if defined(Win32) && defined(SUPPORT_UTF8)
>> < #define STRCOLL Rstrcoll
>> < #else
>> <
>> < #ifdef HAVE_STRCOLL
>> < #define STRCOLL strcoll
>> < #else
>> < #define STRCOLL strcmp
>> < #endif
>> <
>> < #endif
>> <
>> < /* Localization */
>> <
>> < #ifdef ENABLE_NLS
>> < #include <libintl.h>
>> < #ifdef Win32
>> < #define _(String) libintl_gettext (String)
>> < #undef gettext /* needed for graphapp */
>> < #else
>> < #define _(String) gettext (String)
>> < #endif
>> < #define gettext_noop(String) String
>> < #define N_(String) gettext_noop (String)
>> < #else /* not NLS */
>> < #define _(String) (String)
>> < #define N_(String) String
>> < #endif
>> <
>> ---
>>> char *EncodeString(SEXP, int, int, int);
>> 950,957d874
>> < /* structure for caching machine accuracy values */
>> < typedef struct {
>> <     int ibeta, it, irnd, ngrd, machep, negep, iexp, minexp, maxexp;
>> <     double eps, epsneg, xmin, xmax;
>> < } AccuracyInfo;
>> <
>> < extern AccuracyInfo R_AccuracyInfo;
>> <
>>
>> ______________________________________________
>> 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
>
> ______________________________________________
> 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



More information about the R-devel mailing list