[ROOT] My notes on how to use ROOT with Visual C++.NET

From: Langston, Matthew David (langston@SLAC.stanford.edu)
Date: Fri Jan 31 2003 - 23:55:39 MET


In the hope that it may be helpful to other Windows developers, I've
included below some simple notes about integrating ROOT with Visual
Studio.NET. Don't take this as gospel; its simply based on my
experiences with using ROOT together with Visual Studio.NET to do
physics analysis. I don't develop ROOT (i.e. I'm not constantly
recompiling the ROOT source code); I simply use the ROOT source code and
libraries "as-is" in my own projects.


		       Manifest of attached files
		       --------------------------

root-3-04-02-vs_net_langston2.patch
  Patch file of changes necessary to build ROOT 3.04.02 using VC++.NET.

build.sh
  Simple build script that I use to build ROOT using VC++.NET.

vsvars7.sh
  Set PATH, LIB and INCLUDE environment variables for VC++.NET.

vsvars6.sh
  Set PATH, LIB and INCLUDE environment variables for VC++ 6.0.

dfvars.sh
  Set PATH, LIB and INCLUDE environment variables for Compaq Visual
  Fortran 6.


				 Notes
				 -----

1. VC++.NET projects can use the VC++ 6.0 binaries from the official
   ROOT web site without any problems.

2. Only relatively recent versions of ROOT can be successfully compiled
   with Visual Studio.NET.

   For example, I had lots of trouble building ROOT 3.03.09 with
   VC++.NET, and eventually just fell back to using the VC++ 6.0
   binaries in my .NET projects. However, I had relatively little
   trouble building ROOT 3.04.02 with VC++.NET.

3. I build the Fortran stuff that comes with ROOT using Compaq Visual
   Fortran 6.6b. I use three libraries from "Cernlib Release 2001":
   kernmd.lib, packmd.lib and shiftmd.lib. I download them from
   http://wwwinfo.cern.ch/asd/cernlib/download/2001_wnt/lib/.

   Because Cygwin has problems with spaces in file and folder names (see
   item 6 below), I put kernmd.lib, packmd.lib and shiftmd.lib in
   $ROOTSYS\hbook. You will need to apply my patch (attached to this
   email) to get ROOT's configure script to find these libraries.

4. There are problems using the newer linker that ships with VC++.NET
   with fl32 (the Compaq Fortran compiler). The problem is that fl32
   tries to implicitly pass the option /ignore:505 to link.exe, but 505
   is no longer a valid number under VC++.NET. The fix is to juggle the
   PATH and LIB environment variables around a bit, but this is taken
   care of in my patch (attached to this email).

5. People seem to get themselves into a lot of trouble by having their
   PATH, LIB and INCLUDE environment variables set improperly. Carefully
   go through each of these environment variables and remove everything
   having to do with VC++ 6.0, VC++.NET and Compaq Visual Fortran 6.6
   (and in the future when you install Visual Studio, don't select the
   option to automatically register these environment variables).

   Instead, either use Microsoft's .bat scripts (vsvars7.bat,
   vsvars6.bat and dfvars.bat) or my .sh scripts (vsvars7.sh, vsvars6.sh
   and dfvars.sh) to manually set the PATH, LIB and INCLUDE environment
   variables. My .sh scripts are attached to this email.

   Even after all of this, Cygwin has bugs whereby executables are found
   out of PATH order, even if you think you've cleared the cache with
   "hash -r". The solution is to use the kludge in my build.sh script
   (attached to this email).

6. The ROOT build system requires a Cygwin installation, but neither
   ROOT nor Cygwin deal very well with spaces in file and folder names
   (which are ubiquitous on a Windows computer). Even though its not the
   "Microsoft way", its best to both build and install ROOT just below a
   drive specification. For example, my current version of ROOT was
   built and installed in "c:/root-3-04-02".

   However, even doing this won't help you with the run-time errors you
   will get if you do file I/O with a file specification that contains
   spaces. I therefore use the following construct whenever I do ROOT
   I/O on Windows:

     String* old_DirectoryName = Environment::CurrentDirectory;
     Environment::CurrentDirectory = "file specification with spaces";
     // ROOT I/O calls go here.
     Environment::CurrentDirectory = old_DirectoryName;


I hope these notes and scripts might help other Windows developers.

Warmest regards, Matt

--
Matthew D. Langston
SLD, Stanford Linear Accelerator Center
langston@SLAC.Stanford.EDU











This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET