[Met_help] problem compiling METv2

John Halley Gotway johnhg at rap.ucar.edu
Thu Apr 9 20:58:29 MDT 2009


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