Compilation problem

Hello Mat and others,

I have success with the compilation of the FORTRAN and C codes and now I have all *.o files. The final problem is the creation of the exe file under Windwoz. I get this error:

PGI$ make gribprint
pgf90 -o gribprint gribprint.o libpgu.a …/util/libpgu.a
gribprint.o(.text+0x2f3):gribprint.f: undefined reference to COPEN@2 8' gribprint.o(.text+0x94b):gribprint.f: undefined reference to CCLOSE@12’
libpgu.a(gribcode.o)(.text+0x2de):gribcode.f: undefined reference to `BNREAD@24’

libpgu.a(gribcode.o)(.text+0x396):gribcode.f: undefined reference to `BNSEEK@16’

libpgu.a(gribcode.o)(.text+0x3b9):gribcode.f: undefined reference to `BNSEEK@16’

libpgu.a(gribcode.o)(.text+0x1530):gribcode.f: undefined reference to `BNREAD@24

make: *** [gribprint] Error 2

COPEN, CCLOSE, BNREAD and BNSEEK are functions defined in the C file which are invoked from the FORTRAN code.

Thanks!

Angel

Hi Angel,

The Window’s symbol convention adds the size in bytes of the arguments as part of a subprogram symbol name. This can sometimes cause problems during linking. To fix, compile and link with the “-Munix” flag to tell compiler to use UNIX symbol and parameter passing conventions instead.

  • Mat

Thanks!

Angel

Hello,

May be I have to add some flag in the Makefile of PREGRID because I get error:


The instruction at referenced memory at . The momery could not be “read”.

I’m wondering if this problem is related with the PREGRID’s FORTRAN/C codes or it’s connected with the PGI for windows compiler. I found on the M$ site that this error can be observed if the W2K is not updated to SP4 but I’m with SP4. I will try under real old DOS (from system disk of win98).

Any ideas are welcome!

Angel

Hi Angel,

This is a just a good old-fashioned segmentation violation. The program is trying to read memory it doesn’t own. It’s possible that it’s a compiler problem or a problem with porting it to Windows. We have had reports of problem with the Linux version, but I have yet been able to recreate the problem internally since I think its dependent upon the input data. I’m a bit swamped right now but will try and take a look in the next few days. In the mean time, if you could isolate where the violation occur, it would be very helpful.

Thanks,
Mat

Hi Mat,

Thank you for your time and help.

In the mean time, if you could isolate where the violation occur, it would be > very helpful.

Do you mean to use some debugger? I have debugger of Borland C++ Builder 6.0 but I don’t know much about how to use it (I’m not good at the asembler;) (mov, eax…etc.) What I understand is the address location of the access violation.

Angel

Try using gdb since we bundle it with the Win32 compilers. First compile Pregidder with “-g” and then run it through gdb (‘gdb pregridder.exe’). Once gdb starts up run pregridder by typing ‘run ’ where args is the command line arguments you normally run pregridder with. Once the access violation occurs type ‘where’ to get a stacktrace. This should give to the exact line number where the violation occurs.

  • Mat

Hi Mat,

I tried to compile the pregrid with option -g but with no success. I get error while compiling the code:

The instruction at “0x004c57ef” referenced memory at “0x000004a4”. The memory could not be “read”.

Is this a compiler problem or the source code is not good?

Angel

Hi Mat,

Did you have time to try to compile pregrid(MM5) and to run it? Option -g gives me error while compiling.

I know that you are busy so no problems if you aren’t able now;)

Thanks!

Angel

Hi Angel,

My fault. I forgot that “-g” isn’t supported on win32. Anyway…

I was able to build pregridder/regridder. Can you walk me through what steps you did to run program? I don’t have data, so if you point me somewhere I can download an exmample set I’d appreciate it.

Thanks,
Mat

Hello Mat,

The UNIX/Linux version works with format of the data like:

FILE:2005-09-25_00

while under Windows “:” is not possible symbol for file name so we have to replace in the source code the symbol “:” with “+” for example. The file is:

proc_ingest_first_guess.F.

(actually this file is in the \regridder\src but as I remember I changed only in this file the “:” with “+” at lines 132, 134, 136, the lines may be be different for the different versions of the code but they should be three).

First you can try gribprint command (\regrid\pregrid\src\util\gribprint.exe):

C:\gribprint some_GRIB_file.grib

where some_GRIB_file.grib is a file which store weather data (for example the atmosphere pressure, temperature, dewpoint, wind direction&speed for 00 UTC 09/25/2005. At this point I get error. If I run gribprint without data file (only “c:\gribprint.exe”) then it works and gives me the options (-v,-V=verbose,etc.). With gribprint we look inside the GRIB files to check what is the time stamp, for what time is the GRIB file (gribprint show a list of the dates of each variable in a column and other data if used -v or -V options).

Here are two grib files:

http://www.stormlab.net/mat/GRIBFILE.AA.txt
http://www.stormlab.net/mat/GRIBFILE.AB.txt
http://www.stormlab.net/mat/pregrid.namelist.txt

Rename gfs1.grib to GRIBFILE.AA, gfs2.grib to GRIBFILE.AB, pregrid.namelist.txt to pregrid.namelist (it’s not possible to download from my web site files without extension, only jpg,html,txt,etc.) and put this files in \regrid\pregrid\grib.misc\ directory.

Run \regrid\pregrid\grib.misc\pregrid_grib.exe

When it tires to read the data it fails. I think that the problem is in the file \regrid\pregrid\util\cio.c (which is realted with the data reading/writing, and as you see is the only one C file in MM5 package) or just in the compiler’s flags.

Thanks for your time!

Angel

Under UNIX/Linux you have only to update the pregrid.csh file:

  • data directory and the prefix of the GRIB filenames
  • start/end date of the input GRIB data
  • time interval between the dates of the GRIB files in seconds (21600 in our case)

and to run it.

Angel

Hi Mat,

As I see you are quite busy.

When Portland create new version of the compiler I will turn back to compile pregrid again.

Angel

Hi Angel,

I have been able to look a this for a few hours, but have only encountered porting problems, not the Access Violation error you reported. Have you contacted NCAR to see if they have a Win32 port of pregridder?

  • Mat

Hi Mat,

NCAR doesn’t have win32 port of the pregridder.

I have been able to look a this for a few hours,

Thank you very much for your effort!

I have gribprint.exe for windows compiled with PGI 6.0 for windows and it works until it read the GRIB input data. The pregrid works also but it cannot read the data.

What were the porting problems? So the problem is not in the pgf90 but in the source codes?

Angel

Hi Angel,

I have been able to look a this for a few hours, but have only encountered porting problems, not the Access Violation error you reported. Have you contacted NCAR to see if they have a Win32 port of pregridder?

  • Mat