I am compiling R-0.90.0 on alpha-dec-osf4.0 and it stops by giving the following message: cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration, parameter 1 has a different type than specified in an earlier declaration of this function. SEXP mkString(const char *s) -----^ cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration, the type of "mkString" is not compatible with the type of a previous declaration of "mkString" at line number 378 in file ../include/Rinternals.h. SEXP mkString(const char *s) -----^ gmake[3]: *** [gram.o] Error 1 gmake[3]: Leaving directory `/home/ming/R-0.90.0/src/main' gmake[2]: *** [R] Error 2 gmake[2]: Leaving directory `/home/ming/R-0.90.0/src/main' gmake[1]: *** [R] Error 1 gmake[1]: Leaving directory `/home/ming/R-0.90.0/src' gmake: *** [R] Error 1 Your help would be greatly appreciated. -- Xiaoming Cai School of Geography and Environmental Sciences .&______~*@*~______&. University of Birmingham "w/%%%%%%%%%%%%%%%%%%%\w" Edgbaston, Birmingham `Y""Y""Y"""""Y""Y""Y' B15 2TT United Kingdom p-p_|__|__|_____|__|__|_q-q Tel: 44 (121) 414-5533 (O) _-[EEEEM==M==MM===MM==M==MEEEE]-_ Fax: 44 (121) 414-5528 Email: x.cai at bham.ac.uk which will be directed to the alternative: caix at isdugp.bham.ac.uk -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At Fri, 26 Nov 1999 11:44:33 GMT, Dr X Cai <caix at isdux1.bham.ac.uk> wrote:> > I am compiling R-0.90.0 on alpha-dec-osf4.0 and it stops by giving the > following message: > > cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration, parameter 1 has a different type than specified in an earlier declaration of this function. > SEXP mkString(const char *s) > -----^ > cc: Error: ../../../R/src/main/gram.y, line 1365: In this declaration, the type of "mkString" is not compatible with the type of a previous declaration of "mkString" at line number 378 in file ../include/Rinternals.h. > SEXP mkString(const char *s) > -----^It's a prank of bison. Bison generate following code. #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif `SEXP mkString(const char *s)' is replaced to `SEXP mkString(char *s)' by preprocessor. And, cc compiler is too strict to ignore the difference bettween type `char *' and `const char *' defined in Rinternals.h. My configure option is here: CC=cc CFLAGS='-O5 -I/usr/local/include -std' CPPFLAGS='-O5 -I/usr/local/include' FFLAGS='-O5' ./configure --with-f77 --with-readline `-std' option defines __STDC__, and then compile will be successful. -- Mitsuru Oka -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> Prof Brian D Ripley writes:> On Fri, 26 Nov 1999, Kurt Hornik wrote: >> Albrecht Gebhardt had the same bug report a few days ago. I don't quite >> understand what is going on. configure checks (via AC_C_CONST) whether >> `const' works fine. If not, it defines const as empty in Rdefines.h. >> This in turn gets included in all of our source files. So how can it >> happen that const is empty in one place and not in another?> Look in gram.c:> #ifndef __cplusplus > #ifndef __STDC__ > #define const > #endif > #endif> comes before the forward declaration and the definition. We have ANSI > compilers, so this does not happen to us.> I don't know how to tell bison to behave!I know :-) In bison-xy/src/output.c, replace the unconditional /* Make "const" do nothing if not in ANSI C. */ fprintf (ftable, "#ifndef __cplusplus\n#ifndef __STDC__\n#define const\n#endif \n#endif\n\n"); by something more useful :-) But seriously, what is going on here? Autoconf says - Macro: AC_C_CONST If the C compiler does not fully support the keyword `const', define `const' to be empty. Some C compilers that do not define `__STDC__' do support `const'; some compilers that define `__STDC__' do not completely support `const'. Programs can simply use `const' as if every C compiler supported it; for those that don't, the `Makefile' or configuration header file will define it as empty. so how can we deal with the situation where __STDC__ is not defined by the compiler but `const' still works? One solution would be to mimic Bison's rule in addition to the autoconf magic, so that we define const as empty when __STDC__ is not defined, even if const works. ??? -k -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._