[Rd] Problem with Makefile.win and environment variable

cstrato cstrato at aon.at
Fri Mar 21 18:41:11 CET 2008


Dear Prof. Ripley

Here is the Makefile.win, which contains already your suggestion for 
spaces (thank you), but contains only 3 of 14 header files:

#------------------------------------------------------------------------------

ROOTSYS       = C:\\root
#ROOTSYS       = ${ROOTSYS}

LDOPT         = -opt:noref
LDFLAGS       = $(LDOPT) $(conlflags) -nologo 
-include:_G__cpp_setupG__Hist \
                -include:_G__cpp_setupG__Graf1 
-include:_G__cpp_setupG__G3D \
                -include:_G__cpp_setupG__GPad 
-include:_G__cpp_setupG__Tree \
                -include:_G__cpp_setupG__Rint 
-include:_G__cpp_setupG__PostScript \
                -include:_G__cpp_setupG__Matrix 
-include:_G__cpp_setupG__Physics
SOFLAGS       = $(dlllflags:-pdb:none=)
ROOTLIBS      = "$(ROOTSYS)/lib/libCore.lib" \
                "$(ROOTSYS)/lib/libCint.lib" "$(ROOTSYS)/lib/libHist.lib" \
                "$(ROOTSYS)/lib/libGraf.lib" 
"$(ROOTSYS)/lib/libGraf3d.lib" \
                "$(ROOTSYS)/lib/libGpad.lib" "$(ROOTSYS)/lib/libTree.lib" \
                "$(ROOTSYS)/lib/libRint.lib" 
"$(ROOTSYS)/lib/libPostscript.lib" \
                "$(ROOTSYS)/lib/libMatrix.lib" 
"$(ROOTSYS)/lib/libPhysics.lib" \
                "$(ROOTSYS)/lib/libNet.lib" "$(ROOTSYS)/lib/libRIO.lib"
LIBS          = $(ROOTLIBS)
GLIBS         = $(LIBS) "$(ROOTSYS)/lib/libGui.lib" 
"$(ROOTSYS)/lib/libGraf.lib" \
                "$(ROOTSYS)/lib/libGpad.lib"
LIBSALL       = $(ROOTLIBS)

#------------------------------------------------------------------------------

MYHDR       = TMLMath.h TStat.h StatUtils.h
MYSRC       = TMLMath.cxx TStat.cxx StatUtils.cxx
MYOBJ       = TMLMath.obj TStat.obj StatUtils.obj xpsDict.obj

xps.dll:  $(MYOBJ)
    link /dll /def:xps.def /out:xps.dll fp10.obj $(SOFLAGS) $(LDFLAGS) 
$(GLIBS) *.obj
   
TMLMath.obj: TMLMath.h TMLMath.cxx
    cl /I"$(ROOTSYS)/include" /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c 
TMLMath.cxx

TStat.obj: TStat.h TStat.cxx
    cl /I"$(ROOTSYS)/include" /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c 
TStat.cxx
   
StatUtils.obj: StatUtils.h StatUtils.cxx
    cl /I"$(ROOTSYS)/include" /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c 
StatUtils.cxx
   
xpsDict.cxx: $(MYHDR) xpsLinkDef.h
    @echo "Generating dictionary $@..."
    @rootcint -f $@ -c $(MYHDR) xpsLinkDef.h
   
xpsDict.obj: xpsDict.cxx xpsDict.h
    cl /I"$(ROOTSYS)/include" /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c 
xpsDict.cxx

clean:
    rm -f $(MYOBJ) *.a *.d *.rc

clobber:
    rm -f $(RLIB) $(MYOBJ) *.a *.d *.rc *.dll
#------------------------------------------------------------------------------

Uncommenting "ROOTSYS = ${ROOTSYS}" results still in the self-reference 
error, but it works definitely with "ROOTSYS = C:\\root".

I forgot to mention that I use the DOS command shell on WinXP to run "R 
CMD INSTALL".
Could this be the problem?

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:
>> cl /Ic:\root/include /MT /EHsc /Ox /D "MSVC" /D "WIN32" /c TMLMath.cxx
>
> will AFAIK not work when passed to the shell used (which is ash), and 
> in any case will not work for paths with spaces in.
>
> You still haven't shown us the Makefile.win, but probably you need
>
> cl /I"${ROOTSYS}/include" /MT /EHsc /Ox /D MSVC /D WIN32 /c TMLMath.cxx
>
>
> On Fri, 21 Mar 2008, cstrato wrote:
>
>> 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.
>>>
>>>
>>
>



More information about the R-devel mailing list