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

Error during compiling WRF

Amin

New member
Hi,
I'm trying to compile WRF in Ubuntu 22.04 using the instruction on "Compiling WRF" but I got the following error during compiling em_real:

/usr/bin/ld: /tmp/ccOklIQx.ltrans18.ltrans.o:<artificial:mad:.text+0xc92457): more undefined references to `__module_optional_input_MOD_st_input' follow
collect2: error: ld returned 1 exit status

Is there any suggestion? I attached the log file too.

Thank you so much in advance.
 

Attachments

  • log2.zip
    8.9 KB · Views: 3
No, I just want to compile WRF.
Okay,
So for ubuntu 22.04.1 the default GNU version is 11. Ubuntu 20.04.1 the default GNU version is 9.
In GNU 9 there were some compiler flags for fortran code that was enabled in the background.

Code:
-fallow-argument-mismatch 
 -fallow-invalid-boz

With GNU 11 these flags have been turned off so they need to be turned back on. I think that is what is causing the issue with your WRF install.

Could also be the NETCDF install. So what I would do is run these checks on the WRF tutorial website and see if they all come back passed. IF they don't then there is probably a compiler issue that we can debug.
 
Okay,
So for ubuntu 22.04.1 the default GNU version is 11. Ubuntu 20.04.1 the default GNU version is 9.
In GNU 9 there were some compiler flags for fortran code that was enabled in the background.

Code:
-fallow-argument-mismatch
 -fallow-invalid-boz

With GNU 11 these flags have been turned off so they need to be turned back on. I think that is what is causing the issue with your WRF install.

Could also be the NETCDF install. So what I would do is run these checks on the WRF tutorial website and see if they all come back passed. IF they don't then there is probably a compiler issue that we can debug.
before that I get the current error, I got another error that I attached it and by using the following link I solved it:


this link includes the changes in configure file that I added your mentioned flags there, so I think the current error is not related to adding these flags.
 

Attachments

  • log.zip
    52.2 KB · Views: 2
Hmm...

Okay try running these commands and do a fresh install of WRF and libraries. I think what's happening is that fallow argument error is also in the libraries needed for WRF to run.

Bash:
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
export F90=gfortran

#IF statement for GNU compiler issue
export GCC_VERSION=$(/usr/bin/gcc -dumpfullversion | awk '{print$1}')
export GFORTRAN_VERSION=$(/usr/bin/gfortran -dumpfullversion | awk '{print$1}')
export GPLUSPLUS_VERSION=$(/usr/bin/g++ -dumpfullversion | awk '{print$1}')

export GCC_VERSION_MAJOR_VERSION=$(echo $GCC_VERSION | awk -F. '{print $1}')
export GFORTRAN_VERSION_MAJOR_VERSION=$(echo $GFORTRAN_VERSION | awk -F. '{print $1}')
export GPLUSPLUS_VERSION_MAJOR_VERSION=$(echo $GPLUSPLUS_VERSION | awk -F. '{print $1}')

export version_10="10"

if [ $GCC_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GFORTRAN_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GPLUSPLUS_VERSION_MAJOR_VERSION -ge $version_10 ]
then
  export fallow_argument=-fallow-argument-mismatch
  export boz_argument=-fallow-invalid-boz
else
  export fallow_argument=
  export boz_argument=
fi


export FFLAGS=$fallow_argument
export FCFLAGS=$fallow_argument


echo "##########################################"
echo "FFLAGS = $FFLAGS"
echo "FCFLAGS = $FCFLAGS"
echo "##########################################"



Another thing is to run the checks to see if NETCDF and MPI are all playing nice with each other. (Compiling WRF)
They are located about halfway down through that tutorial>
 
Looking at the latest file you provided I see this error.

Code:
catastrophic error: Unable to read 'wrf_io.f'

Since it is having trouble reading a fortran file. My guess is that there is a GNU 11 issue. A couple of options would be to downgrade to Ubuntu 20 or we can continue to debug this issue.
 
Hmm...

Okay try running these commands and do a fresh install of WRF and libraries. I think what's happening is that fallow argument error is also in the libraries needed for WRF to run.

Bash:
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
export F90=gfortran

#IF statement for GNU compiler issue
export GCC_VERSION=$(/usr/bin/gcc -dumpfullversion | awk '{print$1}')
export GFORTRAN_VERSION=$(/usr/bin/gfortran -dumpfullversion | awk '{print$1}')
export GPLUSPLUS_VERSION=$(/usr/bin/g++ -dumpfullversion | awk '{print$1}')

export GCC_VERSION_MAJOR_VERSION=$(echo $GCC_VERSION | awk -F. '{print $1}')
export GFORTRAN_VERSION_MAJOR_VERSION=$(echo $GFORTRAN_VERSION | awk -F. '{print $1}')
export GPLUSPLUS_VERSION_MAJOR_VERSION=$(echo $GPLUSPLUS_VERSION | awk -F. '{print $1}')

export version_10="10"

if [ $GCC_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GFORTRAN_VERSION_MAJOR_VERSION -ge $version_10 ] || [ $GPLUSPLUS_VERSION_MAJOR_VERSION -ge $version_10 ]
then
  export fallow_argument=-fallow-argument-mismatch
  export boz_argument=-fallow-invalid-boz
else
  export fallow_argument=
  export boz_argument=
fi


export FFLAGS=$fallow_argument
export FCFLAGS=$fallow_argument


echo "##########################################"
echo "FFLAGS = $FFLAGS"
echo "FCFLAGS = $FCFLAGS"
echo "##########################################"



Another thing is to run the checks to see if NETCDF and MPI are all playing nice with each other. (Compiling WRF)
They are located about halfway down through that tutorial>
I ran your mentioned commands but I got the same error like that I have before which is in the attachment.
Also I checked the NETCDF and MPI and they are playing nice with each other.
 

Attachments

  • log2.zip
    8.9 KB · Views: 0
Looking at the latest file you provided I see this error.

Code:
catastrophic error: Unable to read 'wrf_io.f'

Since it is having trouble reading a fortran file. My guess is that there is a GNU 11 issue. A couple of options would be to downgrade to Ubuntu 20 or we can continue to debug this issue.
I did not find any error related to what you mentioned as an error in the log file based on attached file. This is my current error that I get.
 

Attachments

  • log2.zip
    8.9 KB · Views: 2
Looks like there might be a LD_PATH error

Code:
L/home/amin/software/airpact6/Build_WRF/LIBRARIES/netcdf/lib -lnetcdff -lnetcdf       
/usr/bin/ld: /tmp/ccOklIQx.ltrans18.ltrans.o: in function `__module_wps_io_arw_MOD_read_wps':
<artificial>:(.text+0xc8438c): undefined reference to `__module_optional_input_MOD_flag_st000010'
/usr/bin/ld: <artificial>:(.text+0xc84399): undefined reference to `__module_optional_input_MOD_flag_st010040'

As that is the first line where the error begins and then runs away causing a cascading error onward.
 
I did not find any error related to what you mentioned as an error in the log file based on attached file. This is my current error that I get.
Did you get this resolved?
 
Unfortunately, not yet.
I would delete the folder where the WRF is and start from scratch. Double check all the paths and version numbers of the libraries you are using to make sure they are all compatible with each other. Might be worth exporting the libraries to the ld library path and path variables. Also make sure to append them to the bash rc file at the end.
 
Top