Can no longer get rootcint to produce a G__.cxx G__.h file

I am attempting to adapt netCDF3.6.2 to work in ROOT, as AstroROOT allows for the opening and processing of FITS files.

Earlier I, with help from Christian Holm Christensen and Rholfs Reiner in private emails, I was able to use rootcint to produce, compile, link and then load successfully the netcdf.so.

I then compiled a later version of ROOT (5.17.08) and have not been able to get a header file produced since.

I am using:
gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /cardhu.b/gnatmail/release-gpl/build-cardhu/src/configure --prefix=/usr/gnat --enable-languages=c,ada --disable-nls --disable-libada --target=i686-pc-linux-gnu --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --enable-checking=release --enable-threads=posix
Thread model: posix
gcc version 4.1.3 20070403 for GNAT GPL 2007 (20070402)

On a Fedora Core 6 coLinux installation:
uname -a
Linux nulinux 2.6.22-co-0.8.0 #1 PREEMPT Sun Aug 19 15:33:13 CEST 2007 i686 i686 i386 GNU/Linux

On an old slow Gateway Celeron computer.

Today here is the outout from ROOT 5.16.00 compiled yesterday afternoon:

rootcint -f G__cdf.cxx -c -I. -I/opt/cern/root/include/ netcdfcpp.h LinkDef.h
Error: Symbol externMSC_EXTRAintncerr is not defined in current scope netcdf.h:940:
Error: Symbol externMSC_EXTRAintncopts is not defined in current scope netcdf.h:961:
Error: Missing one of ‘,;{’ expected at or after line 272.
Error: Unexpected end of file (G__fgetstream_template():2) ncvalues.h:280:
Error: Missing one of ‘{’ expected at or after line 280.
Error: Unexpected end of file (G__fignorestream():3) ncvalues.h:280:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing G__cdf.cxx G__cdf.h !!!
Error: rootcint: error loading headers…

g++ -c -O2 -Wall -fPIC -I. netcdf.cpp
netcdf.cpp: In member function `NcBool NcVar::set_cur(long int, long int, long int, long int, long int)’:
netcdf.cpp:1270: warning: comparison between signed and unsigned integer expressions
netcdf.cpp:1274: warning: comparison between signed and unsigned integer expressions

g++ -c -O2 -Wall -fPIC -I. ncvalues.cpp
ncvalues.cpp: In member function `virtual char NcValues_ncbyte::as_char(long int) const’:
ncvalues.cpp:80: warning: comparison is always false due to limited range of data type

I am attaching revelent (I hope) files.

With the previously produced netcdf.so, I had hoped to then compile the ANDI files and be able to, with cint, open and process mass spectrometry files.

That is a request for help in the future since I need this first.

Do I need to include a
#pragma link C++ global MSC_EXTRA

??

I am very confused with what exactly #prama does.

The G__NetCDF.cxx was produced on 11 NOV. I do not remember what version of ROOT I had installed at the time, the .h produced at the same time.

the LinkDef.h was an adaption of code sent to me by CHC, who went out of his way with effort to answer my private question.

The netcdf.h partial code is where I think that rootcint is unable to read the file.

Thank you.
usedLinkDef.h (287 Bytes)
netcdf.h.txt (682 Bytes)
G__NetCDF.h (1.09 KB)
G__NetCDF.cxx (6.21 KB)

I’m still working on this. Here is the revelent area in the header file that now generates an error:

// Documentation warned this might change and now it has, for
// consistency with C interface
typedef signed char ncbyte;

Using the following commands to rootcint, I get this output:

[procdata@nulinux cxx]$ rootcint -f G__cdf.cxx -c -p -I/home/procdata/cxx -I/opt/cern/root/include -I/usr/local/include netcdfcpp.h LinkDef.h

Error: Symbol signedchar is not defined in current scope ncvalues.h:46:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing G__cdf.cxx G__cdf.h !!!
Error: rootcint: error loading headers…

NOTE:

$ g++ -c -Wall -I/home/procdata/cxx -I/usr/local/include netcdf.cpp
netcdf.cpp: In member function `NcBool NcVar::set_cur(long int, long int, long int, long int, long int)’:
netcdf.cpp:1270: warning: comparison between signed and unsigned integer expressions
netcdf.cpp:1274: warning: comparison between signed and unsigned integer expressions

[procdata@nulinux cxx]$ g++ -c -Wall -I/home/procdata/cxx -I/usr/local/include ncvalues.cpp
ncvalues.cpp: In member function `virtual char NcValues_ncbyte::as_char(long int) const’:
ncvalues.cpp:80: warning: comparison is always false due to limited range of data type

A few warnings, but it compiles as a stand alone program.

How does one include a typedef in a LinkDef.h of this type? No examples are included in the #pragma help file that I have.

Also, what does -p do? I had at one point the suggestion in output to use it, but my man rootcint doesnt include it as an option. It prevents the following errors (as to compared to the output above):

$ rootcint -f G__cdf.cxx -c -I/home/procdata/cxx -I/opt/cern/root/include -I/usr/local/include netcdfcpp.h LinkDef.h

Error: Symbol externMSC_EXTRAintncerr is not defined in current scope netcdf.h:940:
Error: Symbol externMSC_EXTRAintncopts is not defined in current scope netcdf.h:961:
Error: Missing one of ‘,;{’ expected at or after line 272.
Error: Unexpected end of file (G__fgetstream_template():2) ncvalues.h:280:
Error: Missing one of ‘{’ expected at or after line 280.
Error: Unexpected end of file (G__fignorestream():3) ncvalues.h:280:
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing G__cdf.cxx G__cdf.h !!!
Error: rootcint: error loading headers…

Attempting this with NetCDF 2.3.2, I get the following error:

$ rootcint -f G__2.cxx -c -I/home/procdata/bin/ntcdf232/libsrc -I/home/procdata/bin/ntcdf232/cpp -I/opt/cern/root/include netcdf.h LinkDef.h
Error: Too many ‘}’ netcdf.h:566:
Segmentation fault

Checking the file, there are four { and four }.

Thank you.

Hi,

-p invokes the compiler’s preprocessor; it’s the right workaround for the CINT CPP problem you have discovered. When using -p the only error you are left with is the one with the signed char typedef, correct? I cannot reproduce that problem; could you attach ncvalues.h?

You can generate the dictionary for a typedef simply by putting
#pragma link C++ typedef ncbyte;
into your LinkDef.h.

Cheers, Axel.

Hi,

apparently someone moved this thread (I didn’t even see it was in the wrong section to begin with), so you’re welcome to continue this discussion.

Cheers, Axel.

Axel:
Thank you for the reply. I didnt see it until Monday evening. Not wanting to waste space here, but sick father and not home, and not easy to reply to your help.

Also, sorry that I posted my first post in the wrong category.

Here is ncvalues.h.

I have begun to think that somehow on 11 NOV I got all required header files some how seen by rootcint and havent since. Does rootcint automatically find <> includes such as stdio?

The netCDF support team have suggested building with their rather extensive configure and make and then using the libaries that are created for your specific machine. I have seen a reply on here from someone wanting to use a .so and only has the header files.

I have of course the source and headers, but I didnt see how to make the .cxx file using headers as explained in that answer.

Has it ever been considered to number each answer so that one can footnote easily? It of course doesnt seem like it I am sure, but I have put time into trying to solve this myself and cant accomplish it.

I appreciate your help. The netCDF site shows others having problems with ncopts as I have. It is a hold over from netCDF-2, which is what the ANDI source and headers build on.

Agan, thank you.
ncvalues.h (9.89 KB)

Hi,

ncvalues.h uses an undefined type “nc_type”. It’d be best if you post (or send to me personally) all headers needed for the dictionary, i.e. everything from the netCDF project included directly or indirectly from netcdfcpp.h. You can also point me to an http address to download the files. I need to be able to run “rootcint -f G__cdf.cxx -c -p -I/home/procdata/cxx -I/opt/cern/root/include -I/usr/local/include netcdfcpp.h LinkDef.h” and see the same output as you get.

Cheers, Axel.

Hi,

this is now fixed in the trunk of ROOT; thanks for reporting!

Cheers, Axel.