[Rd] nondigits in R_FILEVERSION mess up Windows build

Bill Dunlap bill at insightful.com
Sat Apr 19 07:15:16 CEST 2008


I tried for the first time to build R from source on Windows, where I
got the source code via svn.  Per the Installation and Administration
manual, I altered src\gnuwin32\MkRules so it had the the locally
correct paths to HTML Help Workshop and Inno Setup 5.  I also set
USE_SVNVERSION=yes, as suggested in MkRules itself.  Then, while in
the directory src/gnuwin32 I ran 'make all recommended' and got an
error from windres very early in the build:

  E:\R\R-svn\r-devel\src\gnuwin32>make all recommended
  make --no-print-directory -C front-ends Rpwd
  make -C ../../include -f Makefile.win version
  make Rpwd.exe
  gcc  -std=gnu99 -I../../include  -O3 -Wall -pedantic  -c rpwd.c -o rpwd.o
  windres --preprocessor="gcc -E -xc -DRC_INVOKED"   -i rcico.rc -o rcico.o
  c:\Rtools\MinGW\bin\windres.exe: rcico.rc:9: syntax error
  make[3]: *** [rcico.o] Error 1
  make[2]: *** [Rpwd] Error 2
  make[1]: *** [front-ends/Rpwd.exe] Error 2
  make: *** [all] Error 2

Line 9 of src\gnuwin32\front-ends\rcico.rc is
  FILEVERSION R_FILEVERSION
The problem was that my change to MkRules caused 'svnversion' to put an
'M' (modified) on the end of the svn version it reports.  This svn
version number is used in the R_FILEVERSION macro, which is used in in
the *.rc files.  The resource file compiler, windres, appears to choke on
non-digits in R_FILEVERSION.  (A comment in tools\GETVERSION indicates
it might choke on leading 0's as well.)

After the following change, to remove the trailing M or S from the
svn version number, the build worked.  In R itself, the svn version
contains the trailing 'M' to show it came from modified source.
In the long run it might be nice to alter MkRules so it can read
a LocalMkRules file which is not under svn control, so trivial path
changes in MkRules don't make it look like the build is from modified
source code.  I don't think the M-less svn version in R_FILEVERSION
will cause any confusion.

Index: tools/GETVERSION
===================================================================
--- tools/GETVERSION	(revision 45381)
+++ tools/GETVERSION	(working copy)
@@ -43,7 +43,9 @@
   echo "#define R_SVN_REVISION \"${svn_rev}\""
 ## Using 1-digit year stops problems with leading zeros
 #  echo "#define R_FILEVERSION    ${maj},${pl}${sl},${y1}${m}${d},0"
-  echo "#define R_FILEVERSION    ${maj},${pl}${sl},${svn_rev},0"
+#  echo "#define R_FILEVERSION    ${maj},${pl}${sl},${svn_rev},0"
+#  Non-digits in R_FILEVERSION stop windres file.rc, remove trailing M or S.
+  echo "#define R_FILEVERSION    ${maj},${pl}${sl},`echo ${svn_rev}|sed -e 's/[MS]*$//'`,0"
   echo
   echo '#ifdef __cplusplus'
   echo '}'

----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."



More information about the R-devel mailing list