Andrew Gill wrote:
It seems as though that is the problem.  The last few
lines of output (in debug mode) are:

gmond: /dev/ksyms is not a 32-bit kernel namelist
kvm_open: Error 0
 *** WARNING!!!!  kvm_open() failed.  prepare for a
segfault ... *** *** kvm_open() failed, are you running gmond as root?
kvm_nlist: Bad address
Lookup up kstat:  km (unix?)='unix', ks
(system_misc?)='system_misc',kn (resulting
metric?)='ncpus'
ncpus: kc is 38518
ncpus: Just did kstat_lookup().
ncpus: Looked up.
ncpus: Kstat data type:  2, Value returned: 4, 4 4 4
ncpus: Kernel close.  Val returned: 4
metric_init: Assigning cpu_num value (4) to ncpus.
Segmentation fault

Yup, that's definitely a case of compilerkernelmismatchitis. I don't put in debug print statements before every line of code, but the two most likely culprits are the malloc statement a couple lines below the cpu_num initialization and the getkval() below that (which determines the kvm offsets for reading CPU jiffy counters later on).

What's file say on the gmond executable?

Mine sez:

% file ./gmond
./gmond: ELF 64-bit MSB executable SPARCV9 Version 1, dynamically linked, not stripped

I'm trying to recompile it as 64-bit, but regardless
of the incantation (-m64, -mcpu=v9, -mcpu=ultrasparc,
-mptr64, or combinations of these) it gives me the
same problems.

Lucky you, I had to build an entirely separate compiler to get it right. Changing cflags didn't do it for me. Otherwise I would have included that info in autoconf.

I'm also trying some other compilers (e.g. the Sun
Workshop compiler) but they all have their unique
problems that prevent compilation at all.  I'm hacking
through that to see if one of them will compile
Ganglia instead of gcc.  However, if you have any tips
on how to compile it as a 64-bit binary, I would be
grateful.

Getting it to work caused me great pain. Basically I ended up downloading and compiling gcc for sparcv9, twice in succession (first version compiled a 32-bit compiler that made 64-bit code, then you compile the package again with the 64-bit-aware 32-bit compiler to make a 64-bit-compiler that makes 64-bit-code). Now all I do is tack on the 64-bit compiler to the front of my path when necessary.

Do I have the exact steps to do this? Not as such, no, but google was my friend in finding that out (once I figured out that was what I needed to do). For all I know it is much easier using another compiler, but with gcc that's what I ended up doing.


Reply via email to