[esp-r] a question about esp-r on 64-bit linux.

Jon Hand jon at esru.strath.ac.uk
Thu Mar 27 09:05:35 GMT 2008


I have access to a x86_64 HP Proliant ML370G5
running Red Hat Enterprise Linux version 4.

After a minor patch to the Install script to
get it to point to the lib64 folder of /usr/X11R6
the X11 version compile is ok. And I was using
the g77 and gcc verions 3.4 and not including
the XML facilities.

The full compile and install of exemplars
went without visable complaint.

In text mode there is no problem that I can
see yet. I browsed an exemplar in text mode
and was at least able to open the model in
prj.

In graphics mode I get a segmentation fault
just slightly after the graphic window begins
to draw.  

I did a gdb session and tracked it down to
a call to winfnt(1) in the subroutine epages
of esru_libX11.F Inside the winfnt_ function
of esru_x.c the value of *n (the parameter passed
in from Fortran, is, typically
a very large number.

So rather than a hard coded number parameter I
tried setting a local integer variable within epages
and that did not change it much that I could see
there was still a fault. The passing
of an integer (either has a hard coded number in
the call statement or via a local integer variable
used in the call statement) from fortran to the C function winfnt
does seem to be mis-interpreted within the C function.

Next I tried creating a local long int variable
within the winfnt_ function and setting it to the
passed parameter and then using the local variable
witin the winfnt_ function.  That helped some, but
not always.  I then added a test of the local variable
and if it is out of range I set it to 1. With
this change I was able to bring up clm in graphics
mode and to generate a report. Drawing a graph
still is not up to scratch but some of the other
functions appear to be working.

I just compiled the same revised code block on
OSX GCC 3.3 and clm is working a treat so
the patch seems to be ok for at least one other
platform.

THE QUESTION...

Now: I know that 64 bit has been an issue in the
past and I am wondering if:

a) there is a way to detect at compile time that
we are working on a 64 bit machine

b) if we knew we were on a 64 bit machine is there
some other typeing convention we might use on the
fortran side such as integer*2 that might allow
a clean passing of integer variables between fortran
and C?

I have a need to get ESP-r working on a 64 bit
platform.

Another question would be: does anyone have tips
on how to force a compile in 32-bit mode under
Redhat 4 running on a 64 bit platform?

Any suggestions



More information about the esp-r mailing list