Hdf5

Hi I try to implement a interface to hdf5 and run int the following problem:

root < rootReader.C


  •                                     *
    
  •    W E L C O M E  to  R O O T       *
    
  •                                     *
    
  • Version 4.00/04 7 May 2004 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      [root.cern.ch](http://root.cern.ch)            *
    
  •                                     *
    

FreeType Engine v2.1.3 used to render TrueType fonts.
Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.133, Apr 18 2004
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.

Error: Symbol __BEGIN_DECLS#include is not defined in current scope FILE:/usr/include/sys/types.h LINE:34
Error: Symbol bits is not defined in current scope FILE:/usr/include/sys/types.h LINE:34
Error: Symbol types is not defined in current scope FILE:/usr/include/sys/types.h LINE:34
Error: Failed to evaluate types.hError: operator ‘/’ divided by zero FILE:/usr/include/sys/types.h LINE:34
Error: Symbol #ifdef__USE_BSD#ifndef__u_char_definedtypedef__u_charu_char is not defined in current scope FILE:/usr/include/sys/types.h LINE:34
*** Interpreter error recovered ***

Thanks, Andreas
rootReader.C (776 Bytes)

Hi,

Since you library (hdf5) is compiled in order to get access to it from the interpreter you need to generate a dictionary for it (and not load an interpreted version of its header as you did). You can use ACLiC to easily generate this dictioanry

Also you can not execute CINT commands directly from a script (i.e. no .include).

Here is a version of your code that should work:

[code]{
gROOT->Reset();

gROOT->ProcessLine(".include /usr/local/hdf5/5-1.4.5-linux/include/");
gROOT->ProcessLine(".include /home/adelmann/ipl/src/hdf5/");

gSystem->Load("/usr/local/hdf5/5-1.4.5-linux/lib/libhdf5.so");
gSystem->Load("/usr/lib/libz.so");
gSystem->Load("/home/adelmann/ipl/src/hdf5/H5Part.so");

gROOT->ProcessLine(".L hdf5.h+");
gROOT->ProcessLine(".L H5Part.hh+");
H5PartFile *file;

int nt,nds;

TString fn(“dataHDF5.dat”);
cout << "Open " << fn << endl;

file= H5PartOpenFile(fn.Data(),H5PART_READ);

nt=H5PartGetNumSteps(file);
H5PartSetStep(file,0);
nds=H5PartGetNumDatasets(file);

cout << "N= " << nt << " dataSets= " << nds << endl;
}[/code]

[quote=“pcanal”]Hi,

Since you library (hdf5) is compiled in order to get access to it from the interpreter you need to generate a dictionary for it (and not load an interpreted version of its header as you did). You can use ACLiC to easily generate this dictioanry

Also you can not execute CINT commands directly from a script (i.e. no .include).

Here is a version of your code that should work:

[code]{
gROOT->Reset();

gROOT->ProcessLine(".include /usr/local/hdf5/5-1.4.5-linux/include/");
gROOT->ProcessLine(".include /home/adelmann/ipl/src/hdf5/");

gSystem->Load("/usr/local/hdf5/5-1.4.5-linux/lib/libhdf5.so");
gSystem->Load("/usr/lib/libz.so");
gSystem->Load("/home/adelmann/ipl/src/hdf5/H5Part.so");

gROOT->ProcessLine(".L hdf5.h+");
gROOT->ProcessLine(".L H5Part.hh+");
H5PartFile *file;

int nt,nds;

TString fn(“dataHDF5.dat”);
cout << "Open " << fn << endl;

file= H5PartOpenFile(fn.Data(),H5PART_READ);

nt=H5PartGetNumSteps(file);
H5PartSetStep(file,0);
nds=H5PartGetNumDatasets(file);

cout << "N= " << nt << " dataSets= " << nds << endl;
}[/code][/quote]

Hi thanks for this, here one comment and still an error:

comment: I have to specify the full path in the ProcessLine cmd:

gROOT->ProcessLine(".L /usr/local/hdf5/5-1.4.5-linux/include/hdf5.h+");
gROOT->ProcessLine(".L /home/adelmann/ipl/src/hdf5/H5Part.hh+");

error: after
gROOT->ProcessLine(".L /home/adelmann/ipl/src/hdf5/H5Part.hh+");

I get the following msg:

dlopen error: /home/adelmann/ipl/src/hdf5/H5Part_hh.so: undefined symbol: ZN4ROOT14DefineBehaviorEPvS0
Load Error: Failed to load Dynamic link library /home/adelmann/ipl/src/hdf5/H5Part_hh.so
*** Interpreter error recovered ***

Any suggestions?

= Andreas

Most likely the compiler on your command path is different from the one running ROOT. I.e make sure that

(assuming that you are using a gcc building) points to the same compiler version as the one used to build your ROOT executable.

Cheers,
Philippe.

[quote=“pcanal”]Most likely the compiler on your command path is different from the one running ROOT. I.e make sure that

(assuming that you are using a gcc building) points to the same compiler version as the one used to build your ROOT executable.

Cheers,
Philippe.[/quote]

Hi Phillipe well I recompiled hdf5 with gcc 3.2.1 as well as all other
code fragments.

There is still this strange msg:
dlopen error: /home/adelmann/root/NewTest/././H5Part_hh.so: undefined symbol: _Z27H5PartWriteFileAttribStringP10H5PartFilePcPvi

a strings on H5Part_hh.so | grep _Z27H5PartWrit
_Z27H5PartWriteFileAttribStringP10H5PartFilePcPvi

shows that this name exists in the so file. Attached a file with the complete
error msg as well as the root inputfile and the H5Part.hh andH5Part.cc

You seem to have forgotten the attachement.

Philippe

[quote=“pcanal”]You seem to have forgotten the attachement.

Philippe[/quote]

Sorry here it comes javascript:emoticon(’:roll:’)

  • Andreas

[quote=“Andreas Adelmann”][quote=“pcanal”]You seem to have forgotten the attachement.

Philippe[/quote]

Sorry but now: here it comes javascript:emoticon(’:roll:’) [/quote]
I messed ud the extension javascript:emoticon(’:oops:’)

Hi,

Because of

I definitively expect

[quote]a strings on H5Part_hh.so | grep _Z27H5PartWrit
_Z27H5PartWriteFileAttribStringP10H5PartFilePcPvi
[/quote]
But if you run

nm  H5Part_hh.so 

you’ll notice that this is an undefined symbol!
In your error message I see:

[quote]:1:1: warning: “GNUC” redefined
:1:1: warning: this is the location of the previous definition
[/quote]
This usually indicates a mis-matched between the version of Linux you are running (more exactly of glibc), the version of the compiler you are using (the one used is, in your case, the first gcc on the path) and/or the way ROOT was built.
You never did send me the result of:

root[] .! which gcc

and I would also need

root[] .! gcc -v

You should also run nm and the libhdf5.so.
Cheers.
Philippe