Problems with Root 5.32 building on Windows Xp

From: Tom Roberts <tjrob_at_fnal.gov>
Date: Thu, 1 Mar 2012 18:03:46 -0600


I am trying to build G4beamline with Root 5.32. It builds and runs fine on both Linux and Mac; on Windows it builds but won't run. My program directly uses only TFile, TDirectory, and TNtuple.

	Previously I used Root 5.28 and could link it statically. With
	5.32 I must link using shared objects as there is a clash in
	zlib between Root and Geant4.

On Windows Xp, I use Cygwin to build all libraries and the program. All are configured to use the VC++ compiler (cl). When I omit Root, the program builds fine and passes all tests that don't use Root features. When I include Root, both Root and the program build without error, but how it behaves depends on how I run it:

    From Cygwin's bash shell, the program simply exits with $?=34. main()     was never entered, as its first statement is a printf.

    From Windows' Cmd, the program pops up a dialog box stating "The     application failed to initialize properly (0xc0000022)." and then exits.

This looks like a missing DLL, but all of them are there in the same directory as the .exe.

So I try to run Root itself: in bash I cd to the directory where I built root and run it:

    $ cd /cygdrive/c/G4beamline-2.11/build/root/bin     $ ./root
... Root 5.32 welcome printout and popup image, ending with Enclose multiple statements between { }. --- HANG FOREVER --- ^C will exit direct to bash prompt ---

If I use Cmd, cd to the same directory (C:\G4beamline-2.11\build\root\bin) and run root, it runs OK (!).

NOTE: I had an old version of Root in C:\root, and that caused no end of grief (even though it came last in the PATH). I removed it before any of the above.

Any suggestions? Any idea why Cmd and Cygwin/bash behave so differently when running Root? Remember this is a VC++ program, NOT a "Cygwin program", and it does NOT link with any Cygwin library; all Root compiles used cl.sh.

   $ type link
   $ link is /cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC/BIN/link

Here is how my Makefile builds Root on Windows, in which $(ROOT) points to the source tree, and $(G4BL_DIR) is the install directory (= $PWD); note the "set -e" in the sub-shell (which is used to get a log). The basic idea is to copy the source into build/root and build it there, generating a log:

build/root/.complete:

@echo "Building Root... Log is $(PWD)/build/root/build.log"
@if test ! -d build/root; then cp -Rp $(ROOT) build/root; fi
@# make -j 4 may fail, but a second one succeeds, so use 3 of them

         -@(echo "================= `date`"; set -e -x; cd build/root; \
             if test ! -r config.status; then \
                 ./configure --minimal --enable-builtin-lzma \
                                 --enable-builtin-zlib; fi; \
             make -j $(NCPU) || make -j $(NCPU) || make -j 1; \
             cp -p lib/libCore.* $(G4BL_DIR)/lib; \
             cp -p lib/libCint.* $(G4BL_DIR)/lib; \
             cp -p lib/libMathCore.* $(G4BL_DIR)/lib; \
             cp -p lib/libNet.* $(G4BL_DIR)/lib; \
             cp -p lib/libRIO.* $(G4BL_DIR)/lib; \
             cp -p lib/libThread.* $(G4BL_DIR)/lib; \
             cp -p lib/libTree.* $(G4BL_DIR)/lib; \
             cp -p bin/*.dll $(G4BL_DIR)/bin; \
             if test ! -d $(G4BL_DIR)/include/root; then \
                         mkdir $(G4BL_DIR)/include/root; fi; \
             cp -Rp include/* $(G4BL_DIR)/include/root; \
             touch .complete; \
         ) >>build/root/build.log 2>&1

@if test -r build/root/.complete; then echo Building Root complete.; \
else echo 'Building Root FAILED *****'; exit 1; fi

Tom Roberts Received on Fri Mar 02 2012 - 01:03:48 CET

This archive was generated by hypermail 2.2.0 : Mon Mar 05 2012 - 17:50:01 CET