[Met_help] problem compiling METv2

John Halley Gotway johnhg at rap.ucar.edu
Tue Apr 14 11:53:48 MDT 2009


Joe,

I logged on to WJET and tried building MET using the GNU compilers in: /mnt/lfs0/projects/wrf-dte/johnhg/MET/METv2.0_gnu

I even linked to the versions of the libraries you were using.  I did locate one issue:

The version of gfortran in /usr/bin is 4.1.2 (type: gfortran --version).  And you were linking to the G2C library in /usr/lib/gcc/x86_64-redhat-linux/3.4.6.  And that's probably because G2C isn't
available in the 4.1.2 directory (/usr/lib/gcc/x86_64-redhat-linux/4.1.2).  But I'm guessing that mixing the versions is causing problems.

So I downloaded and built F2C locally and was finally able to get MET to compile using F2C instead of G2C. HOWEVER, the PB2NC tool has runtime errors!

I'd suggest sticking with the Intel version.  I've worked with Chris Harrop over there in the past on DTC testing activities and remember hearing that some compilers on WJET work better than others.
And the Intel ones are supposed to be good.

John

Joe Olson wrote:
> John,
> 
> Yes, I'm compiling it on WJET.
> 
> So far, I am very happy with the ifort build of METv2.0.
> Our realtime verification has become much more stable; in particular,
> PB2NC seems to be much more reliable.
> 
> thanks,
> joe
> 
> On Apr 14, 2009, at 7:56 AM, John Halley Gotway wrote:
> 
>> Joe,
>>
>> Are you by any chance trying to build MET using the GNU compilers on
>> one of the JET machines?
>>
>> If so, I have access to the JET machines and could try it myself.  In
>> fact, I used WJET to test building MET with the Intel compilers.
>>
>> Thanks,
>> John
>>
>> Joe Olson wrote:
>>> I emptied out the f2c lines, but I'm still getting problems with PB2NC.
>>> This time, it is choking on a call to a c-subroutine in the BUFRLIB. I
>>> recompiled the BUFRLIB with gfortran like so:
>>>
>>> gcc -c *.c
>>> gfortran -c *.f
>>> ar crv /mnt/tg0/projects/wrfruc/olson/BUFRLIB_gfortran/libbufr.a *.o
>>>
>>> and once like this
>>>
>>> gcc -c *.c
>>> gfortran -ff2c -c *.f
>>> ar crv /mnt/tg0/projects/wrfruc/olson/BUFRLIB_gfortran/libbufr.a *.o
>>>
>>> but resulted in the same error (both times):
>>>
>>> *** Making pb2nc application ***
>>>
>>> /usr/bin/g++ -c pb2nc_Conf.cc -Wall -Wshadow -static   \
>>>    -I../../lib
>>> /usr/bin/gfortran -c numpbmsg.f -Wall -Wshadow -static -ff2c
>>> /usr/bin/gfortran -c openpb.f -Wall -Wshadow -static -ff2c
>>> /usr/bin/gfortran -c readpb.f -Wall -Wshadow -static -ff2c
>>> /usr/bin/gfortran -c dumppb.f -Wall -Wshadow -static -ff2c
>>>
>>>
>>> /usr/bin/g++ -o pb2nc pb2nc.cc pb2nc_Conf.o numpbmsg.o openpb.o readpb.o
>>> dumppb.o \
>>>    -Wall -Wshadow -static
>>> -DMET_BASE=\"/mnt/tg0/projects/wrfruc/olson/METv2.0_gnu\" \
>>>    -I../../lib -I/misc/whome/olson/netcdf-3.6.2/include
>>> -I/misc/whome/olson/gsl-1.11/include
>>> -I/tg0/projects/wrfruc/olson/BUFRLIB_gfortran  \
>>>    -L../../lib -L/misc/whome/olson/netcdf-3.6.2/lib
>>> -L/misc/whome/olson/gsl-1.11/lib
>>> -L/tg0/projects/wrfruc/olson/BUFRLIB_gfortran  \
>>>    -lbufr -lvx_pb_util \
>>>    -lvx_met_util -lvx_analysis_util -lvx_wrfdata -lvx_met_util \
>>>    -lvx_contable -lvx_grib_classes \
>>>    -lvx_econfig -lvx_gsl_prob -lgsl \
>>>    -lvx_plot_util  -lvx_render -lvx_pxm -lvx_color -lvx_ps -lvx_afm \
>>>    -lvx_data_grids -lvx_gnomon -lvx_nav -lvx_cal -lvx_util -lvx_math
>>> -lm \
>>>    -lnetcdf_c++ -lnetcdf \
>>>      -lgfortran
>>> /tg0/projects/wrfruc/olson/BUFRLIB_gfortran/libbufr.a(bort.o): In
>>> function `bort_':
>>> bort.f:(.text+0x1a3): undefined reference to `bort_exit__'
>>> /tg0/projects/wrfruc/olson/BUFRLIB_gfortran/libbufr.a(bort2.o): In
>>> function `bort2_':
>>> bort2.f:(.text+0x20a): undefined reference to `bort_exit__'
>>> /tg0/projects/wrfruc/olson/BUFRLIB_gfortran/libbufr.a(stndrd.o): In
>>> function `stndrd_':
>>> stndrd.f:(.text+0x243): undefined reference to `restd_'
>>> /tg0/projects/wrfruc/olson/BUFRLIB_gfortran/libbufr.a(cmsgini.o): In
>>> function `cmsgini_':
>>> cmsgini.f:(.text+0x54f): undefined reference to `restd_'
>>> collect2: ld returned 1 exit status
>>> make[3]: *** [pb2nc] Error 1
>>> make[2]: *** [all] Error 2
>>> make[1]: *** [targets] Error 2
>>> make: *** [all] Error 2
>>>
>>>
>>> Again, I am still interested in solving this, but since I have METv2.0
>>> compiled with the intel compilers, I am not in a desperate situation. If
>>> you have any further suggestions, please let me know.
>>>
>>> thanks,
>>> joe
>>>
>>>
>>> On Apr 9, 2009, at 8:58 PM, John Halley Gotway wrote:
>>>
>>>> Joe,
>>>>
>>>> OK, when building with gfortran, please try the following in the
>>>> top-level
>>>> Makefile:
>>>>
>>>> - Uncomment the line that contains "-lgfortran".  When using gfortran,
>>>> you
>>>> need to link to that library which should fix all those undefined
>>>> references to _gfortan...
>>>>
>>>> - Empty out ALL the lines for F2C/G2C including the one with
>>>> "-lg2c".  I
>>>> don't think you need to link to g2c as long as you use the "-ff2c"
>>>> compiler option.
>>>>
>>>> Try rebuilding with that.  I'm not sure if that'll fix the issue
>>>> with the
>>>> power function or not.  But I'm hopeful.
>>>>
>>>> Please let me know if that does the trick.
>>>>
>>>> Thanks,
>>>> John
>>>>
>>>>> Thanks John,
>>>>>
>>>>> When I Empty out the lines for "F2C_INCS" and "F2C_LIBS" and - Leave
>>>>> F2C_LIBNAME set to "-lg2c", it crashes with a message saying can not
>>>>> locate the g2c libraries. Also, when I use gfortran, it crashes on
>>>>> here:
>>>>>
>>>>> *** Making pb2nc application ***
>>>>>
>>>>> /usr/bin/g++ -c pb2nc_Conf.cc -Wall -Wshadow -static   \
>>>>>    -I../../lib
>>>>> /usr/bin/gfortran -c numpbmsg.f -Wall -Wshadow -static -ff2c
>>>>> /usr/bin/gfortran -c openpb.f -Wall -Wshadow -static -ff2c
>>>>> /usr/bin/gfortran -c readpb.f -Wall -Wshadow -static -ff2c
>>>>> /usr/bin/gfortran -c dumppb.f -Wall -Wshadow -static -ff2c
>>>>>
>>>>>
>>>>> /usr/bin/g++ -o pb2nc pb2nc.cc pb2nc_Conf.o numpbmsg.o openpb.o
>>>>> readpb.o dumppb.o \
>>>>>    -Wall -Wshadow -static
>>>>> -DMET_BASE=\"/mnt/tg0/projects/wrfruc/olson/
>>>>> METv2.0_gnu\" \
>>>>>    -I../../lib -I/misc/whome/olson/netcdf-3.6.2/include -I/misc/whome/
>>>>> olson/gsl-1.11/include -I/tg0/projects/wrfruc/olson/BUFRLIB
>>>>> -I/usr/lib/
>>>>> gcc/x86_64-redhat-linux/3.4.6/include \
>>>>>    -L../../lib -L/misc/whome/olson/netcdf-3.6.2/lib
>>>>> -L/misc/whome/olson/
>>>>> gsl-1.11/lib -L/tg0/projects/wrfruc/olson/BUFRLIB -L/usr/lib/gcc/
>>>>> x86_64-redhat-linux/3.4.6 \
>>>>>    -lbufr -lvx_pb_util \
>>>>>    -lvx_met_util -lvx_analysis_util -lvx_wrfdata -lvx_met_util \
>>>>>    -lvx_contable -lvx_grib_classes \
>>>>>    -lvx_econfig -lvx_gsl_prob -lgsl \
>>>>>    -lvx_plot_util  -lvx_render -lvx_pxm -lvx_color -lvx_ps -lvx_afm \
>>>>>    -lvx_data_grids -lvx_gnomon -lvx_nav -lvx_cal -lvx_util -lvx_math
>>>>> -lm \
>>>>>    -lnetcdf_c++ -lnetcdf \
>>>>>    -lg2c  -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6
>>>>> openpb.o: In function `openpb_':
>>>>> openpb.f:(.text+0x79): undefined reference to `_gfortran_st_open'
>>>>> dumppb.o: In function `dumppb_':
>>>>> dumppb.f:(.text+0x8b): undefined reference to
>>>>> `_gfortran_internal_malloc'
>>>>> dumppb.f:(.text+0xd6): undefined reference to
>>>>> `_gfortran_concat_string'
>>>>> dumppb.f:(.text+0x107): undefined reference to
>>>>> `_gfortran_internal_malloc'
>>>>> dumppb.f:(.text+0x17d): undefined reference to
>>>>> `_gfortran_concat_string'
>>>>> dumppb.f:(.text+0x185): undefined reference to
>>>>> `_gfortran_internal_free'
>>>>> dumppb.f:(.text+0x1b9): undefined reference to
>>>>> `_gfortran_internal_malloc'
>>>>> dumppb.f:(.text+0x230): undefined reference to
>>>>> `_gfortran_concat_string'
>>>>> dumppb.f:(.text+0x238): undefined reference to
>>>>> `_gfortran_internal_free'
>>>>>
>>>>> ...etc...
>>>>> ...etc...
>>>>>
>>>>> ../../lib/libvx_wrfdata.a(vx_wrfdata.o): In function `std::pow(double,
>>>>> int)':
>>>>> vx_wrfdata.cc:(.text._ZSt3powdi[std::pow(double, int)]+0x19):
>>>>> undefined reference to `__powidf2'
>>>>> collect2: ld returned 1 exit status
>>>>> make[3]: *** [pb2nc] Error 1
>>>>> make[2]: *** [all] Error 2
>>>>> make[1]: *** [targets] Error 2
>>>>> make: *** [all] Error 2
>>>>>
>>>>>
>>>>> I finally did get it to compile with ifort & icc, but I see there have
>>>>> been quite a few changes in this new version, so a complete testing
>>>>> may take a while. I'm still interested in why the gnu compilers
>>>>> wouldn't work. If you have any more ideas, let me know. Until then,
>>>>> I'm going ahead with the ifort compilation.
>>>>>
>>>>> thanks again,
>>>>> joe
>>>>>
>>>>>
>>>>> On Apr 9, 2009, at 11:22 AM, John Halley Gotway wrote:
>>>>>
>>>>>> Joe,
>>>>>>
>>>>>> I'm out of the office through Monday of next week.  So I should be
>>>>>> able to
>>>>>> provide more support at that time.
>>>>>>
>>>>>> But I took a quick look this morning, and this seems a little odd.
>>>>>> The
>>>>>> linker is complaining that it can't find the definition for a power
>>>>>> function called by one of the MET libraries that's supposed to be
>>>>>> defined
>>>>>> in the standard math library.  And what's really odd is that the
>>>>>> other MET
>>>>>> tools actually are compiling WITHOUT this error - because they're
>>>>>> linking
>>>>>> to the same MET library that the linker is complaining about.
>>>>>>
>>>>>> My first guess is that when MET builds the other tools, the linker
>>>>>> finds
>>>>>> the version of the standard math library that it needs.  But when it
>>>>>> tries
>>>>>> to build PB2NC, the linker finds an incompatible version.  And a
>>>>>> possible
>>>>>> reason for that is how the "F2C_LIBS" is set in your top-level
>>>>>> Makefile.
>>>>>>
>>>>>> Please try the following in your top-level Makefile:
>>>>>> - Empty out the lines for "F2C_INCS" and "F2C_LIBS"
>>>>>> - Leave F2C_LIBNAME set to "-lg2c"
>>>>>>
>>>>>> I'm hoping the compiler can find the G2C library in a standard
>>>>>> location.
>>>>>> And hopefully it'll find the correct version of the math library as
>>>>>> well
>>>>>> and the linker will be happy.
>>>>>>
>>>>>> Give that a shot and let me know how it goes.  I should mention that
>>>>>> you
>>>>>> will likely continue to have issues running PB2NC on a 64-bit machine
>>>>>> because of 64-bit compatibility issues with BUFRLIB.  So please
>>>>>> let me
>>>>>> know if BUFRLIB actually works for you.
>>>>>>
>>>>>> Also, with the latest version of Debian (Lenny) we've switched
>>>>>> over to
>>>>>> using the "gfortran" compiler.  If it's available on your system, you
>>>>>> could do that as well.  Then you don't need to set anything for F2C.
>>>>>> gfortran handles it all without having to link to that library.
>>>>>>
>>>>>> Thanks,
>>>>>> John
>>>>>>
>>>>>>> I'm compiling this on a Linux 64-bit cluster. I need PB2NC to
>>>>>>> compile,
>>>>>>> but its choking at:
>>>>>>>
>>>>>>> usr/bin/g++ -o pb2nc pb2nc.cc pb2nc_Conf.o numpbmsg.o openpb.o
>>>>>>> readpb.o dumppb.o \
>>>>>>>    -Wall -Wshadow -static   -DMET_BASE=\"/mnt/tg0/projects/wrfruc/
>>>>>>> olson/
>>>>>>> METv2.0\" \
>>>>>>>    -I../../lib -I/misc/whome/olson/netcdf-3.6.2/include
>>>>>>> -I/misc/whome/
>>>>>>> olson/gsl-1.11/include -I/tg0/projects/wrfruc/olson/BUFRLIB -I/usr/
>>>>>>> lib/
>>>>>>> gcc/x86_64-redhat-linux/3.4.6/include \
>>>>>>>    -L../../lib -L/misc/whome/olson/netcdf-3.6.2/lib -L/misc/whome/
>>>>>>> olson/
>>>>>>> gsl-1.11/lib -L/tg0/projects/wrfruc/olson/BUFRLIB -L/usr/lib/gcc/
>>>>>>> x86_64-redhat-linux/3.4.6 \
>>>>>>>    -lbufr -lvx_pb_util \
>>>>>>>    -lvx_met_util -lvx_analysis_util -lvx_wrfdata -lvx_met_util \
>>>>>>>    -lvx_contable -lvx_grib_classes \
>>>>>>>    -lvx_econfig -lvx_gsl_prob -lgsl \
>>>>>>>    -lvx_plot_util  -lvx_render -lvx_pxm -lvx_color -lvx_ps
>>>>>>> -lvx_afm \
>>>>>>>    -lvx_data_grids -lvx_gnomon -lvx_nav -lvx_cal -lvx_util
>>>>>>> -lvx_math -
>>>>>>> lm \
>>>>>>>    -lnetcdf_c++ -lnetcdf \
>>>>>>>    -lg2c
>>>>>>> ../../lib/libvx_wrfdata.a(vx_wrfdata.o): In function
>>>>>>> `std::pow(double,
>>>>>>> int)':
>>>>>>> vx_wrfdata.cc:(.text._ZSt3powdi[std::pow(double, int)]+0x19):
>>>>>>> undefined reference to `__powidf2'
>>>>>>> collect2: ld returned 1 exit status
>>>>>>> make[3]: *** [pb2nc] Error 1
>>>>>>> make[2]: *** [all] Error 2
>>>>>>> make[1]: *** [targets] Error 2
>>>>>>> make: *** [all] Error 2
>>>>>>>
>>>>>>>
>>>>>>> I've attached my compile log and here is my configuration of the
>>>>>>> Makefile (I should note that these libraries worked for METv1.1):
>>>>>>>
>>>>>>> ###############################################################################
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> # Path to GNU Make command
>>>>>>> MAKE         = /usr/bin/make
>>>>>>>
>>>>>>> # Architecture flags
>>>>>>> ARCH_FLAGS   = # -DBLOCK4
>>>>>>>
>>>>>>> # Path to the C++ Compiler
>>>>>>> # C++ compiler flags
>>>>>>> # Any additional required libraries
>>>>>>> CXX          = /usr/bin/g++
>>>>>>> CXX_FLAGS    = -Wall -Wshadow -static # -g -m32
>>>>>>> CXX_LIBS     =
>>>>>>>
>>>>>>> # Path to the Fortran Compiler
>>>>>>> # Fortran compiler flags
>>>>>>> # Any additional required libraries
>>>>>>> FC           = /usr/bin/g77
>>>>>>> FC_FLAGS     = -Wall -Wshadow -static -ff2c # -g -m32
>>>>>>> FC_LIBS      = # -lgfortran
>>>>>>>
>>>>>>> # Make print options
>>>>>>> PRINT_OPTS   = --no-print-directory
>>>>>>>
>>>>>>> # Top level directory for the NetCDF library
>>>>>>> # NetCDF include directory specified as: -I/your/include/path
>>>>>>> # NetCDF library directory specified as: -L/your/library/path
>>>>>>> NETCDF_BASE  = /misc/whome/olson/netcdf-3.6.2
>>>>>>> NETCDF_INCS  = -I$(NETCDF_BASE)/include
>>>>>>> NETCDF_LIBS  = -L$(NETCDF_BASE)/lib
>>>>>>>
>>>>>>> # Top level directory for BUFRLIB
>>>>>>> # BUFRLIB include directory specified as: -I/your/include/path
>>>>>>> # BUFRLIB library directory specified as: -L/your/library/path
>>>>>>> BUFR_BASE    = /tg0/projects/wrfruc/olson/BUFRLIB
>>>>>>> BUFR_INCS    = -I$(BUFR_BASE)
>>>>>>> BUFR_LIBS    = -L$(BUFR_BASE)
>>>>>>>
>>>>>>> # Top level directory for the GNU Scientific Library (GSL) if it's
>>>>>>> not
>>>>>>> # installed in a standard location.
>>>>>>> # GSL include directory specified as: -I/your/include/path
>>>>>>> # GSL library directory specified as: -L/your/library/path
>>>>>>> GSL_BASE     = /misc/whome/olson/gsl-1.11
>>>>>>> GSL_INCS     = -I$(GSL_BASE)/include
>>>>>>> GSL_LIBS     = -L$(GSL_BASE)/lib
>>>>>>>
>>>>>>> # Top level directory for the F2C or G2C Library if it's not
>>>>>>> installed
>>>>>>> in a
>>>>>>> # standard location.
>>>>>>> # F2C include directory specified as: -I/your/include/path
>>>>>>> # F2C library directory containing libf2c.a or libg2c.a and
>>>>>>> specified
>>>>>>> as:
>>>>>>> # -L/your/library/path
>>>>>>> # Name of the library to be used: -lf2c or -lg2c
>>>>>>> F2C_BASE     =
>>>>>>> F2C_INCS     = -I/usr/lib/gcc/x86_64-redhat-linux/3.4.6/include
>>>>>>> F2C_LIBS     = -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6
>>>>>>> F2C_LIBNAME  = -lg2c
>>>>>>>
>>>>>>> # Optional flags to disable the compilation of MET tools
>>>>>>> # Specify a non-zero value to disable the compilation of the tool
>>>>>>> DISABLE_PCP_COMBINE   = 0
>>>>>>> DISABLE_GEN_POLY_MASK = 0
>>>>>>> DISABLE_MODE          = 0
>>>>>>> DISABLE_GRID_STAT     = 0
>>>>>>> DISABLE_PB2NC         = 0
>>>>>>> DISABLE_ASCII2NC      = 0
>>>>>>> DISABLE_POINT_STAT    = 0
>>>>>>> DISABLE_WAVELET_STAT  = 0
>>>>>>> DISABLE_STAT_ANALYSIS = 0
>>>>>>> DISABLE_MODE_ANALYSIS = 0
>>>>>>>
>>>>>>> ###############################################################################
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> thanks in advance,
>>>>>>> joe
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Met_help mailing list
>>>>>>> Met_help at mailman.ucar.edu
>>>>>>> http://mailman.ucar.edu/mailman/listinfo/met_help
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>


More information about the Met_help mailing list