[Wrf-users] Compile WPS with gfortran and gcc
Huber, David
dbh409 at ku.edu
Tue Feb 1 15:01:58 MST 2011
Dmitry,
Oh now that was just silly. OK, that takes care of the bulk of the errors. There are still a few undefined references, but, I think I can take it from here.
Thanks a bunch!
Dave
________________________________________
From: Dmitry N. Mikushin [maemarcus at gmail.com]
Sent: Tuesday, February 01, 2011 3:46 PM
To: Huber, David
Cc: wrf-users at ucar.edu
Subject: Re: [Wrf-users] Compile WPS with gfortran and gcc
David,
I think you're very close to get a working solution! The "-D" prefix
just defines symbol in fortran or C source code, e.g. if there is
#ifdef IO_BINARY
...
#endif
in code, then it will be effective with -DIO_BINARY. Is it what you want?
Also, with -L option you're right, but is there a "_" missing, i.e.
-L/home/dbh409/WRFV3/external/io_grib1
marcusmae at msiwind:~$ cd Programming/wrfv3/
marcusmae at msiwind:~/Programming/wrfv3$ find . -type f -name "libio_grib1.a"
./external/io_grib1/libio_grib1.a
?
- D.
2011/2/2 Huber, David <dbh409 at ku.edu>:
> Dmitry,
>
> Thanks for the recipe! This resulted in different erros, so I tried adding the flags -DIO_BINARY and -DIO_GRIB1 to CPPFLAGS, but that didn't change anything. Also, in LDFLAGS, I tried explicitly adding the library directory with -L/home/dbh409/WRFV3/external/iogrib1 to no avail. I'm getting the same "undefined reference" errors but also
>
> /usr/bin/ld: cannot find -lio_grib1
> collect2: ld returned 1 exit status
>
>
> ________________________________________
> From: Dmitry N. Mikushin [maemarcus at gmail.com]
> Sent: Tuesday, February 01, 2011 2:38 PM
> To: Huber, David
> Cc: wrf-users at ucar.edu
> Subject: Re: [Wrf-users] Compile WPS with gfortran and gcc
>
> David,
>
> Here's a common recipe to lookup for missing symbols. Navigate to the
> project dir and grep for particular symbol you have issue with, for
> instance:
>
> marcusmae at msiwind:~$ cd Programming/wrfv3/
> marcusmae at msiwind:~/Programming/wrfv3$ grep ext_gr1_put_dom_ti_char * -R
> arch/md_calls.inc: CALL ext_gr1_put_dom_ti_char ( Hndl,
> Element, Data, &
> external/io_grib1/io_grib1.f90:SUBROUTINE ext_gr1_put_dom_ti_char (
> DataHandle,Element, Data, &
> external/io_grib1/io_grib1.f90: call wrf_debug ( DEBUG , 'Entering
> ext_gr1_put_dom_ti_char')
> external/io_grib1/io_grib1.f90:END SUBROUTINE ext_gr1_put_dom_ti_char
> Binary file external/io_grib1/libio_grib1.a matches
> external/io_grib1/io_grib1.F:SUBROUTINE ext_gr1_put_dom_ti_char (
> DataHandle,Element, Data, &
> external/io_grib1/io_grib1.F: call wrf_debug ( DEBUG , 'Entering
> ext_gr1_put_dom_ti_char')
> external/io_grib1/io_grib1.F:END SUBROUTINE ext_gr1_put_dom_ti_char
> Binary file external/io_grib1/io_grib1.o matches
> frame/module_io.f90: CALL ext_gr1_put_dom_ti_char ( Hndl,
> Element, Data, &
> frame/md_calls.inc: CALL ext_gr1_put_dom_ti_char ( Hndl,
> Element, Data, &
> Binary file frame/module_io.o matches
> frame/module_io_quilt.F: CALL
> ext_gr1_put_dom_ti_char ( handle(DataHandle), TRIM(Element),
> TRIM(CData), Status)
> Binary file main/wrf.exe matches
> Binary file main/libwrflib.a matches
> Binary file main/ideal.exe matches
>
> So, we've found some sources define target symbol, and some libraries
> incorporate either its references or definitions. Now we can look
> which libraries just use the symbol, and where is it really defined.
> The nm tool can help:
>
> marcusmae at msiwind:~/Programming/wrfv3$ nm main/libwrflib.a | grep
> ext_gr1_put_dom_ti_char
> U ext_gr1_put_dom_ti_char_
>
> "U" means libwrflib.a references, but does not define. It could be in
> some other library:
>
> marcusmae at msiwind:~/Programming/wrfv3$ nm
> external/io_grib1/libio_grib1.a | grep ext_gr1_put_dom_ti_char
> 0000df30 T ext_gr1_put_dom_ti_char_
> 00d63600 b ext_gr1_put_dom_ti_char_$TMPSTR.0.56
>
> - aha, "T" - means function body defined here, in libio_grib1.
>
> So my guess would be to check if your app is linked with -lio_grib1,
> and if not, adding -lio_grib1 to LDFLAGS should help.
>
> Hope it helps,
> - D.
>
> 2011/2/1 Huber, David <dbh409 at ku.edu>:
>> Dmitry,
>>
>> Primarily "undefined reference" errors. For instance,
>>
>>
>> module_debug.o: In function `__module_debug__mprintf':
>> module_debug.f90:(.text+0xfe): undefined reference to `cio_set_log_filename'
>> module_debug.f90:(.text+0x1cb): undefined reference to `cio_set_log_filename'
>> module_debug.f90:(.text+0x2a4): undefined reference to `cio_set_log_filename'
>> module_debug.f90:(.text+0x7b5): undefined reference to `cio_prints'
>> module_debug.f90:(.text+0xbe9): undefined reference to `cio_prints'
>> module_debug.f90:(.text+0xc93): undefined reference to `cio_prints'
>> module_debug.f90:(.text+0x10c8): undefined reference to `cio_prints'
>> module_debug.f90:(.text+0x1185): undefined reference to `cio_prints'
>> module_debug.o:module_debug.f90:(.text+0x11a0): more undefined references to `cio_prints' follow
>>
>>
>> output_module.o: In function `__output_module__output_close':
>> output_module.f90:(.text+0x3f): undefined reference to `ext_int_ioclose'
>> output_module.f90:(.text+0x58): undefined reference to `ext_ncd_ioclose'
>> output_module.f90:(.text+0x71): undefined reference to `ext_gr1_ioclose'
>> output_module.f90:(.text+0x1e2): undefined reference to `ext_int_ioexit'
>> output_module.f90:(.text+0x1f6): undefined reference to `ext_ncd_ioexit'
>> output_module.f90:(.text+0x20a): undefined reference to `ext_gr1_ioexit'
>> output_module.o: In function `__output_module__ext_put_dom_ti_char':
>> output_module.f90:(.text+0x3fd): undefined reference to `ext_int_put_dom_ti_char'
>> output_module.f90:(.text+0x47e): undefined reference to `ext_ncd_put_dom_ti_char'
>> output_module.f90:(.text+0x4ff): undefined reference to `ext_gr1_put_dom_ti_char'
>>
>> Dave
>
More information about the Wrf-users
mailing list