CSALLO: heap below bss?! (in running Geant3)

Hi all

I installed Geant3 on my Ubuntu (12.04).
I typed

and it created gbat.exe and some output (.o) files …and then I typed

, and it created gint.exe

and then I wrote:

[code] ***************************************************

  •                                             * 
    
  •           G E A N T   3 . 2 1               * 
    
  •                                             * 
    
  •                C E R N                      * 
    
  •                                             * 
    
  •           15/3/94  Geneva  CH               * 
    
  •                                             * 
    

MZSTOR. ZEBRA table base TAB(0) in /MZCC/ at adr 766804743 2DB48307 HEX

MZSTOR. Initialize Store 0 in /GCBANK/
with Store/Table at absolute adrs 34513325 766804743
HEX 20EA1AD 2DB48307
HEX D45A1BEA 0
relative adrs -732292118 0
with 1 Str. in 2 Links in 5300 Low words in99999970 words.
This store has a fence of 16 words.

MZLOGL. Set Log Level 0 for store 0

MZSTOR. Initialize Store 1 in /PAWC/
with Store/Table at absolute adrs 134513313 234512904
HEX 80482A1 DFA6208
HEX DA4FFCDE E045DF01
relative adrs -632292130 -532291839
with 1 Str. in 1 Links in 5001 Low words in99999990 words.
This store has a fence of 5 words.

MZLINK. Initialize Link Area /HCBOOK/ for Store 1 NL/NS= 49 4

MZDIV. Initialize Division KUIP Div in Store 1
NW/NWMAX= 5000*******, MODE/KIND= 1 1
Division 3 initialized.

MZLINK. Initialize Link Area /KCLINK/ for Store 1 NL/NS= 20 7

MZLINK. Initialize Link Area /KCVADD/ for Store 1 NL/NS= 16 16


  •                                                *
    
  •        W E L C O M E    to   P A W             *
    
  •                                                *
    
  •   Version 2.14/04      12 January 2004         *
    
  •                                                *
    

Workstation type (?=HELP) =1 :
[/code]

but when I type “1”, it goes out! and writes:

[code]MZDIV. Initialize Division HIGZ in Store 1
NW/NWMAX= 10000*******, MODE/KIND= 0 3
Division 20 initialized.

MZLINK. Initialize Link Area /HILINK/ for Store 1 NL/NS= 42 2

MZLINK. Initialize Link Area /SICLIN/ for Store 1 NL/NS= 9 0
Version 1.29/04 of HIGZ started
CSALLO: heap below bss?!
See the file /usr/share/doc/libpawlib2-dev/README.Debian for more information.
If it does not help to solve this problem, please file a bug report against
the libpawlib2-dev package, including the source code of your executable.
[/code]

and I read that (README.Debian), it’s for my system:
[ul]3) On 32-bit architectures, please read this note carefully if you link against
pawlib dynamically so that the COMIS interpreter works correctly in your
application. This is especially applicable if your application dies with this
error message:

CSALLO: heap below bss?!

If you link statically, this note does not concern you. The default output of
the “cernlib” script includes the -static compiler flag, so a program linked
via a command like one of these:

gfortran myprogram.F -o myprogram `cernlib pawlib`
gcc file1.o file2.o file3.o -o myprogram `cernlib pawlib`

is statically linked to pawlib.

If you have doubts, run ldd on your executable; a statically linked program
should NOT have the output of ldd include a line similar to this:

libpawlib.so.2 => /usr/lib/libpawlib.so.2 (0x0f7eb000)

Executive summary

a) If your executable’s main source code file is written in FORTRAN, it should

#include <comis/mdpool.inc>

immediately after the " PROGRAM programname" line.

b) If your executable’s main source code file is written in C or C++, it should

#include <comis/mdpool.h>

at the top of the source code.

It is only necessary for one file of your source code to include mdpool.inc or
mdpool.h, and may in fact cause linking problems if more than one file does so.
Do not include mdpool.inc or mdpool.h in a header file unless that file is
itself only #included by one source file.

Technical details

The authors of COMIS (the PAW interpreter) used two memory allocation areas;
one is the integer array IQ (size: 50006 integers) in the COMMON block MDPOOL,
and the other is dynamically allocated by malloc() in the CSALLO function. The
difference between the malloc()ed pointer address and the address of the common
block is returned to FORTRAN code, so it can access the new memory by using the
appropriate array subscript in MDPOOL/IQ.

The idea is similar to that expressed in the following C code:

#include <stdlib.h>

typedef struct { int iq[50006]; } mdpool_def;
mdpool_def mdpool;

int main()
{
unsigned long iqpntr = (unsigned long)mdpool.iq;
unsigned long lpntr = (unsigned long)malloc(sizeof(int));
int index = (lpntr - iqpntr) / sizeof(int);

mdpool.iq[index] = 5;
return mdpool.iq[index];
}

The problem is that the FORTRAN code in pawlib expects the address difference
(the variable “index” in the above example) to be positive. This is fine when
an executable is statically linked to pawlib, since then the malloc()ed space
in the heap is always at a larger address than MDPOOL in the binary’s bss
segment. But on some (most?) architectures, shared libraries, including MDPOOL
in libpawlib.so, are mapped into memory beyond the program stack, yielding a
negative address offset.

After a lot of trying, I concluded that tracking down all the places in the
FORTRAN code that expected a positive pointer offset from MDPOOL would be very
difficult and error-prone, so the solution is to attack the problem from the
other end. That is, declare MDPOOL/IQ in the dynamically linked executable.
Then MDPOOL will always be present in these executables’ bss segments, whose
address is always less than that of space allocated on the heap. This is
accomplished by #include’ing <comis/mdpool.inc> or <comis/mdpool.h> in the
source code for the executable. See, e.g., the file
/usr/share/doc/libpawlib2-dev/examples/pamain.c .

– Kevin McCarty kmccarty@debian.org, Mon, 29 Nov 2004[/ul]

But I wrote:

it brought some addresses:

/home/username/cern/pro/2006b/include/comis/mdpool.inc /usr/include/comis/mdpool.inc

and:

it exists!!! :open_mouth:

What do you suggest to do?
thank you

regards
tooba

It looks like you are on the wrong forum.
May be some geant 4 people remember about geant 3. Try: geant4.cern.ch

Can you elaborate a bit more ? You installed from the sources ?
Where did you get them ?
Did you managed to install PAW ?

Note: remember that CERNLIB support was finished before Ubuntu appeared. See the last liste of the supported platforms: cernlib.web.cern.ch/cernlib/version.html

[quote=“couet”]It looks like you are on the wrong forum.
May be some geant 4 people remember about geant 3. Try: geant4.cern.ch[/quote]

thank you, but I see that this site has “installing geant3” in this page “https://root.cern.ch/drupal/content/installing-geant3”…so, I thougt that I can fix my problem in this site

[quote=“couet”][quote]
I installed Geant3 on my Ubuntu (12.04).
[/quote]

Can you elaborate a bit more ? You installed from the sources ?
Where did you get them ?
Did you managed to install PAW ?

Note: remember that CERNLIB support was finished before Ubuntu appeared. See the last liste of the supported platforms: cernlib.web.cern.ch/cernlib/version.html[/quote]

yes, sure…I downloaded “cernbin.tar.gz”, “cernlib.tar.gz” and “include.tar.gz” from this page:
http://cernlib.web.cern.ch/cernlib/download/2006b_i686-slc5-gcc43-opt/tar/
I couldn’t find the “i386” and “gcc 4.6.3”…so, I choosed “i686-slc5-gcc43” :frowning:
Is it wrong?

I’m so beginner, can you help me?

Does the pawX11 module( in the bin directory you downloaded) work for you ?

Remember, CERNLIB support is finished. Do not start new project using it.

[quote=“couet”]Does the pawX11 module( in the bin directory you downloaded) work for you ?

Remember, CERNLIB support is finished. Do not start new project using it.[/quote]

I just downloded “bin”, and I didn’t use that anywhere…these are addresses in my “makefile” :

[code]CERNLIB = -L/home/username/cern/pro/2006b/i686-slc-gcc43-opt/lib
CERNOPT = -L/home/username/cern/pro/2006b/i686-slc-gcc43-opt/lib

CERNINCL = -I/home/username/cern/pro/2006b/include/ -I./

LIBS = -L/usr/X11R6/lib
[/code]

so, how I use Geant3?

Go in the bin directory you downloaded and type:

./pawX11

If that crashes it means the binaries (and libraries) you downloaded are not compatible with the machine you are using.

CERNLIB 2005 and 2006 (64 bit) compatible with the gcc4/gfortran compiler suite

thank you, but my system is 32bit…Is it work for that too?

Have you tried what I suggested ? if pawX11 does not work it means that the binaries you downloaded are not good for your machine and in that case you have to recompile from sources. But I am afraid you will be on your own.

[quote=“couet”]Go in the bin directory you downloaded and type:

./pawX11

If that crashes it means the binaries (and libraries) you downloaded are not compatible with the machine you are using.[/quote]

I typed that code and it’s the result:

[code] ******************************************************

  •                                                *
    
  •        W E L C O M E    to   P A W             *
    
  •                                                *
    
  •   Version 2.14/04      12 January 2004         *
    
  •                                                *
    

Workstation type (?=HELP) =1 : 1
Version 1.29/04 of HIGZ started
*** No default PAWLOGON file “/home/username/.pawlogon.kumac” found

PAW > [/code]

and I typed “1”, a window is opened, but it’s blank and deactive! :frowning:
Is it so bad?

That’s good.
What you see is the graphics window and you can draw in it (for instance a null frame if you type the command: null 0 10 0 10)

[quote=“couet”]That’s good.
What you see is the graphics window and you can draw in it (for instance a null frame if you type the command: null 0 10 0 10)[/quote]

I see two axis which are from 0 until 10 :slight_smile:
So, what’s my problem?

I can just tell you that paw is working. That’s a good start.

according to:

You should link statically (with the .a)

[quote=“couet”]I can just tell you that paw is working. That’s a good start.

according to:

You should link statically (with the .a)[/quote]

thank you, that’s good news!

I was linked some libs:
libgeant321.a , libphtools.a and liblapack3.a to /usr/lib/
Now, I should link what? libpawlib?
but I located about that and I have these:

/usr/lib/libpawlib.a /usr/lib/libpawlib.so

I should have one of them? and shouldn’t have “libpawlib.so” ? yes?

I think it is possible that you have two versions of CERNLIB installed.
One coming from Ubuntu’s repository and another one which you “downloaded” and “unpacked” (in “/home/username/cern/pro/2006b”).
In order to remove the CERNLIB version coming from Ubuntu’s repository, in your graphical “Package Manager”, in the “Search” field type “cern” (or “cernlib”), select all found packages, mark them for “completely remove” (“purge”), click the “Apply Changes” button.

BTW. Yes, the “CERNLIB 2005 and 2006 (64 bit) compatible with the gcc4/gfortran compiler suite” version should also work on “32 bit” systems.

[quote=“Wile E. Coyote”]I think it is possible that you have two versions of CERNLIB installed.
One coming from Ubuntu’s repository and another one which you “downloaded” and “unpacked” (in “/home/username/cern/pro/2006b”).
In order to remove the CERNLIB version coming from Ubuntu’s repository, in your graphical “Package Manager”, in the “Search” field type “cern” (or “cernlib”), select all found packages, mark them for “completely remove” (“purge”), click the “Apply Changes” button.[/quote]

hmmm, “cernlib” doesn’t install…but “cernlib-base” and “cernlib-base-dev” are installed, I should remove them?

There are plenty of Ubuntu packages (about 35) which contain various “parts” of CERNLIB (not just the two which names begin with “cernlib-*”) and the “Search” for “cernlib” should return the full list of all of them (you may have some of them installed and some another not).
Following the “Jul 04, 2013 (Ubuntu warning added Oct 31, 2013): CERNLIB 2006 on newer Linux systems” note, you will really want to get rid of them on “Ubuntu 12.04 (LTS)”.
You may also try to take the CERNLIB source code from the current “Ubuntu 14.04 (LTS)” and recompile it on your “Ubuntu 12.04 (LTS)”.

[quote=“Wile E. Coyote”]There are plenty of Ubuntu packages (about 35) which contain various “parts” of CERNLIB (not just the two which names begin with “cernlib-*”) and the “Search” for “cernlib” should return the full list of all of them (you may have some of them installed and some another not).
Following the “Jul 04, 2013 (Ubuntu warning added Oct 31, 2013): CERNLIB 2006 on newer Linux systems” note, you will really want to get rid of them on “Ubuntu 12.04 (LTS)”.
You may also try to take the CERNLIB source code (“20061220+dfsg3-3”) from the current “Ubuntu 14.04 (LTS)” and recompile it on your “Ubuntu 12.04 (LTS)”.[/quote]

I removed them!
but I get out the way!!!
and it even doesn’t “make”! :frowning:

/usr/bin/ld: cannot find -lkernlib /usr/bin/ld: cannot find -lpawlib /usr/bin/ld: cannot find -lgraflib /usr/bin/ld: cannot find -lgrafX11 /usr/bin/ld: cannot find -lpacklib /usr/bin/ld: cannot find -lmathlib /usr/bin/ld: cannot find -lkernlib /usr/bin/ld: cannot find -lpawlib /usr/bin/ld: cannot find -lgraflib /usr/bin/ld: cannot find -lgrafX11 /usr/bin/ld: cannot find -lpacklib /usr/bin/ld: cannot find -lmathlib collect2: ld returned 1 exit status make: *** [default] Error 1

and I installed these packages again…but that error remains :frowning: