rootcint problem on Sun-Solaris

Martin Purschke (purschke@bnl.gov)
Mon, 08 Feb 1999 00:09:34 -0500


Hi all,

I keep having trouble with rootcint on a Sun Solaris 2.6 (I can
reproduce the problem on 2.5 as well). I use Sun's native CC compiler.

Here's what's happening. I need to run rootcint with the "-p" option,
because I need to add several -D preprocessor definitions. All that
works, with the identical code, fine on any Linux system and on SGI. The
Sun preprocessor, however, adds some #<comment> lines to its output
which appear to confuse rootcint. I condensed the problem down to a
silly header file, header.h, with just the single line
#include <iostream.h>
(just to have something in there)
and a LinkDef.h file

> #ifdef __CINT__
>
> #pragma link off all globals;
> #pragma link off all classes;
> #pragma link off all functions;
>
>
> #endif
>

all quite regular.
Now if I run just rootcint, I get

> $ rootcint gheader.cc -c header.h LinkDef.h
> Note: operator new() masked 1c
> Note: operator delete() masked 1c
> $
>
looks just fine.
Now if I pretend to need some definitions and run with -p, I get

> $ rootcint gheader.cc -c -p header.h LinkDef.h
> Error: No symbol #"/export/software/pub/root/root_v2.20.06/cint/include/stdio.h"#"typedeflongfpos_t in current scope FILE:TROOT.h LINE:4
> Error: true=1 Missing ';' FILE:TROOT.h LINE:7
> Error: No symbol /export/software/pub/root/root_v2.20.06/include/Rtypes.h"typedefcharChar_t in current scope FILE:TROOT.h LINE:9
> Error: No symbol #"/export/software/pub/root/root_v2.20.06/cint/include/stdarg.h"typedefdouble in current scope FILE:TROOT.h LINE:57
> Error: No symbol va_list in current scope FILE:TROOT.h LINE:57
> Error: No symbol FreeHookFun_tfgFreeHook in current scope FILE:TROOT.h LINE:75
> Error: No symbol ReAllocFun_tfgReAllocHook in current scope FILE:TROOT.h LINE:77
> Error: No symbol ReAllocCFun_tfgReAllocCHook in current scope FILE:TROOT.h LINE:78
> Error: class,struct,union or type TStorage not defined FILE:TROOT.h LINE:119
> Error: class,struct,union or type TStorage not defined FILE:TROOT.h LINE:123
> Error: class,struct,union or type TStorage not defined FILE:TROOT.h LINE:125
> Error: class,struct,union or type FreeHookFun_tTStorage not defined FILE:TROOT.
>
...and so on, and so on, and then

> Note: operator new() masked 1c
> Note: operator delete() masked 1c
> Segmentation fault (core dumped)
> $
>

This offending line
#"/export/software/pub/root/root_v2.20.06/cint/include/stdio.h" is a
typical comment the Sun preprocessor puts in the output it generates.
Here's an output sample, and you can recognize the above line which
produced the first error:

> $ CC -E -I/export/software/pub/root/root_v2.20.06/cint/include x.cc
> #4 "/export/software/pub/root/root_v2.20.06/cint/include/stdio.h"
> #pragma setstdio
>
> typedef long fpos_t ;
> typedef unsigned int size_t ;
> #8 "/export/software/pub/root/root_v2.20.06/cint/include/bool.h"
> enum bool { FALSE = 0 , false = 0 , TRUE = 1 , true = 1 } ;
> >
>

We tried to fiddle around with running the preprocessor manually on the
files and feeding the processed files to rootcint, trying to avoid the
need for preprocessing in rootcint, but that creates more problems than
it solves. There appears to be no particular compiler switch for CC
which switches those comments off alltogether. CC -P can produce a .i
file without them, but not to standard output.

Can rootcint be taught to handle those lines properly? Or any other
solution?

Thanks,
Martin

--
Martin L. Purschke               ;   purschke@bnl.gov
                                 ;   http://www.phenix.bnl.gov/~purschke

; Brookhaven National Laboratory ; phone: +1-516-344-5244 Physics Department Bldg 510 C ; fax: +1-516-344-3253 Upton, NY 11973-5000 ; -----------------------------------------------------------------------