[Met_help] problems compiling MET

John Halley Gotway johnhg at rap.ucar.edu
Mon May 19 13:06:03 MDT 2008


Michael,

I'm pretty stumped.  It really seems like this should be working.

I was thinking that perhaps MET is linking to another version of BUFRLIB on your system that you don't intend.  But the error message from the linker indicates that it is in fact looking at the one in 
/export/lnx274/mbrennan/BUFRLIB/lib.  Just to be certain, you don't have 2 version of the file libbufr.a in /export/lnx274/mbrennan/BUFRLIB AND in /export/lnx274/mbrennan/BUFRLIB/lib do you?

Another thing we could try... while I haven't heard of anyone having to do this, we could try adding the "-fno-second-underscore" flag to the compilation of PB2NC.  In the file 
METv1.0/src/pb2nc/Makefile, you could add -fno-second-underscore to the OPT_FLAGS line.  Not sure if/why that would help.

And lastly, doing a google search, I found the following reference: https://lstsrv.ncep.noaa.gov/pipermail/ncep.list.bufrlib-support/2007-April/000078.html
This was posted by someone with whom I work here at NCAR.  You could try modifying the BUFRLIB header file in the way he describes.  However, the -fno-second-underscore flag we're using is meant to 
address this issue.

John

Michael Brennan wrote:
> John,
> 
> I recompiled the BURFLIB the correct way, using the commands you 
> suggested. I don't get the "__" when I run the nm command, as you can 
> see here:
> 
> mbrennan at lnx274> nm libbufr.a | grep bort_exit
>                  U bort_exit_
>                  U bort_exit_
> bort_exit.o:
> 0000000000000000 T bort_exit_
> 
> However, I still get the same errors when trying to compile MET. I've 
> attached the output from the "make" command as the file make_met.log.
> 
> Mike
> 
> John Halley Gotway wrote:
>> Michael,
>>
>> I'm sorry this is still causing you problems.  I'm hoping there's just 
>> some detail we're missing because this seems like it should be a 
>> pretty straight-forward thing to fix.
>>
>> I replicated the exact error message you're getting be rebuilding 
>> BUFRLIB the *wrong* way and then rebuilding MET linking to the bad 
>> version of BUFRLIB.
>>
>> Here are the commands I used to build BUFRLIB the *wrong* way:
>> gcc -c -DUNDERSCORE *.c
>> g77 -c -DUNDERSCORE *.f
>> ar crv libbufr.a *.o
>>
>> Running the 'nm' command on the library archive file, this is what I 
>> find:
>> Pigpen > nm *.a | grep bort_exit
>>          U bort_exit__
>> bort_exit.o:
>> 00000000 T bort_exit_
>>          U bort_exit__
>>
>> Those lines: "U bort_exit__" are INCORRECT and should not be there.  
>> Instead, they should read: "U bort_exit_" with only one underscore.
>>
>> When I tried building MET linking to this incorrect version of 
>> BUFRLIB, I got the exact same error you're getting:
>>
>> /nfs/pigpen_pd6/score/MET/MET_releases/external_libs/bufrlib_JHG/libbufr.a(bort2.o): 
>> In function `bort2_':
>> bort2.f:(.text+0x216): undefined reference to `bort_exit__'
>> /nfs/pigpen_pd6/score/MET/MET_releases/external_libs/bufrlib_JHG/libbufr.a(bort.o): 
>> In function `bort_':
>> bort.f:(.text+0x1b6): undefined reference to `bort_exit__'
>> collect2: ld returned 1 exit status
>>
>> So let's try rebuilding one more time and see if we can get it 
>> working.  Please run the following commands:
>>
>> (1) cd /export/lnx274/mbrennan/BUFRLIB
>> (2) rm *.o *.a
>> (3) gcc -c -DUNDERSCORE *.c
>> (4) g77 -c -DUNDERSCORE -fno-second-underscore *.f (the *CORRECT* way 
>> to compile this)
>> (5) ar crv libbufr.a *.o
>> (6) nm libbufr.a | grep bort_exit (verify that all lines are 
>> "bort_exit_" and NOT "bort_exit__")
>> (7) cd /export/lnx274/MET/METv1.0
>> (8) make clean
>> (9) make
>>
>> And then keep your fingers crossed.  If this doesn't work, then there 
>> may be some version or system configuration differences that are 
>> causing issues.
>>
>> Please let me know how it goes.
>>
>> John
>>
>>
>> Michael Brennan wrote:
>>> John,
>>>
>>> I'm just sitting down to take a look at this again. I think in my 
>>> last message to you, I looked at the output from this command:
>>>
>>> nm /export/lnx274/mbrennan/BUFRLIB/libbufr.a | grep bort
>>>
>>> and the line said "bort_exit_" (with one underscore).
>>>
>>> I still don't seem to have any luck compiling. I pasted the error 
>>> string I get below. Do you have any other suggestions?
>>>
>>> Thanks,
>>> Mike
>>>
>>> /usr/bin/g++ -o pb2nc pb2nc.cc pb2nc_Conf.o numpbmsg.o openpb.o 
>>> readpb.o dumppb.o  \
>>>         -g -Wall -Wshadow -static 
>>> -DMET_BASE=\"/export/lnx274/MET/METv1.0\" \
>>>         -I/export/lnx274/mbrennan/gsl/include \
>>>         -I../../lib -I../../lib 
>>> -I/export/lnx274/mbrennan/applications/netcdf-3.6.2/include 
>>> -I/export/lnx274/mbrennan/BUFRLIB -I/export/lnx274/mbrennan/f2c \
>>>         -L../../lib -L../../lib 
>>> -L/export/lnx274/mbrennan/applications/netcdf-3.6.2/lib 
>>> -L/export/lnx274/mbrennan/BUFRLIB/lib 
>>> -L/export/lnx274/mbrennan/f2c/libf2c \
>>>         -lbufr -lvx_grib_classes -lvx_wrfdata -lvx_econfig \
>>>         -lvx_data_grids -lvx_math -lvx_cal -lvx_util -lvx_met_util 
>>> -lm -lf2c \
>>>         -lnetcdf_c++ -lnetcdf
>>> ../../lib/vx_wrfdata/vx_wrfdata.h:41: warning: 'wrfdata_magic' 
>>> defined but not used
>>> ../../lib/vx_wrfdata/vx_wrfdata.h:64: warning: 'thresh_type_str' 
>>> defined but not used
>>> ../../lib/vx_wrfdata/vx_wrfdata.h:85: warning: 'step_direction_str' 
>>> defined but not used
>>> ../../lib/vx_met_util/constants.h:16: warning: 'proj_type' defined 
>>> but not used
>>> ../../lib/vx_met_util/constants.h:23: warning: 'na_str' defined but 
>>> not used
>>> ../../lib/vx_met_util/constants.h:26: warning: 'all_msg_typ_str' 
>>> defined but not used
>>> ../../lib/vx_met_util/constants.h:38: warning: 'all_interp_mthd_str' 
>>> defined but not used
>>> ../../lib/vx_met_util/constants.h:49: warning: 'mthd_str' defined but 
>>> not used
>>> ../../lib/vx_met_util/met_stats.h:20: warning: 'hdr_fmt_str' defined 
>>> but not used
>>> ../../lib/vx_grib_classes/grib_strings.h:20: warning: 'missing_str' 
>>> defined but not used
>>> ../../lib/vx_grib_classes/grib_strings.h:62: warning: 
>>> 'grib_code_list' defined but not used
>>> ../../lib/vx_grib_classes/grib_strings.h:94: warning: 
>>> 'grib_code_list_str' defined but not used
>>> ../../lib/vx_grib_classes/grib_strings.h:358: warning: 
>>> 'grib_level_list' defined but not used
>>> ../../lib/vx_grib_classes/grib_strings.h:377: warning: 
>>> 'grib_level_flag' defined but not used
>>> ../../lib/vx_grib_classes/grib_strings.h:391: warning: 
>>> 'grib_level_list_str' defined but not used
>>> ../../lib/vx_met_util/read_grib.h:64: warning: 'two_to_one_grib' 
>>> defined but not used
>>> /export/lnx274/mbrennan/BUFRLIB/lib/libbufr.a(bort.o)(.text+0xe9): In 
>>> function `bort_':
>>> : undefined reference to `bort_exit__'
>>> /export/lnx274/mbrennan/BUFRLIB/lib/libbufr.a(bort2.o)(.text+0x124): 
>>> In function `bort2_':
>>> : undefined reference to `bort_exit__'
>>> 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
>>>
>>> John Halley Gotway wrote:
>>>> Mike,
>>>>
>>>> Hmmm.  That's odd.  The "-fno-second-underscore" option is meant to 
>>>> address this exact issue.
>>>>
>>>> Please try doing the following command:
>>>> nm /export/lnx274/mbrennan/BUFRLIB/libbufr.a | grep bort
>>>>
>>>> And then send me the output of the command.
>>>>
>>>> In the output of the "nm" command, look to see if there's a line 
>>>> that says "bort_exit_" or does it say "bort_exit__"?
>>>>
>>>> We need to compile BUFRLIB in such a way that it says "bort_exit_" 
>>>> rather than "bort_exit__".
>>>>
>>>> Sorry about these issues.  It's a result of mixing FORTRAN code with 
>>>> C++ code.
>>>>
>>>> John
>>>>
>>>> Michael Brennan wrote:
>>>>> John,
>>>>>
>>>>> I had not seen those suggestions in the User's Guide. I rebuilt the 
>>>>> BUFRLIB as you suggested and rebuilt MET. I get the same error 
>>>>> (have reattached the Makefile and make_met.log.  I'll spend some 
>>>>> more time on it this afternoon and let you know if I make any 
>>>>> progress.
>>>>>
>>>>> Thanks again for your help!
>>>>> Mike
>>>>>
>>>>> John Halley Gotway wrote:
>>>>>> Michael,
>>>>>>
>>>>>> When you compiled BUFRLIB, did you see the suggestions in the MET 
>>>>>> User's Guide about it?  Please take a look in section 2.6 of the 
>>>>>> MET User's Guide (METv1.0/doc/MET_Users_Guide.pdf).  Try 
>>>>>> rebuilding BUFRLIB using the following commands that are listed in 
>>>>>> there:
>>>>>>
>>>>>> cd /export/lnx274/mbrennan/BUFRLIB
>>>>>> rm *.o *.a
>>>>>> /usr/bin/gcc -c -DUNDERSCORE *.c
>>>>>> /usr/bin/g77 -c -DUNDERSCORE -fno-second-underscore *.f
>>>>>> ar crv libbufr.a *.o
>>>>>>
>>>>>> Then try rebuilding MET.  Hopefully, that'll fix that undefined 
>>>>>> reference error you're seeing right now.
>>>>>>
>>>>>> Let me know how it goes.
>>>>>>
>>>>>> Thanks,
>>>>>> John
>>>>>>
>>>>>> Michael Brennan wrote:
>>>>>>> John,
>>>>>>>
>>>>>>> Thanks very much for your suggestion. I definitely made it 
>>>>>>> farther this time, but still ended up with an error, this time 
>>>>>>> related to the BUFRLIB. I've again attached the Makefile and 
>>>>>>> make_met.log. If you can take another look, I'd greatly 
>>>>>>> appreciate it!
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Mike
>>>>>>>
>>>>>>> John Halley Gotway wrote:
>>>>>>>> Michael,
>>>>>>>>
>>>>>>>> I apologize for not getting back to you sooner.  Most of the 
>>>>>>>> people who provide support for MET were out of town last week.
>>>>>>>>
>>>>>>>> Thanks for sending along your Makefile and your log file.  It 
>>>>>>>> makes diagnosing the problem a lot easier.
>>>>>>>>
>>>>>>>> This looks like a pretty simple problem.  The compiler is not 
>>>>>>>> able to find the file "gsl/gsl_cdf.h".
>>>>>>>>
>>>>>>>> In your Makefile, change the following line...
>>>>>>>> FROM: GSL_INCS = -I/export/lnx274/mbrennan/gsl/include/gsl
>>>>>>>> TO:   GSL_INCS = -I/export/lnx274/mbrennan/gsl/include
>>>>>>>>
>>>>>>>> And then do a "make clean" followed by a "make >& make_met.log".
>>>>>>>>
>>>>>>>> I see why you set GSL_INCS the way you did - the comments in the 
>>>>>>>> Makefile are a little misleading.
>>>>>>>>
>>>>>>>> That should solve that problem.  Please let me know if you run 
>>>>>>>> into other issues.
>>>>>>>>
>>>>>>>> Thanks and sorry again for the delay,
>>>>>>>> John Halley-Gotway
>>>>>>>> johnhg at ucar.edu
>>>>>>>>
>>>>>>>> Michael Brennan wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I'm attempting to compile MET in user space on a Linux 
>>>>>>>>> workstation. I have all the necessary other software installed 
>>>>>>>>> (NETCDF, BURFLIB, GSL, and F2C), and I've updated the code 
>>>>>>>>> suggested on the "known issues" page. However, I'm still having 
>>>>>>>>> problems. I've attached make make_met.log file and my top level 
>>>>>>>>> Makefile.
>>>>>>>>>
>>>>>>>>> I'm trying to use pre-compiled NETCDF libraries for compiling 
>>>>>>>>> MET. Could that be part of the problem?
>>>>>>>>>
>>>>>>>>> I appreciate any advice you might have.
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>> Mike
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Met_help mailing list
>>>>>>>>> Met_help at mailman.ucar.edu
>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/met_help
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Met_help mailing list
>>>>>>> Met_help at mailman.ucar.edu
>>>>>>> http://mailman.ucar.edu/mailman/listinfo/met_help
>>>>>
>>> _______________________________________________
>>> 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