Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

metgrid.exe not created when compiling WPS

sjahn

New member
During the WPS compile process, geogrid.exe and ungrib.exe are created normally.

But, metgrid.exe is not created.

It is believed to be caused by the following error:

nf_nc4.f90:(.text+0x678f): undefined reference to `nc_get_var_chunk_cache_ints'
collect2: error: ld returned 1 exit status
Makefile:13: recipe for target 'metgrid.exe' failed
make[1]: [metgrid.exe] Error 1 (ignored)

Can anyone give me some advice on how to solve this?
 

Attachments

  • configure.wps.txt
    3.4 KB · Views: 17
  • log (WPS).compile.txt
    91.8 KB · Views: 18
  • configure.wrf.txt
    20.7 KB · Views: 7
  • log (WRF).compile.txt
    745.6 KB · Views: 7
During the WPS compile process, geogrid.exe and ungrib.exe are created normally.

But, metgrid.exe is not created.

It is believed to be caused by the following error:

nf_nc4.f90:(.text+0x678f): undefined reference to `nc_get_var_chunk_cache_ints'
collect2: error: ld returned 1 exit status
Makefile:13: recipe for target 'metgrid.exe' failed
make[1]: [metgrid.exe] Error 1 (ignored)

Can anyone give me some advice on how to solve this?
So the first spot of the errors is this:

/home/cotri/Build_WRF/LIBRARIES/netcdf/lib/libnetcdff.a(nf_nc4.o): In function `nf_def_var_chunking_':

Couple of questions:
1. What operating system are you using?
2. What system archetecture are you using (32/64bit)?
3. Did you pass all the compatibility and library tests listed here (Compiling WRF)
4. Is the NETCDF libraries that you installed included in your $PATH and $LD_LIBRARY_PATH?
5. Can you echo your $PATH & LD_LIBRARY_PATH and put them in the thread
Code:
 echo $PATH | sort 

 echo $LD_LIBRARY_PATH | sort
6. Which version of the GNU compiler package are you using? The most current version or an older one?
 
Dear Whatheway, I have the same problem.
I did all tests listed in the compile manual and also ./make check.

For $PATH:
Code:
cho $PATH | sort
/my_desk/WRF_build/LIBRARIES/mpich/bin:/my_desk/WRF_build/LIBRARIES/netcdf/bin:/my_desk/WRF_build/LIBRARIES/netcdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

LD_LIBRARY_PATH is not defined, but this is not mentioned at compile instructions.

Any guess about the issue?
 
Dear Whatheway, I have the same problem.
I did all tests listed in the compile manual and also ./make check.

For $PATH:
Code:
cho $PATH | sort
/my_desk/WRF_build/LIBRARIES/mpich/bin:/my_desk/WRF_build/LIBRARIES/netcdf/bin:/my_desk/WRF_build/LIBRARIES/netcdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

LD_LIBRARY_PATH is not defined, but this is not mentioned at compile instructions.

Any guess about the issue?
@Doulgas_secchi You are correct LD_LIBRARY_PATH is not needed.

If I remember correctly, been awhile since i built it from scratch as I use a script to do most of the exports, the path to the netcdf folder top level directory needs to be exported in addition to the /bin.

so something like this

export NETCDF=$DIR/NETCDF Where $DIR is the path to the NETCDF folder were /bin is located.

IF i remember correctly the file that it looking for is in either lib or include folder. So by giving the NETCDF folder top level location it should find it.

In the tutorial you followed it is shown here

Code:
NetCDF: This library is always necessary! This installation consists of a netcdf-c and netcdf-fortran library.
tar xzvf netcdf-c-4.7.2.tar.gz     #or just .tar if no .gz present
cd netcdf-4.7.2
./configure --prefix=$DIR/netcdf --disable-dap
     --disable-netcdf-4 --disable-shared
make
make install
setenv PATH $DIR/netcdf/bin:$PATH
setenv NETCDF $DIR/netcdf
cd ..


setenv LIBS="-lnetcdf -lz"
tar xzvf netcdf-fortran-4.5.2.tar.gz     #or just .tar if no .gz present
cd netcdf-fortran-4.5.2
./configure --prefix=$DIR/netcdf --disable-dap
     --disable-netcdf-4 --disable-shared
make
make install
setenv PATH $DIR/netcdf/bin:$PATH
setenv NETCDF $DIR/netcdf
cd ..

*Note: If NetCDF fails to build, you will need to talk to a systems administrator at your institution to resolve the problem. We are not able to support NetCDF.
 
Thank you Whatheway,

I do have those paths defined:
Code:
echo $DIR
/p2-varuna/secchi/exps/WRF_build/LIBRARIES

Code:
echo $NETCDF
/p2-varuna/secchi/exps/WRF_build/LIBRARIES/netcdf

The 2 tests at "Library Compatibility Tests" worked well. WRF as successfully build.
But metgrid.exe was not build correctly. I attached the log file, is the same issue reported by Sjahn.

Those are the versions used:

jasper-1.900.5
libpng-1.6.36
mpich-3.3.2
zlib-1.2.11
netcdf-fortran-4.5.2
netcdf-c-4.7.4
WRF Model Version 4.2.2

I will be glad for any insight to solve this issue.
 

Attachments

  • log_wps.txt
    108.9 KB · Views: 13
Last edited:
Sorry, a problem occurred, now is attached.
So in the log file Line 595 to 597

/p2-varuna/secchi/exps/WRF_build/LIBRARIES/netcdf-fortran-4.5.2/fortran/nf_nc4.f90:2074: undefined reference to `nc_set_var_chunk_cache_ints'
collect2: error: ld returned 1 exit status
make[1]: [Makefile:13: metgrid.exe] Error 1 (ignored)

Let me do some investigating and see what I can come up with.
One of the admins might answer before me @Ming Chen
 
So in the log file Line 595 to 597



Let me do some investigating and see what I can come up with.
One of the admins might answer before me @Ming Chen
Okay so if you look at this document @kwerner shared in a related post:

There is this line:
Bash:
export
LD_LIBRARY_PATH=/full-path-to-libs-directory/libs/lib:/full-path-to-libs-directory/libs/netcdf/lib:/full-path-to-libs-directory/libs/grib2/lib

So there is an LD_LIBRARY_PATH variable needed.
 
Okay so if you look at this document @kwerner shared in a related post:

There is this line:
Bash:
export
LD_LIBRARY_PATH=/full-path-to-libs-directory/libs/lib:/full-path-to-libs-directory/libs/netcdf/lib:/full-path-to-libs-directory/libs/grib2/lib

So there is an LD_LIBRARY_PATH variable needed.
Also listed here:


So it looks like those steps are missing from
 
Thank you Mr. Hatheway,
Firstly I tried to export LD_LIBRARY_PATH, without reinstalling the previous libraries. However the same error occurred.

Code:
echo $LD_LIBRARY_PATH
/p2-varuna/secchi/exps/WRF_build/LIBRARIES/lib:/p2-varuna/secchi/exps/WRF_build/LIBRARIES/netcdf/lib:/p2-varuna/secchi/exps/WRF_build/LIBRARIES/grib2/lib

I just executed ./clean at WPS dir and I tried to compile it again. Do you think that better choice is just to use the same versions and procedures in Full WRF and WPS Installation Example ?
 
While both geogrid and metgrid make use of WRF's I/O API to read and write NetCDF files, the metgrid program is special in that it includes additional code for reading NetCDF files (the primary use case being the ingest of MPAS-Atmosphere output). It's purely a guess, but it may be that one of the 'nf90_' routines that are called in the metgrid/src/scan_input.F module ultimately references 'nc_set_var_chunk_cache_ints'.

@Doulgas_secchi Would you be willing to try recompiling the metgrid program after overwriting the default WPS/metgrid/src/scan_input.F file with the attached version, which comments-out calls to NetCDF Fortran90 interface routines? If compilation of the metgrid.exe program is successful, you should be able to use the program as normal, as long as you don't plan on using MPAS-Atmosphere output for WRF ICs and LBCs. The modified scan_input.F file is of course a work-around, but knowing whether it works will help in narrowing down the problem and ultimately finding a long-term solution.
 

Attachments

  • scan_input.F.txt
    23.7 KB · Views: 196
While both geogrid and metgrid make use of WRF's I/O API to read and write NetCDF files, the metgrid program is special in that it includes additional code for reading NetCDF files (the primary use case being the ingest of MPAS-Atmosphere output). It's purely a guess, but it may be that one of the 'nf90_' routines that are called in the metgrid/src/scan_input.F module ultimately references 'nc_set_var_chunk_cache_ints'.

@Doulgas_secchi Would you be willing to try recompiling the metgrid program after overwriting the default WPS/metgrid/src/scan_input.F file with the attached version, which comments-out calls to NetCDF Fortran90 interface routines? If compilation of the metgrid.exe program is successful, you should be able to use the program as normal, as long as you don't plan on using MPAS-Atmosphere output for WRF ICs and LBCs. The modified scan_input.F file is of course a work-around, but knowing whether it works will help in narrowing down the problem and ultimately finding a long-term solution.
@mgduda Could it also be the libraries? Netcdf-c and netcdf-fortran have been updated several times over the last few years and maybe with the new additions to WRF since netcdf-c v4.7 and netcdf-fortran v5.2 were used for wrf v.4.3 may cause the problems?

@Doulgas_secchi mgduda is an admin so I will defer to is recommendations as he knows more about the workings of the inside of the model. I would hate for you to have to rebuild the model from scratch again a second or third time.

Not sure if the installation steps between the two sources are so different that it would cause the model to not install properly.
 
Thank you @mgduda,

I overwrite the scan_input.f90 with your file. Then I just follow with ./clean, ./configure and ./compile WPS.
However the same error "undefined reference to `nc_set_var_chunk_cache' " occurred again.
And I verified that the scan_input.f90 was altered, with the "!" comments being removed.

So I changed again the scan_input.f90, and just use it ./compile metgrib. The scan_input.f90 remain unchanged this time, however the same error with "nc_set_var_chunk_cache_ints" occured.

@Whatheway thank you, I hope find the solution for me and make it useful for others users.
 
@Doulgas_secchi The "scan_input.f90" file is a processed version of "scan_input.F". If you modify just scan_input.f90, clean, and re-compile, that scan_input.f90 file will be overwritten as you've found. Also, if you just modify scan_input.f90 and compile metgrid a second time, that scan_input.f90 file will not be recompiled; it's modifications to scan_input.F that will trigger a recompilation of that file.

Just to make sure we're running the intended test, can you do the following in this order specifically:

1. ./clean -a
2. ./configure
3. Copy the "scan_input.F.txt" that I previously attached to "WPS/metgrid/src/scan_input.F"
4. ./compile

After compiling, you should see that WPS/metgrid/src/scan_input.f90 contains the "!" comment character at the beginning of any line referencing a NetCDF Fortran90 interface routine.

Apologies for the trouble -- I just want to make sure that the modified scan_input.F is being used as intended.
 
@Doulgas_secchi The "scan_input.f90" file is a processed version of "scan_input.F". If you modify just scan_input.f90, clean, and re-compile, that scan_input.f90 file will be overwritten as you've found. Also, if you just modify scan_input.f90 and compile metgrid a second time, that scan_input.f90 file will not be recompiled; it's modifications to scan_input.F that will trigger a recompilation of that file.

Just to make sure we're running the intended test, can you do the following in this order specifically:

1. ./clean -a
2. ./configure
3. Copy the "scan_input.F.txt" that I previously attached to "WPS/metgrid/src/scan_input.F"
4. ./compile

After compiling, you should see that WPS/metgrid/src/scan_input.f90 contains the "!" comment character at the beginning of any line referencing a NetCDF Fortran90 interface routine.

Apologies for the trouble -- I just want to make sure that the modified scan_input.F is being used as intended.
I had the same issue as the OP and this solves the issue. Thank you!
 
I had the same issue as the OP and this solves the issue. Thank you!
That's great to hear! And, it's helpful for us to know that the NetCDF Fortran90 interface calls that we're making in the scan_input.F file may be the source of the problems. Hopefully we can find a reliable workaround for this in the next WPS release.
 
While both geogrid and metgrid make use of WRF's I/O API to read and write NetCDF files, the metgrid program is special in that it includes additional code for reading NetCDF files (the primary use case being the ingest of MPAS-Atmosphere output). It's purely a guess, but it may be that one of the 'nf90_' routines that are called in the metgrid/src/scan_input.F module ultimately references 'nc_set_var_chunk_cache_ints'.

@Doulgas_secchi Would you be willing to try recompiling the metgrid program after overwriting the default WPS/metgrid/src/scan_input.F file with the attached version, which comments-out calls to NetCDF Fortran90 interface routines? If compilation of the metgrid.exe program is successful, you should be able to use the program as normal, as long as you don't plan on using MPAS-Atmosphere output for WRF ICs and LBCs. The modified scan_input.F file is of course a work-around, but knowing whether it works will help in narrowing down the problem and ultimately finding a long-term solution.
Thank you for the help! I also could fix the "Metgrid not installed" issue. However, if you excuse me I'd like to ask you how we solve problems that may result in the usage of MPAS data outputs in the future analysis. I am asking as not knowing what would be my data source in the future. I read your responses and now wondering what can I do if I need to use the MPAS data.

Anyway, Thank you for the solution again.
 
During the WPS compile process, geogrid.exe and ungrib.exe are created normally.

But, metgrid.exe is not created.

It is believed to be caused by the following error:

nf_nc4.f90:(.text+0x678f): undefined reference to `nc_get_var_chunk_cache_ints'
collect2: error: ld returned 1 exit status
Makefile:13: recipe for target 'metgrid.exe' failed
make[1]: [metgrid.exe] Error 1 (ignored)

Can anyone give me some advice on how to solve this?
Sorry to bother you!! Do you solve the problem? I have encountered the same error, can you tell me how to solve it?
 
Top