From cstrato at aon.at  Fri Mar 21 17:11:43 2008
From: cstrato at aon.at (cstrato)
Date: Fri, 21 Mar 2008 17:11:43 +0100
Subject: [Rd] Problem with Makefile.win and environment variable
In-Reply-To: <alpine.LFD.1.00.0803211412350.14566@gannet.stats.ox.ac.uk>
References: <47E3BC66.5070906@aon.at>
	<alpine.LFD.1.00.0803211412350.14566@gannet.stats.ox.ac.uk>
Message-ID: <47E3DE3F.7040307@aon.at>

Dear Prof. Ripley

Thank you for your fast reply and sorry for being not specific enough.

My problem is that I need to use MS VC++ for the WinXP port of my 
package (xps at BioC):

Here is my concrete problem and what I did:
- installed MS Visual Studio Express 2008
- installed binary of ROOT framework compiled with VC++ (thus the need 
for VC++)
- set ROOT environment variable: ROOTSYS=C:\root  (the default install dir)
- installed Rtools
- installed binary of R-2.6.2
- created Makefile.win for VC++ which compiles my source code and 
includes ROOT libraries
- created config.win to check for presence of VC++, ROOT, ROOTSYS

Everything works fine, I can install my package on WinXP as long as 
"Makefile.win" contains the line "ROOTSYS=C:\\root"

When I follow your suggestion "ROOTSYS=${ROOTSYS}" (which I tried 
already before) I get the following error:
  running src/Makefile.win ...
Makefile.win:64: *** Recursive variable `ROOTSYS' references itself 
(eventually).  Stop.
make[2]: *** [srcDynlib] Error 2
make[1]: *** [all] Error 2

When I try "ROOTSYSX=${ROOTSYS}" I get the usual error:
  running src/Makefile.win ...
cl /Ic:\root/include /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c TMLMath.cxx
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 
for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.
TMLMath.cxx
TMLMath.cxx(51) : fatal error C1083: Cannot open include file: 
'TMath.h': No such file or
directory
make[3]: *** [TMLMath.obj] Error 2
make[2]: *** [srcDynlib] Error 2
make[1]: *** [all] Error 2

As you see, everything works but this final problem.
I have checked the examples in  a couple of R packages, e.g. ROracle 
which also reqires VC++, but I could not find any solution to this last 
problem.
Do you have some other ideas which I could test?

Thank you.
Best regards
Christian
_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a       A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._


Prof Brian Ripley wrote:
> On Fri, 21 Mar 2008, cstrato wrote:
>
>>
>> Dear all,
>>
>> When porting my package to WinXP I have the following problem:
>> I need to create an environment variable "MYVAR=c:\mypath" which I have
>> saved in the control panel "System->My Computer" (under the 
>> `Advanced' tab).
>>
>> I have two files which need to access MYVAR: config.win, Makefile.win
>>
>> While "config.win" does recognize MYVAR correctly, "Makefile.win" is not
>> able to recognize MYVAR, when I do:
>> "R CMD INSTALL mypkg".
>> I need to add the line "MYVAR=C:\\mypath" to "Makefile.win" for "R CMD
>> INSTALL" to work.
>>
>> Interestingly, when I "cd ./src" and call from the DOS command line:
>> "NMAKE /f "Makefile.win" CFG="Release"
>> then "Makefile.win" does recognize MYVAR correctly.
>>
>> Do you know what I need to do so that "Makefile.win" recognizes MYVAR?
>
> Well, how are you asking it to recognize it?  (We do expect you to 
> provide enough details to avoid such questions.)  $(MYVAR) is a make 
> variable, and ${MYVAR} is an environment variable.  Quite possibly
>
> MYVAR=${MYVAR}
>
> is all you need to add.
>
> BTW, there are dozens of examples in the packages on CRAN -- RGtk2 is 
> one.
> And we strongly discourage the use of Makefile.win: Makevars.win 
> suffices for all but expert developers.
>
>



[Rd] Problem with Makefile.win and environment variable
cstrato