Using TFile->MakeProject : 2 issues

Hi there,
I tried to rebuild the so for the classes that I have in a root file. I am currently using v3.10.02
on a linux box.

The 2 problems are the following:

  1. a very trivial one: MAKE is actually not launched, because it is not in the PATH. So what I did was to quit ROOT, go into the created project directory, and type ./MAKE.
    Should that not be the way to call it: ‘./MAKE’ indtead of ‘MAKE’ ?

  2. More serious: the compilation failed because the std namespace is not propagated through the class defs in the project dir. So in my initial class I have std::vector<Double_t> but the recreated version has vector only and thus compilation fails. I added by hand std:: and managed to build the shared lin, and load/use it inside ROOT.

I quickly looked at the release notes for versions 4 of ROOT, but did not recognize any entry about that. Is this related to cintstl needed build or something?

Any help much appreciated. Thanks in advance,
Johann

Johan,

Could you give me access to one of your files? I would like to understand why this problem happens.

Rene

thanks for your help. You dont understand either problem? the MAKE one seems to be to be independant of whatever file I read, right? Or do I have a bad setup of ROOT somehow?

thanks a lot,
Johann
mc.root (10.3 KB)

Hi Johan,

The MAKE script is automatically launched when you do, eg
TFile f(“mc.root”);
f.MakeProject(“mc”,"*",“recreate++”);

You do not need to have the directory “mc” in your PATH.

Concerning your second point with a class having a STL member, I have modified the code generator to add one line
#include “Riostream.h” before
#include

Riostream.h is the portable way to declare the namespace.

Rene

Dear Rene,
I put the whole code structure in slac.stanford.edu/~cohen/mcRootData/v2r14/
You cant rebuild the code or run the test executable because of missing libraries, but the file resulting from the test is cmt/mc.root.
in the cmt directory you also have MakeProjectTest directory which was created with the MakeProject ROOT method of TFile.
In mcRootData/McIntegratingHit.h you will find the Riostream.h that you advised me to add.

The 2 issues have remained: My root session, started from the within the cmt directory looks like that:

[cohen@localhost cmt]$ ls
cleanup.bat cleanup.csh cleanup.sh CVS Makefile MakeProjectTest mc.root NMake requirements rh9_gcc32.make setup.csh setup.sh
[cohen@localhost cmt]$ root -l
root [0] TFile f(“mc.root”)
Warning in TClass::TClass: no dictionary for class McEvent is available
Warning in TClass::TClass: no dictionary for class McParticle is available
Warning in TClass::TClass: no dictionary for class TVector3 is available
Warning in TClass::TClass: no dictionary for class TLorentzVector is available
Warning in TClass::TClass: no dictionary for class McIntegratingHit is available
Warning in TClass::TClass: no dictionary for class VolumeIdentifier is available
Warning in TClass::TClass: no dictionary for class McPositionHit is available
root [1] f.MakeProject(“MakeProjectTest”,"*",“recreate+”)
MakeProject has generated 7 classes in MakeProjectTest
MakeProjectTest/MAKE file has been generated
sh: line 1: MAKE: command not found
root [5] .q
[cohen@localhost cmt]$ cd MakeProjectTest/
[cohen@localhost MakeProjectTest]$ ./MAKE
In file included from MakeProjectTestProjectDict.h:33,
from MakeProjectTestProjectDict.cxx:13:
McIntegratingHit.h:27: error: ‘vector’ is used as a type, but is not defined as
a type.
MakeProjectTestProjectDict.cxx: In member function virtual void McIntegratingHit::ShowMembers(TMemberInspector&, char*)': MakeProjectTestProjectDict.cxx:932: error:m_energyPtrArr’ undeclared (first
use this function)
MakeProjectTestProjectDict.cxx:932: error: (Each undeclared identifier is
reported only once for each function it appears in.)
MakeProjectTestProjectDict.cxx: In function `void
G__setup_memvarMcIntegratingHit()’:
MakeProjectTestProjectDict.cxx:2157: error: ‘class McIntegratingHit’ has no
member named 'm_energyPtrArr’
g++: MakeProjectTestProjectDict.o: No such file or directory

So as you can see, I still have the same problems. As expected the MAKE command still does not work: it needs to be called from MakeProjectTest directory using ./MAKE and MAKE…

I hope you will have time browse into the directory I put on the web. Thanks a lot for your help,

Johann

Let’s discuss your two problems separatly

-adding Riostream.h

In your file McIntegratingHit.h replace the line
#include "TObject.h"
by
#include "Riostream.h"
then, run
./MAKE
Let me know if this command completes successfully. You should see
a .so file
The #include “Riostream.h” statement is automatically added by the CVS version.

-invoking MAKE from TFile::MakeProject

This looks like a problem with your shell. the script is invoked via
gSystem->Exec(“MAKE”);
see the code in TFile::MakeProject at
root.cern.ch/root/htmldoc/src/TF … akeProject

Could you run the following ROOT session in the directory with teh MAKE script?
root > gSystem->Exec(“MAKE”)

Rene

I start with the second problem:
gSystem->Exec(“MAKE”) gives the same error
On the other hand:
gSystem->Exec("./MAKE") does execute the MAKE file

My shell is bash:
[cohen@localhost MakeProjectTest]$ bash --version
GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu)
Copyright © 2002 Free Software Foundation, Inc.

Concerning the first problem I assume you mean the real McIntegratingHit.h, not the one recreated by root in the MakeProjectTest. Answer following shortly.

Johann

Johann,

I meant: adding #include “Riostream.h” in the McIntegratingHit.h file
in the directory having the MAKE file.

Rene

Concerning the first question: I rebuild the lib and test exe and rerun it to create a brand new mc.root, after modifying mcRootData/McIntegratingHit.h as requested by Rene. Here is the consecutive root session:

[cohen@localhost cmt]$ root -l
root [0] TFile f(“mc.root”)
Warning in TClass::TClass: no dictionary for class McEvent is available
Warning in TClass::TClass: no dictionary for class McParticle is available
Warning in TClass::TClass: no dictionary for class TVector3 is available
Warning in TClass::TClass: no dictionary for class TLorentzVector is available
Warning in TClass::TClass: no dictionary for class McIntegratingHit is available
Warning in TClass::TClass: no dictionary for class VolumeIdentifier is available
Warning in TClass::TClass: no dictionary for class McPositionHit is available
root [1] f.MakeProject(“MakeProjectTest”,"*",“recreate+”)
MakeProject has generated 7 classes in MakeProjectTest
MakeProjectTest/MAKE file has been generated
sh: line 1: MAKE: command not found
root [2] gSystem->ChangeDirectory(“MakeProjectTest”)
(Bool_t)1
root [3] gSystem->Exec(“MAKE”)
sh: line 1: MAKE: command not found
(Int_t)32512
root [4] gSystem->Exec("./MAKE")
In file included from MakeProjectTestProjectDict.h:33,
from MakeProjectTestProjectDict.cxx:13:
McIntegratingHit.h:27: error: ‘vector’ is used as a type, but is not defined as
a type.
MakeProjectTestProjectDict.cxx: In member function virtual void McIntegratingHit::ShowMembers(TMemberInspector&, char*)': MakeProjectTestProjectDict.cxx:932: error:m_energyPtrArr’ undeclared (first
use this function)
MakeProjectTestProjectDict.cxx:932: error: (Each undeclared identifier is
reported only once for each function it appears in.)
MakeProjectTestProjectDict.cxx: In function `void
G__setup_memvarMcIntegratingHit()’:
MakeProjectTestProjectDict.cxx:2157: error: ‘class McIntegratingHit’ has no
member named 'm_energyPtrArr’
g++: MakeProjectTestProjectDict.o: No such file or directory
(Int_t)256

As you can see the stl missing problem is still there.
Indeed looking at the created class in MakeProjectTest direcotry, it still has the TObject include, and NOT the Riostream include!!!
If I add it by hand I can proceed:
root [5] gSystem->Exec("./MAKE")
(Int_t)0
root [6] gSystem->LOAD(“MakeProjectTest.so”)
(Int_t)0

So as at the beginning of this thread: I know how to modify the file created on the fly by MakeProject() in order to build the so, but it does not get it right on its own.
For some reason the original header file is not parsed with integrity… using namespace std iand including Riostream.h are copied over… Very strange.

Johann

Johann,

The code generator uses the information from the dictionary in the ROOT file, not from your original include file.
Just having the file mc.root is sufficient to generate the code
with TFile::MakeProject.

The problem with including automatically Riostream.h is fixed in
teh CVS version.

I do not understand the problem with the bash shell.

Rene

sorry Rene, I missed your last comment on the thread:
So, adding Riostream.h include in the prject directory, where the MAKE stands, does solve the build problem. But we are not supposed to touch these files right?

Johann

Rene,

  1. Concerning Riostream: ok thanks a lot I am going to try out v4 updated to the HEAD
  2. Concerning bash: it has always been my understanding that an executable test.exe located in a directory DIR the path to which is not added to PATH env variable needs to be executed by typing ./test.exe and not test.exe. The latter case works when DIR is listed in PATH.
    One common example is when one downloads a traball with the source of some package. Systematically the first command is ‘./configure …’ and not ‘configure …’ because chances are one did not untar in a directory pointed at by the PATH env variable.

Johann

The MAKE problem just disappeared!!! I switched to a more recent root version and it started the build on its own. Then I switched back to v3.10 and it started the build all the same… I then opened a new terminal window and tried again… no problem!!!

I have no idea either, but there is something unstable. I checked the history and the situations/commands were identical. I actually use the ROOT history to avoid retyping. So I dont see what could have happened… We will see if the problem comes back.

Johann

I rebuilt root at current CVS head and I confirm that it solved the stl problem.

Thank you Rene,
Johann