From boycer at u.washington.edu  Tue Jul 19 19:23:06 2005
From: boycer at u.washington.edu (boycer@u.washington.edu)
Date: Tue, 19 Jul 2005 19:23:06 +0200 (CEST)
Subject: [Rd] build of REventLoop package crashes with 2.1 due tosyntax
	error in Defn.h (PR#8017)
Message-ID: <20050719172306.47DE7A6FD@slim.kubism.ku.dk>

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;
<



[Rd] build of REventLoop package crashes with 2.1 due tosyntax error in Defn.h (PR#8017)
boycer@u.washington.edu