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."
On Fri, 18 Apr 2008, Bill Dunlap wrote:> 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: > ... > 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.I ran into another problem with the trailing 'M' from svnversion when doing 'make rinstaller' in R_HOME/src/gnuwin32: E:\R\R-svn\r-devel\src\gnuwin32\installer>type R-2.8.0dev.log Inno Setup 5 Command-Line Compiler ... Compiler engine version: Inno Setup 5.2.3 (ISPP 5.2.3.0) ... [ISPP] Preprocessing. ... [ISPP] Preprocessed. Parsing [Setup] section, line 10 ... Parsing [Setup] section, line 20 Error on line 12 in e:\R\R-svn\r-devel\src\gnuwin32\installer\R.iss: Value of [Setup] section directive "VersionInfoVersion" is invalid. Compile aborted. The offending line 12 in R.iss is 12 VersionInfoVersion=2.8.0.45381M and it is put there by src/gnuwin32/installer/JRins.pl. The following patch removes possible the trailing M or S from the svn version number when making the Windows installer. With that change 'make installer' completes without error and I can run the installer (and uninstaller) successfully with a locally modified svn tree. It is nice to be able have the svn version available in R and the 'M' (modified) tag is useful information. It would be more useful if we also stored the output of 'svn diff' in the binary distribution, so we could tell exactly what was done. Index: JRins.pl ==================================================================--- JRins.pl (revision 45381) +++ JRins.pl (working copy) @@ -44,6 +44,7 @@ $SVN = <ver>; close ver; $SVN =~s/Revision: //; +$SVN =~s/[MS]* *$//; $RVER0 .= "." . $SVN; open insfile, "> R.iss" || die "Cannot open R.iss\n";
Reasonably Related Threads
- non-digits in svnversion output mess up windows build if USE_SVNVERSION=yes (PR#11339)
- non-digits in svnversion output mess up windows build if (PR#11340)
- non-digits in svnversion output mess up windows build if (PR#11341)
- About building R1.6.1 on Cygwin
- problems with package tutorial