爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 22141|回复: 16

WRF安装[diffwrf] Error 1 (ignored)

[复制链接]
发表于 2014-4-1 10:40:50 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Ubuntu13.10+WRF3.3+netcdf-4.3.1.1+netcdf-fortran-4.2编译时出现[diffwrf] Error 1 (ignored)
刚开始的问题是
make[2]: Entering directory `/home/dongysh/WRFV3/external/io_netcdf'
x=`echo "gfortran -w -ffree-form -ffree-line-length-none -cpp -fconvert=big-endian -frecord-marker=4 " | awk '{print $1}'` ; export x ; \
    if [ $x = "gfortran" ] ; then \
           echo removing external declaration of iargc for gfortran ; \
       /lib/cpp -C -P -C -P -traditional -I/home/dongysh/netcdf/include -I../ioapi_share diffwrf.F90 | sed '/integer *, *external.*iargc/d' > diffwrf.f ;\
        else \
       /lib/cpp -C -P -C -P -traditional -I/home/dongysh/netcdf/include -I../ioapi_share diffwrf.F90 > diffwrf.f ; \
        fi
removing external declaration of iargc for gfortran
gfortran -w -ffree-form -ffree-line-length-none -cpp -fconvert=big-endian -frecord-marker=4  -c  -I/home/dongysh/netcdf/include -I../ioapi_share diffwrf.f
diffwrf io_netcdf is being built now.
/home/dongysh/netcdf/lib/libnetcdff.so: undefined reference to `nc_delete_mp'

(中间诸多类似undefined)

/home/dongysh/netcdf/lib/libnetcdff.so: undefined reference to `nc_copy_att'
/home/dongysh/netcdf/lib/libnetcdff.so: undefined reference to `ncsetfill'
collect2: error: ld returned 1 exit status
make[2]: [diffwrf] Error 1 (ignored)
make[2]: Leaving directory `/home/dongysh/WRFV3/external/io_netcdf'

通过分析知道netcdf_gfortran的动态库libnetcdff.so中对这些都未未定义,而这些都在动态库libnetcdf.so中定义,故将/home/dongysh/WRFV3/external/io_netcdf/makefile文件作了修改:

          if [ -f $(NETCDFPATH)/lib/libnetcdff.a ] ; then \
            $(FC) $(FFLAGS) $(LDFLAGS) -o diffwrf diffwrf.o $(OBJSL) ../../frame/wrf_debug.o ../../frame/module_wrf_error.o $(ESMF_IO_LIB_EXT) $(LIBS) -lnetcdff ;\
改为
          if [ -f $(NETCDFPATH)/lib/libnetcdf.a ] ; then \
            $(FC) $(FFLAGS) $(LDFLAGS) -o diffwrf diffwrf.o $(OBJSL) ../../frame/wrf_debug.o ../../frame/module_wrf_error.o $(ESMF_IO_LIB_EXT) $(LIBS) -lnetcdf ;\
debug之后又出现下述问题:

make[2]: Entering directory `/home/dongysh/WRFV3/external/io_netcdf'
x=`echo "gfortran -w -ffree-form -ffree-line-length-none -cpp -fconvert=big-endian -frecord-marker=4 " | awk '{print $1}'` ; export x ; \
    if [ $x = "gfortran" ] ; then \
           echo removing external declaration of iargc for gfortran ; \
       /lib/cpp -C -P -C -P -traditional -I/home/dongysh/netcdf/include -I../ioapi_share diffwrf.F90 | sed '/integer *, *external.*iargc/d' > diffwrf.f ;\
        else \
       /lib/cpp -C -P -C -P -traditional -I/home/dongysh/netcdf/include -I../ioapi_share diffwrf.F90 > diffwrf.f ; \
        fi
removing external declaration of iargc for gfortran
gfortran -w -ffree-form -ffree-line-length-none -cpp -fconvert=big-endian -frecord-marker=4  -c  -I/home/dongysh/netcdf/include -I../ioapi_share diffwrf.f
diffwrf io_netcdf is being built now.
wrf_io.o: In function `__ext_ncd_support_routines_MOD_netcdf_err.part.0':
wrf_io.f:(.text+0x2d): undefined reference to `nf_strerror_'
wrf_io.o: In function `__ext_ncd_support_routines_MOD_gettimeindex':
wrf_io.f:(.text+0x70f2): undefined reference to `nf_put_vara_text_'
wrf_io.o: In function `ext_ncd_get_var_td_char_':

(中间诸多类似undefined)

wrf_io.f:(.text+0x396d1): undefined reference to `nf_inq_dimlen_'
wrf_io.o:wrf_io.f:(.text+0x39713): more undefined references to `nf_inq_dimlen_' follow
field_routines.o: In function `ext_ncd_realfieldio_':

(中间诸多类似undefined)

field_routines.f:(.text+0x947): undefined reference to `nf_get_vara_int_'
module_wrfsi_static.o: In function `__wrfsi_static_MOD_open_wrfsi_static':

(中间诸多类似undefined)

module_wrfsi_static.f:(.text+0x7f6): undefined reference to `nf_close_'
collect2: error: ld returned 1 exit status
make[2]: [diffwrf] Error 1 (ignored)
make[2]: Leaving directory `/home/dongysh/WRFV3/external/io_netcdf'


不知是什么原因,该如何解决,请各位帮忙解决一下,谢谢!

另外,WRF运行所需ideal.exe和wrf.exe都可以生成,我想知道diffwrf对WRF的后续运行究竟有什么影响。

密码修改失败请联系微信:mofangbao
发表于 2014-4-1 10:47:29 | 显示全部楼层
ubuntu run models 最让人头疼了~~~
密码修改失败请联系微信:mofangbao
发表于 2014-4-1 11:53:59 | 显示全部楼层
本帖最后由 longlivehj 于 2014-4-1 11:55 编辑

出错的原因你找到了,但是这样修改makefile是不行的。nc_*在libnetcdf.so中,nf_*在libnetcdff.so中,你那样修改必然会出现undefined reference to nf_*的错误。

现在能确定的就是你的libnetcdf.so似乎没有正确链接。

注意到你用的是4.2以上版本的netcdf,这样的话,c库和fortran库是分开的。你在分别编译后,安装的位置是否相同?为了避免麻烦,可以直接采用低版本的netcdf,比如4.1.2。

linux系统很自由,每个人配置都不一样。最好能贴出configure的结果,以及告知关键库(比如netcdf)的安装位置等信息,便于查错。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-4-1 18:41:33 | 显示全部楼层
本帖最后由 dongysh 于 2014-4-1 18:57 编辑
longlivehj 发表于 2014-4-1 11:53
出错的原因你找到了,但是这样修改makefile是不行的。nc_*在libnetcdf.so中,nf_*在libnetcdff.so中,你那 ...

你好!
netcdf编译后安装位置是相同的,贴一下configure和.bashrc,望指导
configure:
#!/bin/sh

# parse argument list

thiscmd=$0

FORTRAN_COMPILER_TIMER=""
opt_level="-f"
print_usage=""
chemistry=""
wrf_core=""
while [ $# -ge 1 ]; do
    case $1 in
      -d) opt_level="-d" ;;
      -s) opt_level="-s" ;;
      -f) opt_level="-f" ;;
      -h) print_usage="yes" ;;
      -help) print_usage="yes" ;;
      -os) shift ; WRF_OS=$1 ;;
      -mach) shift ; WRF_MACH=$1 ;;
      -time) shift ; FORTRAN_COMPILER_TIMER=$1 ;;
      chem) WRF_CHEM=1  ;;
      kpp) WRF_KPP=1  ;;
      radardfi) WRF_DFI_RADAR=1  ;;
      wrfda) wrf_core=DA_CORE ;;
      4dvar) wrf_core=4D_DA_CORE ;;
      arw) wrf_core=EM_CORE  ;;
      nmm) wrf_core=NMM_CORE  ;;
      coamps) wrf_core=COAMPS_CORE  ;;
      exp) wrf_core=EXP_CORE  ;;
      titan) WRF_TITAN=1 ; break ;;
      mars) WRF_MARS=1 ; break ;;
      venus) WRF_VENUS=1 ; break ;;
    esac
    shift
done
if [ -n "$print_usage" ] ; then
  echo usage: $thiscmd '[-d|-s|-f|-os os|-mach mach|-time timecommand] [chem] [kpp]'
  exit
fi

if `pwd | grep ' ' > /dev/null ` ; then
  echo '************************** W A R N I N G ************************************'
  echo The current working directory has spaces in some components of its path name
  echo and this may cause problems for your build.  This can occur, for example, on
  echo Windows systems.  It is strongly recommended that you install WRF and other
  echo related software such as NetCDF in directories whose path names contain no
  echo white space.  On Win, for example, create and install in a directory under C:.
  echo '*****************************************************************************'
fi


# lifted from the configure file for mpich; 00/03/10 jm
#
# Check for perl and perl version
for p in perl5 perl
do
  # Extract the first word of "$p", so it can be a program name with args.
  set dummy $p; ac_word=$2
  if test -z "$ac_echo_n" ; then
    ac_echo_n=yes
    if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
      # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
      if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
    ac_n= ac_c='
' ac_t='        '
      else
        ac_n=-n ac_c= ac_t=
      fi
    else
      ac_n= ac_c='\c' ac_t=
    fi
    ac_echo_test=`echo foo 1>&1`
    if test -z "$ac_echo_test" ; then
       print_error "Your sh shell does not handle the output redirection"
       print_error "1>&1 correctly.  Configure will work around this problem,"
       print_error "but you should report the problem to your vendor."
    fi
  fi
  if test -z "$ac_echo_test" -a 1 = 1 ; then
    echo $ac_n "checking for $ac_word""... $ac_c"
  else
    echo $ac_n "checking for $ac_word""... $ac_c" 1>&1
  fi
  ac_prog_where=""
  if test -n "$PERL"; then
    ac_pg_PERL="$PERL" # Let the user override the test.
  else
    ac_first_char=`expr "$p" : "\(.\)"`
    if test "$ac_first_char" = "/" -a -x "$p" ; then
         ac_pg_PERL="$p"
         ac_prog_where=$p
    else
        IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
        for ac_dir in $PATH; do
          test -z "$ac_dir" && ac_dir=.
          if test -f $ac_dir/$ac_word; then
            ac_pg_PERL="$p"
            ac_prog_where=$ac_dir/$ac_word
            break
          fi
        done
        IFS="$ac_save_ifs"
    fi
  fi;PERL="$ac_pg_PERL"
  if test -n "$ac_prog_where" ; then
    if test -z "$ac_echo_test" -a 1 = 1 ; then
      echo "$ac_t""found $ac_prog_where ($PERL)"
    else
      echo "$ac_t""found $ac_prog_where ($PERL)" 1>&1
    fi
    PERLFULLPATH=$ac_prog_where  
  else
    if test -z "$ac_echo_test" -a 1 = 1 ; then
      echo "$ac_t""no"
    else
      echo "$ac_t""no" 1>&1
    fi
  fi
  test -n "$PERL" && break
done

if test -z "$PERL" ; then
    # We have to set this outside of the loop lest the first failure in
    # PROGRAM_CHECK set the value (which then terminates the effect of the
    # loop, since autoconf macros only set values that are null, they
    # don't override them
    PERL=""
fi

if test -n "$PERL" ; then
    PERL="$PERL"
   
    perlversion=`$PERL -v | grep 'This is perl' | \
       sed -e 's/^.*v[a-z ]*\([0-9]\).*$/\1/'`

    # Should do a test first for ch_p4 etc.
    if test "$perlversion" -lt 5 ; then
        echo "WRF build requires perl version 5, which configure did not find."
        echo "You can set the environment variable PERL to contain the "
        echo "location of perl version 5."
        echo "Configure believes that $PERL is version $perlversion ."
        PERL=""
    fi
   
fi

# Look for netcdf
if test -z "$NETCDF" ; then
  for p in /usr/local/netcdf
  do
    if test -d $p ; then
      NETCDF=$p
      break
    fi
  done
fi
if  test -z "$NETCDF"  ; then

  if [ `hostname | cut -c 1-2` = "bs" -o \
       `hostname | cut -c 1-2` = "bd" -o \
       `hostname` = "tempest" -o `hostname` = "ute" ] ; then
    echo 'Compiling on an NCAR system with weird paths to NetCDF'
    echo 'Setting up a local NetCDF directory with symlinks'
    if ( test -d ./netcdf_links ) ; then
      echo 'A directory ./netcdf_links already exists. Continuing.'
    else
      mkdir ./netcdf_links
      if [ -z "$OBJECT_MODE" ] ; then
         OBJECT_MODE=32
         export OBJECT_MODE
      fi
      if [ $OBJECT_MODE -ne 64 -a \( `hostname | cut -c 1-2` = "bd" -o `hostname | cut -c 1-2` = "bs" \) ] ; then
        ( cd ./netcdf_links ; ln -s /usr/local/lib32/r4i4 ./lib ; \
                              ln -s /usr/local/include ./include )
      else
        ( cd ./netcdf_links ; ln -s /usr/local/lib64/r4i4 ./lib ; \
                              ln -s /usr/local/include ./include )
      fi
    fi
    NETCDF=`pwd`/netcdf_links
    export NETCDF


  else
    bedone=""
    if [ -d ./netcdf_links ] ; then
      echo '** There is an existing ./netcdf_links file. Should I use? [y]'
      read resp
      if [ "$resp" = "y" ] ; then
        NETCDF=`pwd`/netcdf_links
        bedone="yes"
      else
        echo 'Removing existing ./netcdf_links directory'
        /bin/rm -fr ./netcdf_links
      fi
    else
      echo '** WARNING: No path to NETCDF and environment variable NETCDF not set.'
      echo '** would you like me to try to fix? [y]'
    fi
    netcdfipath=""
    netcdflpath=""
    while [ -z "$bedone" ] ; do
      read resp
      if [ "$resp" = "y" -o -z "$resp" ]  ; then
        if [ -d ./netcdf_links ] ; then
          echo 'There is already a ./netcdf_links directory. Okay to use links'
          echo 'in this directory for NetCDF include and lib dirs? [y]'
          read resp
          if [ "$resp" = "y" ] ; then
            NETCDF=`pwd`/netcdf_links
            export NETCDF
            bedone="yes"
            continue
          fi
        fi
        if [ -z "$netcdfipath" ] ; then
          echo 'Enter full path to NetCDF include directory on your system'
          read resp
          if [ ! -d "$resp" ] ; then
            echo "invalid path: $resp. Try again? [y]" ; continue
          fi
          netcdfipath=$resp
        fi
        if  [ -z "$netcdflpath" ] ; then
          echo 'Enter full path to NetCDF library directory on your system'
          read resp
          if [ ! -d "$resp" ] ; then
            echo "invalid path: $resp. Try again? [y]" ; continue
          fi
          netcdflpath=$resp
        fi

        if [ -n "$netcdflpath" -a -n "$netcdfipath" ] ; then
          if [ -d ./netcdf_links ] ; then
            echo 'Existing ./netcdf_links directory. Okay to remove. [y]'
            read resp
            if [ "$resp" = "y" ]  ; then
              /bin/rm -fr ./netcdf_links
            fi
          fi
          mkdir ./netcdf_links
          cd ./netcdf_links
            ln -s "$netcdfipath" include
            ln -s "$netcdflpath" lib
          cd ..
          echo created new ./netcdf_links directory
          /bin/ls -lF ./netcdf_links
          NETCDF=`pwd`/netcdf_links
          export NETCDF
          bedone="yes"
        fi
      else
        bedone="yes"
      fi
    done
  fi
fi

if test -z "$PDHF5" ; then
  if [ `hostname | cut -c 1-2` = "bb" -o `hostname | cut -c 1-2` = "bf" -o `hostname | cut -c 1-2` = "bs" -o \
       `hostname` = "dataproc" -o `hostname` = "ute" ] ; then
      if [ -d ~michalak/hdf5pbin ] ; then
        PHDF5=~michalak/hdf5pbin
        export PHDF5
      fi
      if [ "$OBJECT_MODE" -eq 64 ] ; then
            if [ -d ~michalak/hdf5pbin-64 ] ; then
              PHDF5=~michalak/hdf5pbin-64
              export PHDF5
            fi
      fi
  fi
fi

USENETCDFF=""  # see below
if [ -n "$NETCDF" ] ; then
  echo "Will use NETCDF in dir: $NETCDF"
# for 3.6.2 and greater there might be a second library, libnetcdff.a .  Check for this and use
# if available
  if [ -f "$NETCDF/lib/libnetcdff.a" ] ; then
    USENETCDFF="-lnetcdff"
  fi
else
  echo "Will configure for use without NetCDF"
fi

if [ -n "$PNETCDF" ] ; then
  echo "Will use PNETCDF in dir: $PNETCDF"
# experimental, so don't tease the user if it is not there
#else
#  echo "Will configure for use without NetCDF"
fi

if [ -n "$PHDF5" ] ; then
  echo "Will use PHDF5 in dir: $PHDF5"
else
  echo "PHDF5 not set in environment. Will configure WRF for use without."
fi

if [ "$wrf_core" = "DA_CORE" ]; then
   if [ -n "$WRFPLUS_DIR" ] ; then
      echo "To compile WRFDA without 4DVAR, please remove \$WRFPLUS_DIR from environment. "
      exit
   fi
fi

if [ "$wrf_core" = "4D_DA_CORE" ]; then
   if [ -n "$WRFPLUS_DIR" ] ; then
      echo "Will use WRFPLUS in dir: $WRFPLUS_DIR"
   else
      echo "WRFPLUS_DIR not set in environment. Please compile WRFPLUS and set WRFPLUS_DIR."
      exit
   fi
fi
# Users who are cross-compiling can set environment variable
# $WRF_OS to override the value normally obtained from `uname`.  
# If $WRF_OS is set, then $WRF_MACH can also be set to override
# the value normally obtained from `uname -m`.  If $WRF_OS is
# set and $WRF_MACH is not set, then $WRF_MACH defaults to "ARCH".  
# If $WRF_OS is not set then $WRF_MACH is ignored.  
if [ -n "$WRF_OS" ] ; then
  echo "${0}:  WRF operating system set to \"${WRF_OS}\" via environment variable \$WRF_OS"
  os=$WRF_OS
  mach="ARCH"
  if [ -n "$WRF_MACH" ] ; then
    echo "${0}:  WRF machine set to \"${WRF_MACH}\" via environment variable \$WRF_MACH"
    mach=$WRF_MACH
  fi
else
  # if the uname command exists, give it a shot and see if
  # we can narrow the choices; otherwise, spam 'em
  os="ARCH"
  mach="ARCH"
  type uname > /dev/null
  if [ $? -eq 0 ] ; then
    os=`uname`
    if [ "$os" = "AIX" -o "$os" = "IRIX" -o "$os" = "IRIX64" -o "$os" = "SunOS" -o "$os" = "HP-UX"  -o "$os" = "Darwin" -o "$os" = "Interix" ] ; then
      mach="ARCH"
    else
      xxx=`expr "$os" : '\(.........\).*'`
      if [ "$xxx"  = "CYGWIN_NT" ] ; then
        os=$xxx
      fi
      if [ "$os" = "OSF1" -o "$os" = "Linux" -o "$os" = "UNICOS/mp" -o "$os" = "UNIX_System_V" -o  "$os" = "CYGWIN_NT" ] ; then
        mach=`uname -m`
        if [ "$mach" = "ia64" -a -f /etc/sgi-release ] ; then
          mach="Altix"
        fi
      else
        os="ARCH"
        mach="ARCH"
      fi
    fi
  fi
fi

# an IBM specific hack to adjust the bmaxstack and bmaxdata options if addressing is 32-bit
if [ "$os" = "AIX" ] ; then
      if [ -z "$OBJECT_MODE" ] ; then
         OBJECT_MODE=32
         export OBJECT_MODE
      fi
      if [ "$OBJECT_MODE" = "32" ] ; then
# the bang means nothing to sh in this context; use to represent spaces (perl will unbang)
         ldflags=-bmaxstack:256000000!-bmaxdata:2048000000
      fi
fi

# compile options that come from the environment, such as chemistry
# the "!" is removed by Config_new.pl
if [ -n "$WRF_MARS" ] ; then
  if [ $WRF_MARS = 1 ] ; then
    echo building WRF for Mars
    compileflags="${compileflags}!-DPLANET!-DMARS"
    echo $compileflags
  fi
fi

if [ -n "$WRF_TITAN" ] ; then
  if [ $WRF_TITAN = 1 ] ; then
    echo building WRF for Mars
    compileflags="${compileflags}!-DPLANET!-DTITAN"
  fi
fi

if [ -n "$WRF_VENUS" ] ; then
  if [ $WRF_VENUS = 1 ] ; then
    echo building WRF for Mars
    compileflags="${compileflags}!-DPLANET!-DVENUS"
  fi
fi
if [ -n "$WRF_NMM_CORE" ]; then
  if [ $WRF_NMM_CORE = 1 ]; then
    if [ -n "$HWRF" ]; then
      if [ $HWRF = 1 ]; then
        echo building WRF with HWRF option
        compileflags="${compileflags}!-DHWRF=1"
        if [ -n "$HWRFX" ]; then
          if [ $HWRFX = 1 ]; then
            compileflags="${compileflags}!-DHWRFX=1"
          fi
        fi
      fi
    fi
  fi
fi
if [ -n "$WRF_DFI_RADAR" ] ; then
  if [ $WRF_DFI_RADAR = 1 ] ; then
    echo building WRF with radar dfi option
    compileflags="${compileflags}!-DWRF_DFI_RADAR=1"
  fi
fi
if [ -n "$WRF_CHEM" ] ; then
  if [ $WRF_CHEM = 1 ] ; then
    echo building WRF with chemistry option
    compileflags="${compileflags}!-DWRF_CHEM!-DBUILD_CHEM=1"
    if [ -n "$WRF_KPP" ] ; then
      if [ $WRF_KPP = 1 ] ; then   
        echo building WRF with KPP chemistry option
        compileflags="${compileflags}!-DWRF_KPP"
      fi
    fi
  else
    compileflags="${compileflags} "
  fi
else
  compileflags="${compileflags} "
fi

if [ `which timex` ] ; then
  FORTRAN_COMPILER_TIMER=timex
fi

# Found perl, so proceed with configuration
if test -n "$PERL" ; then
   srch=`grep -i "^#ARCH.*$os" arch/configure_new.defaults | grep -i "$mach"`
   if [ -n "$srch" ] ; then
     $PERL arch/Config_new.pl -dmparallel=$COMMLIB -ompparallel=$OMP -perl=$PERL \
          -netcdf=$NETCDF -pnetcdf=$PNETCDF -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \
          -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF -time=$FORTRAN_COMPILER_TIMER \
          -wrf_core=$wrf_core
     if test ! -f configure.wrf ; then
       exit 1
     fi
     if [ "$opt_level" = "-d" ] ; then
        sed -e 's/FCOPTIM[     ]*=/& # /' -e '/FCDEBUG[     ]*=/s/#//g' configure.wrf > configure.wrf.edit
        /bin/mv configure.wrf.edit configure.wrf
     fi
   else
     WRF_OS=$os ; export WRF_OS
     WRF_MACH=$mach ; export WRF_MACH
     echo '*** Configuration not found in configure_new.defaults; checking configure_old.defaults ***'

     # see if we still have an old setting laying around from v2
     if [ "$opt_level" = "-d" ] ; then
       arch/config_old $opt_level
     else
       arch/config_old
     fi

   fi
fi

# new feb 2005.  test whether MPI-2
if test -f configure.wrf ; then
  grep 'DMPARALLEL *= *1' configure.wrf > /dev/null
  if [ $? = 0 ] ; then
    echo testing for MPI_Comm_f2c and MPI_Comm_c2f
    /bin/rm -f tools/mpi2_test
    ( make mpi2_test 2> /dev/null ) 1> /dev/null
    if test -e tools/mpi2_test.o ; then
      echo "  " MPI_Comm_f2c and MPI_Comm_c2f are supported
      sed '/^DM_CC.*=/s/$/ -DMPI2_SUPPORT/' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf
      if [ `hostname | cut -c 1-2` = "be" ] ; then
         sed '/^ARCH_LOCAL.*=/s/$/ -DUSE_MPI_IN_PLACE/' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf
      fi
    else
      echo "  " MPI_Comm_f2c and MPI_Comm_c2f are not supported
    fi
    grep 'OMPCPP *= *-D_OPENMP' configure.wrf > /dev/null
    if [ $? = 0 ] ; then
      echo testing for MPI_Init_thread
      /bin/rm -f tools/mpi2_thread_test
      ( make mpi2_thread_test 2> /dev/null ) 1> /dev/null
      if test -e tools/mpi2_thread_test.o ; then
        echo "  " MPI_Init_thread is supported
        sed '/^DM_CC.*=/s/$/ -DMPI2_THREAD_SUPPORT/' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf
      else
        echo "  " MPI_Init_thread is not supported
      fi
    fi
  fi
# new dec 2005.  test what fseek is supported (needed for share/landread.c to work correctly)
  echo testing for fseeko and fseeko64
  /bin/rm -f tools/fseeko_test tools/fseeko64_test
  ( make fseek_test 2> /dev/null ) 1> /dev/null
  if [ "$os" = "Darwin" ] ; then
    # fseeko64 does not exist under Darwin fseeko does. Remove the 0 length executable
    # file that might get generated anyway, even though the compiler complains about missing reference.
    /bin/rm -f tools/fseeko64_test
  fi
  if test -x tools/fseeko64_test ; then
    ( tools/fseeko64_test 2> /dev/null ) 1> /dev/null
    if [ $? = 0 ] ; then
       echo fseeko64 is supported
       sed '/^CC .*=/s/$/ -DFSEEKO64_OK /' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf
    fi
  else
    if test -x tools/fseeko_test ; then
      ( tools/fseeko_test 2> /dev/null ) 1> /dev/null
      if [ $? = 0 ] ; then
        echo fseeko is supported and handles 64 bit offsets
        sed '/^CC .*=/s/$/ -DFSEEKO_OK /' configure.wrf > xx$$ ; /bin/mv xx$$ configure.wrf
      else
        echo neither fseeko64 nor fseeko with 64 bit offsets works, landread will be compiled with fseek
        echo but may not work correctly for very high resolution terrain datasets
      fi
    else
      echo neither fseeko64 nor fseeko with 64 bit offsets works, landread will be compiled with fseek
      echo but may not work correctly for very high resolution terrain datasets
    fi
  fi
fi

echo "------------------------------------------------------------------------"
sed -e '1,/#### Architecture specific settings ####/d' -e '/^externals/,$d' configure.wrf

echo "------------------------------------------------------------------------"
echo "Settings listed above are written to configure.wrf."
echo "If you wish to change settings, please edit that file."
echo "If you wish to change the default options, edit the file:"
echo "     arch/configure_new.defaults"

if test -n $NETCDF ; then
  grep nf_format_64bit $NETCDF/include/netcdf.inc > /dev/null
  configure_aaaa=$? ; export configure_aaaa
  if [ $configure_aaaa -a -z "$WRFIO_NCD_LARGE_FILE_SUPPORT" ] ; then
    echo "NetCDF users note:"
    echo " This installation of NetCDF supports large file support.  To enable large file"
    echo " support in NetCDF, set the environment variable WRFIO_NCD_LARGE_FILE_SUPPORT"
    echo " to 1 and run configure again. Set to any other value to avoid this message."
  fi
fi
echo "  "

if [ "$wrf_core" = "DA_CORE" ]; then
  if [ "`grep '^SFC' configure.wrf | grep -i 'gfortran'`" != "" ]; then
    echo "WRFDA using gfortran needs realsize=8"
    sed -e '/^PROMOTION.*=/s/#//' configure.wrf > configure.wrf.edit
    /bin/mv configure.wrf.edit configure.wrf
  fi
fi

#Checking cross-compiling capability for some particular environment
#on Linux and Mac box

if [ $os = "Linux" -o $os = "Darwin" ]; then

  SFC=`grep '^SFC' configure.wrf | awk '{print $3}'`
  SCC=`grep '^SCC' configure.wrf | awk '{print $3}'`
  CCOMP=`grep '^CCOMP' configure.wrf | awk '{print $3}'`

  SFC="`type $SFC 2>/dev/null | awk '{print $NF}' | sed -e 's/(//g;s/)//g'`"
  SCC="`type $SCC 2>/dev/null | awk '{print $NF}' | sed -e 's/(//g;s/)//g'`"
  CCOMP="`type $CCOMP 2>/dev/null | awk '{print $NF}' | sed -e 's/(//g;s/)//g'`"

  if [ -e $NETCDF/lib/libnetcdf.a -a "$SFC" != "" -a "$SCC" != "" -a "$CCOMP" != "" ]; then

    SFC_MULTI_ABI=0
    SCC_MULTI_ABI=0
    CCOMP_MULTI_ABI=0
    CROSS_COMPILING=0

    foo=`mktemp foo_$$.XXXXXX`

    echo
    echo Testing for NetCDF, C and Fortran compiler
    echo

cat > ${foo}.c <<EOF
int main(int argc, char ** argv)
{
     return (0);
}
EOF

cat > ${foo}.f <<EOF
          program test_exit
            integer :: STATUS = 0
            call EXIT(STATUS)
          end program test_exit
EOF

    ar p $NETCDF/lib/libnetcdf.a > ${foo}.o
    netcdf_arch="`file ${foo}.o | grep -o -E '[0-9]{2}-bit|i386'`"
    rm ${foo}.o

    $SFC -o ${foo} ${foo}.f > /dev/null 2>&1
    SFC_arch="`file ${foo} | grep -o -E '[0-9]{2}-bit|i386'`"
    rm ${foo} 2> /dev/null

    $SCC -o ${foo} ${foo}.c > /dev/null 2>&1
    SCC_arch="`file ${foo} | grep -o -E '[0-9]{2}-bit|i386'`"
    CCOMP_arch=$SCC_arch
    rm ${foo} 2> /dev/null

    if [ "$SCC" != "$CCOMP" ]; then
      $CCOMP -o ${foo} ${foo}.c > /dev/null 2>&1
      CCOMP_arch="`file ${foo} | grep -o -E '[0-9]{2}-bit|i386'`"
      rm ${foo} 2> /dev/null
    fi

    if [ "$SFC_arch" = "" -o "$SCC_arch" = "" -o "$CCOMP_arch" = "" ]; then
      echo "  One of compilers testing failed!"
      echo "  Please check your compiler"
      echo
      rm ${foo}* 2> /dev/null
      exit
    else
      cp configure.wrf configure.wrf.edit
    fi

    case $netcdf_arch in

      32-bit|i386 )

      if [ "$SFC_arch" = "64-bit" ] ; then
        CROSS_COMPILING=1
        $SFC -m32 -o ${foo} ${foo}.f > /dev/null 2>&1
        if [ $? = 0 ]; then
          SFC_MULTI_ABI=1
          sed '/^SFC.*=/s/$/ -m32/' configure.wrf.edit > configure.wrf.tmp
          mv configure.wrf.tmp configure.wrf.edit
        fi
      fi
      if [ "$SCC_arch" = "64-bit" ] ; then
        CROSS_COMPILING=1
        $SCC -m32 -o ${foo} ${foo}.c > /dev/null 2>&1
        if [ $? = 0 ]; then
          SCC_MULTI_ABI=1
          sed '/^SCC.*=/s/$/ -m32/' configure.wrf.edit > configure.wrf.tmp
          mv configure.wrf.tmp  configure.wrf.edit
        fi
      fi

      if [ "$CCOMP_arch" = "64-bit" ] ; then
        CROSS_COMPILING=1
        if [ "$CCOMP" != "$SCC" ]; then
          $CCOMP -m32 -o ${foo} ${foo}.c > /dev/null 2>&1
          if [ $? = 0 ]; then
            CCOMP_MULTI_ABI=1
            sed '/^CCOMP/ s/$/ -m32/' configure.wrf.edit > configure.wrf.tmp
            mv configure.wrf.tmp  configure.wrf.edit
          fi
        else
          CCOMP_MULTI_ABI=1
          sed '/^CCOMP/ s/$/ -m32/' configure.wrf.edit > configure.wrf.tmp
          mv configure.wrf.tmp  configure.wrf.edit
        fi
      fi

      if [ $CROSS_COMPILING -eq 1 ] ; then
        echo NOTE:
        echo This installation NetCDF is 32-bit
        if [ \( $SFC_MULTI_ABI -ne 1 -a "$SFC_arch" = "64-bit" \) \
             -o \( $SCC_MULTI_ABI -ne 1 -a "$SCC_arch" = "64-bit" \) \
             -o \( $CCOMP_MULTI_ABI -ne 1 -a "$CCOMP_arch" = "64-bit" \) ] ; then
             rm configure.wrf.edit
             echo One of compilers is 64-bit and doesn\'t support cross-compiling.
             echo Please check your NETCDF lib and compiler
        else
          echo -m32 is appended to configure.wrf
          echo It will be forced to build in 32-bit.
          echo If you don\'t want 32-bit binaries, please use 64-bit NetCDF, and re-run the configure script.
        fi
      fi
      ;;

      64-bit )

      if [ "$SFC_arch" = "32-bit" -o "$SFC_arch" = "i386" ] ; then
        CROSS_COMPILING=1
        $SFC -m64 -o ${foo} ${foo}.f > /dev/null 2>&1
        if [ $? = 0 ]; then
          SFC_MULTI_ABI=1
          sed '/^SFC.*=/s/$/ -m64/' configure.wrf.edit > configure.wrf.tmp
          mv configure.wrf.tmp configure.wrf.edit
        fi
      fi
      if [ "$SCC_arch" = "32-bit" -o "$SCC_arch" = "i386" ] ; then
        CROSS_COMPILING=1
        $SCC -m64 -o ${foo} ${foo}.c > /dev/null 2>&1
        if [ $? = 0 ]; then
          SCC_MULTI_ABI=1
          sed '/^SCC.*=/s/$/ -m64/' configure.wrf.edit > configure.wrf.tmp
          mv configure.wrf.tmp configure.wrf.edit
        fi
      fi

      if [ "$CCOMP_arch" = "32-bit" -o "$CCOMP_arch" = "i386" ] ; then
        CROSS_COMPILING=1
        if [ "$CCOMP" != "$SCC" ]; then
          $CCOMP -m64 -o ${foo} ${foo}.c > /dev/null 2>&1
          if [ $? = 0 ]; then
            CCOMP_MULTI_ABI=1
            sed '/^CCOMP/ s/$/ -m64/' configure.wrf.edit > configure.wrf.tmp
            mv configure.wrf.tmp  configure.wrf.edit
          fi
        else
          CCOMP_MULTI_ABI=1
          sed '/^CCOMP/ s/$/ -m64/' configure.wrf.edit > configure.wrf.tmp
          mv configure.wrf.tmp  configure.wrf.edit
        fi
      fi

      if [ $CROSS_COMPILING -eq 1 ] ; then
        echo NOTE:
        echo This installation NetCDF is 64-bit
        if [ \( $SFC_MULTI_ABI -ne 1 -a "$SFC_arch" != "64-bit" \) \
            -o \( $SCC_MULTI_ABI -ne 1 -a "$SCC_arch" != "64-bit" \) \
            -o \( $CCOMP_MULTI_ABI -ne 1 -a "CCOMP_arch" != "64-bit" \) ]; then
            rm configure.wrf.edit
            echo One of Compilers is 32-bit and doesn\'t support cross-compiling.
            echo Please check your NetCDF lib and compiler
        else
          echo -m64 is appended to configure.wrf
          echo It will be forced to build in 64-bit.
          echo If you don\'t want 64-bit binaries, please use 32-bit NetCDF, and re-run the configure script.
        fi
      fi
      ;;
    esac

    if [ -e configure.wrf.edit ]; then
      mv configure.wrf.edit configure.wrf
    fi

    rm ${foo}* 2> /dev/null

    if [ $CROSS_COMPILING -eq 0 ] ; then
      echo This installation NetCDF is $netcdf_arch
      echo C compiler is $SCC_arch
      echo Fortran compiler is $SFC_arch
      echo It will build in $netcdf_arch
    fi
    echo
  fi
fi
.bashrc
#for netcdf
export NETCDF=/home/dongysh/netcdf
export PATH=.:$NETCDF/bin:$PATH
export LD_LIBRARY_PATH=${NETCDF}/lib:${LD_LIBRARY_PATH}
export LD_RUN_PATH=${NETCDF}/lib:${LD_RUN_PATH}

export WRFIO_NCD_LARGE_FILE_SUPPORT=1
密码修改失败请联系微信:mofangbao
发表于 2014-4-1 19:29:05 | 显示全部楼层
dongysh 发表于 2014-4-1 18:41
你好!
netcdf编译后安装位置是相同的,贴一下configure和.bashrc,望指导
configure:

o(∩∩)o...哈哈,不是configure,是configure.wrf,这个才是configure的结果。贴出来瞅瞅。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-4-1 19:52:09 | 显示全部楼层
longlivehj 发表于 2014-4-1 19:29
o(∩∩)o...哈哈,不是configure,是configure.wrf,这个才是configure的结果。贴出来瞅瞅。

晕,刚贴的时候我还纳闷呢,想把三个都贴出来,还是只贴了一个:
# configure.wrf
#
# This file was automatically generated by the configure script in the
# top level directory. You may make changes to the settings in this
# file but be aware they will be overwritten each time you run configure.
# Ordinarily, it is necessary to run configure once, when the code is
# first installed.
#
# To permanently change options, change the settings for your platform
# in the file arch/configure.defaults then rerun configure.
#
SHELL           =       /bin/sh
DEVTOP          =       `pwd`
LIBINCLUDE      =       .
.SUFFIXES: .F .i .o .f90 .c

#### Get core settings from environment (set in compile script)
#### Note to add a core, this has to be added to.

COREDEFS = -DEM_CORE=$(WRF_EM_CORE) \
           -DNMM_CORE=$(WRF_NMM_CORE) -DNMM_MAX_DIM=2600 \
           -DCOAMPS_CORE=$(WRF_COAMPS_CORE) \
           -DDA_CORE=$(WRF_DA_CORE) \
           -DEXP_CORE=$(WRF_EXP_CORE)

#### Single location for defining total number of domains.  You need
#### at least 1 + 2*(number of total nests).  For example, 1 coarse
#### grid + three fine grids = 1 + 2(3) = 7, so MAX_DOMAINS=7.

MAX_DOMAINS        =        21

#### DM buffer length for the configuration flags.

CONFIG_BUF_LEN        =        32768

#### Size of bitmasks (in 4byte integers) of stream masks for WRF I/O

MAX_HISTORY = 25

IWORDSIZE = 4
DWORDSIZE = 8
LWORDSIZE = 4

##############################################################################
#### The settings in this section are defaults that may be overridden by the
#### architecture-specific settings in the next section.  
##############################################################################

##############################################################################
#### NOTE:  Do not modify these default values here.  To override these
####        values, make changes after "Architecture specific settings".  
##############################################################################

#### Native size (in bytes) of Fortran REAL data type on this architecture ####
#### Note:  to change real wordsize (for example, to promote REALs from
####        4-byte to 8-byte), modify the definition of RWORDSIZE in the
####        section following "Architecture specific settings".  Do not
####        change NATIVE_RWORDSIZE as is it architecture-specific.  
NATIVE_RWORDSIZE = 4

#### Default sed command and script for Fortran source files ####
#SED_FTN = sed -f $(WRF_SRC_ROOT_DIR)/arch/standard.sed
SED_FTN = $(WRF_SRC_ROOT_DIR)/tools/standard.exe

# Hack to work around $(PWD) not changing during OSF1 build.  
# $(IO_GRIB_SHARE_DIR) is reset during the OSF1 build only.  
IO_GRIB_SHARE_DIR =

#### ESMF switches                 ####
#### These are set up by Config.pl ####
# switch to use separately installed ESMF library for coupling:  1==true
ESMF_COUPLING       = 0
# select dependences on module_utility.o
ESMF_MOD_DEPENDENCE = $(WRF_SRC_ROOT_DIR)/external/esmf_time_f90/module_utility.o
# select -I options for external/io_esmf vs. external/esmf_time_f90
ESMF_IO_INC         = -I$(WRF_SRC_ROOT_DIR)/external/esmf_time_f90
# select -I options for separately installed ESMF library, if present
ESMF_MOD_INC        =  $(ESMF_IO_INC)
# select cpp token for external/io_esmf vs. external/esmf_time_f90
ESMF_IO_DEFS        =
# select build target for external/io_esmf vs. external/esmf_time_f90
ESMF_TARGET         = esmf_time

##############################################################################

LIBWRFLIB = libwrflib.a


#### Architecture specific settings ####

# Settings for Linux i486 i586 i686, gfortran compiler with gcc  (dm+sm)
#
DMPARALLEL      =        1
OMPCPP          =        -D_OPENMP
OMP             =        -fopenmp
OMPCC           =        -fopenmp
SFC             =       gfortran
SCC             =       gcc
CCOMP           =       gcc
DM_FC           =       mpif90 -f90=$(SFC)
DM_CC           =       mpicc -cc=$(SCC) -DMPI2_SUPPORT -DMPI2_THREAD_SUPPORT
FC              =        $(DM_FC)
CC              =       $(DM_CC) -DFSEEKO64_OK
LD              =       $(FC)
RWORDSIZE       =       $(NATIVE_RWORDSIZE)
PROMOTION       =       # -fdefault-real-8  # uncomment manually
ARCH_LOCAL      =       -DNONSTANDARD_SYSTEM_SUBR
CFLAGS_LOCAL    =       -w -O3 -c -DLANDREAD_STUB
LDFLAGS_LOCAL   =
CPLUSPLUSLIB    =      
ESMF_LDFLAG     =       $(CPLUSPLUSLIB)
FCOPTIM         =       -O3 -ftree-vectorize -ftree-loop-linear -funroll-loops
FCREDUCEDOPT        =       $(FCOPTIM)
FCNOOPT         =       -O0
FCDEBUG         =       # -g $(FCNOOPT)
FORMAT_FIXED    =       -ffixed-form -cpp
FORMAT_FREE     =       -ffree-form -ffree-line-length-none -cpp
FCSUFFIX        =      
BYTESWAPIO      =       -fconvert=big-endian -frecord-marker=4
FCBASEOPTS_NO_G =       -w $(FORMAT_FREE) $(BYTESWAPIO)
FCBASEOPTS      =       $(FCBASEOPTS_NO_G) $(FCDEBUG)
MODULE_SRCH_FLAG =
TRADFLAG        =      -traditional
CPP             =      /lib/cpp -C -P
AR              =      ar
ARFLAGS         =      ru
M4              =      m4 -B 14000
RANLIB          =      ranlib
CC_TOOLS        =      $(SCC)

###########################################################
######################
# POSTAMBLE

FGREP = fgrep -iq

ARCHFLAGS       =    $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZE) -DRWORDSIZE=$(RWORDSIZE) -DLWORDSIZE=$(LWORDSIZE) \
                     $(ARCH_LOCAL) \
                     $(DA_ARCHFLAGS) \
                      -DDM_PARALLEL \
                       \
                      -DNETCDF \
                       \
                       \
                      -DGRIB2 \
                       \
                       \
                       \
                       \
                       \
                      -DUSE_ALLOCATABLES \
                      -DGRIB1 \
                      -DINTIO \
                      -DLIMIT_ARGS \
                      -DCONFIG_BUF_LEN=$(CONFIG_BUF_LEN) \
                      -DMAX_DOMAINS_F=$(MAX_DOMAINS) \
                      -DMAX_HISTORY=$(MAX_HISTORY) \
                      -DNMM_NEST=$(WRF_NMM_NEST)
CFLAGS          =    $(CFLAGS_LOCAL) -DDM_PARALLEL  \
                      -DMAX_HISTORY=$(MAX_HISTORY)
FCFLAGS         =    $(FCOPTIM) $(FCBASEOPTS)
ESMF_LIB_FLAGS  =   
ESMF_IO_LIB     =    -L$(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 -lesmf_time
ESMF_IO_LIB_EXT =    -L$(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 -lesmf_time
INCLUDE_MODULES =    $(MODULE_SRCH_FLAG) \
                     $(ESMF_MOD_INC) $(ESMF_LIB_FLAGS) \
                      -I$(WRF_SRC_ROOT_DIR)/main \
                      -I$(WRF_SRC_ROOT_DIR)/external/io_netcdf \
                      -I$(WRF_SRC_ROOT_DIR)/external/io_int \
                      -I$(WRF_SRC_ROOT_DIR)/frame \
                      -I$(WRF_SRC_ROOT_DIR)/share \
                      -I$(WRF_SRC_ROOT_DIR)/phys \
                      -I$(WRF_SRC_ROOT_DIR)/chem -I$(WRF_SRC_ROOT_DIR)/inc \
                      -I$(NETCDFPATH)/include \
                     
REGISTRY        =    Registry

LIB_BUNDLED     = \
                      $(WRF_SRC_ROOT_DIR)/external/fftpack/fftpack5/libfftpack.a \
                      $(WRF_SRC_ROOT_DIR)/external/io_grib1/libio_grib1.a \
                      $(WRF_SRC_ROOT_DIR)/external/io_grib_share/libio_grib_share.a \
                      $(WRF_SRC_ROOT_DIR)/external/io_int/libwrfio_int.a \
                      $(ESMF_IO_LIB) \
                      $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a \
                      $(WRF_SRC_ROOT_DIR)/frame/module_internal_header_util.o \
                      $(WRF_SRC_ROOT_DIR)/frame/pack_utils.o

LIB_EXTERNAL    = \
                      -L$(WRF_SRC_ROOT_DIR)/external/io_netcdf -lwrfio_nf -L/home/dongysh/netcdf/lib -lnetcdff -lnetcdf   -L$(WRF_SRC_ROOT_DIR)/external/io_grib2 -lio_grib2 -L/home/dongysh/jasper/lib -ljasper

LIB             =    $(LIB_BUNDLED) $(LIB_EXTERNAL) $(LIB_LOCAL)
LDFLAGS         =    $(OMP) $(FCFLAGS) $(LDFLAGS_LOCAL)
ENVCOMPDEFS     =   
WRF_CHEM        =        0
CPPFLAGS        =    $(ARCHFLAGS) $(ENVCOMPDEFS) -I$(LIBINCLUDE) $(TRADFLAG)
NETCDFPATH      =    /home/dongysh/netcdf
PNETCDFPATH     =   

bundled:  wrf_ioapi_includes wrfio_grib_share wrfio_grib1 wrfio_int esmf_time fftpack
external:  wrfio_nf  wrfio_grib2 $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite $(ESMF_TARGET)

######################
externals: bundled external

gen_comms_serial :
        ( /bin/rm -f $(WRF_SRC_ROOT_DIR)/tools/gen_comms.c )

module_dm_serial :
        ( if [ ! -e module_dm.F ] ; then /bin/cp module_dm_warning module_dm.F ; cat module_dm_stubs.F >> module_dm.F ; fi )

gen_comms_rsllite :
        ( if [ ! -e $(WRF_SRC_ROOT_DIR)/tools/gen_comms.c ] ; then \
          /bin/cp $(WRF_SRC_ROOT_DIR)/tools/gen_comms_warning $(WRF_SRC_ROOT_DIR)/tools/gen_comms.c ; \
          cat $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/gen_comms.c >> $(WRF_SRC_ROOT_DIR)/tools/gen_comms.c ; fi )

module_dm_rsllite :
        ( if [ ! -e module_dm.F ] ; then /bin/cp module_dm_warning module_dm.F ; \
          cat $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/module_dm.F >> module_dm.F ; fi )

wrfio_nf :
        ( cd $(WRF_SRC_ROOT_DIR)/external/io_netcdf ; \
          make NETCDFPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
          CC="$(SCC)" CFLAGS="$(CFLAGS)" \
          FC="$(SFC) $(PROMOTION) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )

wrfio_pnf :
        ( cd $(WRF_SRC_ROOT_DIR)/external/io_pnetcdf ; \
          make NETCDFPATH="$(PNETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP) $(ARCHFLAGS)" \
          FC="$(FC) $(PROMOTION) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )

wrfio_grib_share :
        ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib_share ; \
          make CC="$(SCC)" CFLAGS="$(CFLAGS)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
          FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive)

wrfio_grib1 :
        ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib1 ; \
          make CC="$(SCC)" CFLAGS="$(CFLAGS)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
          FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive)

wrfio_grib2 :
        ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib2 ; \
          make CC="$(SCC)" CFLAGS="$(CFLAGS) -I/home/dongysh/jasper/include" RM="$(RM)" RANLIB="$(RANLIB)" \
          CPP="$(CPP)" \
          FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="-traditional" AR="$(AR)" ARFLAGS="$(ARFLAGS)" \
          FIXED="$(FORMAT_FIXED)" archive)

wrfio_int :
        ( cd $(WRF_SRC_ROOT_DIR)/external/io_int ; \
          make CC="$(CC)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \
          FC="$(SFC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" FGREP="$(FGREP)" \
          TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ARCHFLAGS="$(ARCHFLAGS)" all )

esmf_time :
        ( cd $(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 ; \
          make FC="$(SFC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" RANLIB="$(RANLIB)" \
          CPP="$(CPP) -I$(WRF_SRC_ROOT_DIR)/inc -I. $(ARCHFLAGS) $(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )

fftpack :
        ( cd $(WRF_SRC_ROOT_DIR)/external/fftpack/fftpack5 ; \
          make FC="$(SFC)" FFLAGS="$(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" RANLIB="$(RANLIB)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )

atm_ocn :
        ( cd $(WRF_SRC_ROOT_DIR)/external/atm_ocn ; \
          make CC="$(SCC)" CFLAGS="$(CFLAGS) " RM="$(RM)" RANLIB="$(RANLIB)" \
          CPP="$(CPP)" \
          FC="$(DM_FC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="-traditional" AR="$(AR)" ARFLAGS="$(ARFLAGS)" \
          FIXED="$(FORMAT_FIXED)" )

$(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a :
        ( cd $(WRF_SRC_ROOT_DIR)/external/RSL_LITE ; make CC="$(CC) $(CFLAGS)" \
          FC="$(FC) $(FCFLAGS) $(PROMOTION) $(BYTESWAPIO)" \
          CPP="$(CPP) -I. $(ARCHFLAGS) $(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ;\
          $(RANLIB) $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a )

######################
#        Macros, these should be generic for all machines

LN        =        ln -sf
MAKE        =        make -i -r
RM        =         rm -f


# These sub-directory builds are identical across all architectures

wrf_ioapi_includes :
        ( cd $(WRF_SRC_ROOT_DIR)/external/ioapi_share ; \
          $(MAKE) NATIVE_RWORDSIZE="$(NATIVE_RWORDSIZE)" RWORDSIZE="$(RWORDSIZE)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" )

wrfio_esmf :
        ( cd $(WRF_SRC_ROOT_DIR)/external/io_esmf ; \
          make FC="$(FC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS) $(ESMF_MOD_INC)" \
          RANLIB="$(RANLIB)" CPP="$(CPP) $(POUND_DEF) " AR="$(AR)" ARFLAGS="$(ARFLAGS)" )

#        There is probably no reason to modify these rules

.F.i:
        $(RM) $@
        $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.F > $@
        mv $*.i $(DEVTOP)/pick/$*.f90
        cp $*.F $(DEVTOP)/pick

.F.o:
        $(RM) $@
        $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $(OMPCPP) $*.F  > $*.bb
        $(SED_FTN) $*.bb | $(CPP) > $*.f90
        $(RM) $*.b $*.bb
        @ if echo $(ARCHFLAGS) | $(FGREP) 'DVAR4D'; then \
          echo COMPILING $*.F for 4DVAR ; \
          $(WRF_SRC_ROOT_DIR)/var/build/da_name_space.pl $*.f90 > $*.f90.tmp ; \
          mv $*.f90.tmp $*.f90 ; \
        fi
        if $(FGREP) '!$$OMP' $*.f90 ; then \
          if [ -n "$(OMP)" ] ; then echo COMPILING $*.F WITH OMP ; fi ; \
          $(FC) -o $@ -c $(FCFLAGS) $(OMP) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $*.f90 ; \
        else \
          if [ -n "$(OMP)" ] ; then echo COMPILING $*.F WITHOUT OMP ; fi ; \
          $(FC) -o $@ -c $(FCFLAGS) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $*.f90 ; \
        fi
        

.F.f90:
        $(RM) $@
        $(SED_FTN) $*.F > $*.b
        $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.b  > $@
        $(RM) $*.b

.f90.o:
        $(RM) $@
        $(FC) -o $@ -c $(FCFLAGS) $(PROMOTION) $(FCSUFFIX) $*.f90

setfeenv.o : setfeenv.c
        $(RM) $@
        $(CCOMP) -o $@ -c $(CFLAGS) $(OMPCC) $*.c

.c.o:
        $(RM) $@
        $(CC) -o $@ -c $(CFLAGS) $*.c

# A little more adventurous.  Allow full opt on
# mediation_integrate.o \
# shift_domain_em.o \
# solve_em.o  <-- gets a little kick from SOLVE_EM_SPECIAL too, if defined
# mediation_feedback_domain.o : mediation_feedback_domain.F
# mediation_force_domain.o : mediation_force_domain.F
# mediation_interp_domain.o : mediation_interp_domain.F

# compile these without high optimization to speed compile
convert_nmm.o : convert_nmm.F
init_modules_em.o : init_modules_em.F
input_wrf.o : input_wrf.F
module_io.o : module_io.F
module_comm_dm.o : module_comm_dm.F
module_comm_dm_0.o : module_comm_dm_0.F
module_comm_dm_1.o : module_comm_dm_1.F
module_comm_dm_2.o : module_comm_dm_2.F
module_comm_dm_3.o : module_comm_dm_3.F
module_comm_nesting_dm.o : module_comm_nesting_dm.F
module_configure.o : module_configure.F
module_dm.o : module_dm.F
module_domain.o : module_domain.F
module_domain_type.o : module_domain_type.F
module_alloc_space_0.o : module_alloc_space_0.F
module_alloc_space_1.o : module_alloc_space_1.F
module_alloc_space_2.o : module_alloc_space_2.F
module_alloc_space_3.o : module_alloc_space_3.F
module_alloc_space_4.o : module_alloc_space_4.F
module_alloc_space_5.o : module_alloc_space_5.F
module_alloc_space_6.o : module_alloc_space_6.F
module_alloc_space_7.o : module_alloc_space_7.F
module_alloc_space_8.o : module_alloc_space_8.F
module_alloc_space_9.o : module_alloc_space_9.F
module_tiles.o : module_tiles.F
module_fddaobs_rtfdda.o : module_fddaobs_rtfdda.F
module_initialize.o : module_initialize.F
module_physics_init.o : module_physics_init.F
module_initialize_b_wave.o : module_initialize_b_wave.F
module_initialize_hill2d_x.o : module_initialize_hill2d_x.F
module_initialize_quarter_ss.o : module_initialize_quarter_ss.F
module_initialize_real.o : module_initialize_real.F
module_initialize_real.o: module_initialize_real.F
module_initialize_squall2d_x.o : module_initialize_squall2d_x.F
module_initialize_squall2d_y.o : module_initialize_squall2d_y.F
module_integrate.o : module_integrate.F
module_io_mm5.o : module_io_mm5.F
module_io_wrf.o : module_io_wrf.F
module_si_io.o : module_si_io.F
module_state_description.o : module_state_description.F
output_wrf.o : output_wrf.F
solve_interface.o : solve_interface.F
start_domain.o : start_domain.F
start_domain_nmm.o : start_domain_nmm.F
start_em.o : start_em.F
wrf_bdyin.o : wrf_bdyin.F
wrf_bdyout.o : wrf_bdyout.F
wrf_ext_read_field.o : wrf_ext_read_field.F
wrf_ext_write_field.o : wrf_ext_write_field.F
wrf_fddaobs_in.o : wrf_fddaobs_in.F
wrf_histin.o : wrf_histin.F
wrf_histout.o : wrf_histout.F
wrf_inputin.o : wrf_inputin.F
wrf_inputout.o : wrf_inputout.F
wrf_restartin.o : wrf_restartin.F
wrf_restartout.o : wrf_restartout.F
wrf_tsin.o : wrf_tsin.F
nl_get_0_routines.o : nl_get_0_routines.F
nl_get_1_routines.o : nl_get_1_routines.F
nl_set_0_routines.o : nl_set_0_routines.F
nl_set_1_routines.o : nl_set_1_routines.F

convert_nmm.o \
init_modules_em.o \
module_dm.o \
module_fddaobs_rtfdda.o \
module_initialize.o \
module_initialize_b_wave.o \
module_initialize_hill2d_x.o \
module_initialize_quarter_ss.o \
module_initialize_real.o \
module_initialize_squall2d_x.o \
module_initialize_squall2d_y.o \
module_integrate.o \
module_io_mm5.o \
module_io_wrf.o \
module_si_io.o \
module_tiles.o \
output_wrf.o \
solve_interface.o \
start_domain.o \
start_domain_nmm.o \
shift_domain_nmm.o \
start_em.o \
wrf_fddaobs_in.o \
wrf_tsin.o :
        $(RM) $@
        $(SED_FTN) $*.F > $*.b
        $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $(OMPCPP) $*.b  > $*.f90
        $(RM) $*.b
        @ if echo $(ARCHFLAGS) | $(FGREP) 'DVAR4D'; then \
          echo COMPILING $*.F for 4DVAR ; \
          $(WRF_SRC_ROOT_DIR)/var/build/da_name_space.pl $*.f90 > $*.f90.tmp ; \
          mv $*.f90.tmp $*.f90 ; \
        fi
        if $(FGREP) '!$$OMP' $*.f90 ; then \
          if [ -n "$(OMP)" ] ; then echo COMPILING $*.F WITH OMP ; fi ; \
          $(FC) -c $(PROMOTION) $(FCNOOPT) $(FCBASEOPTS) $(MODULE_DIRS) $(FCSUFFIX) $(OMP) $*.f90 ; \
        else \
          if [ -n "$(OMP)" ] ; then echo COMPILING $*.F WITHOUT OMP ; fi ; \
          $(FC) -c $(PROMOTION) $(FCNOOPT) $(FCBASEOPTS) $(MODULE_DIRS) $(FCSUFFIX) $*.f90 ; \
        fi

#solve_em.o :
#        $(RM) $@
#        $(SED_FTN) $*.F > $*.b
#        $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.b  > $*.f90
#        $(RM) $*.b
#        $(FC) -o $@ -c $(FCFLAGS) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $(SOLVE_EM_SPECIAL) $(OMP) $*.f90

module_sf_ruclsm.o : module_sf_ruclsm.F

module_sf_ruclsm.o :
        $(RM) $@
        $(SED_FTN) $*.F > $*.b
        $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $(OMPCPP) $*.b  > $*.f90
        $(RM) $*.b
        if $(FGREP) '!$$OMP' $*.f90 ; then \
          echo COMPILING $*.F WITH OMP ; \
          if [ -n "$(OMP)" ] ; then echo COMPILING $*.F WITH OMP ; fi ; \
          $(FC) -c $(PROMOTION) $(FCREDUCEDOPT) $(FCBASEOPTS) $(MODULE_DIRS) $(FCSUFFIX) $(OMP) $*.f90 ; \
        else \
          if [ -n "$(OMP)" ] ; then echo COMPILING $*.F WITHOUT OMP ; fi ; \
          $(FC) -c $(PROMOTION) $(FCREDUCEDOPT) $(FCBASEOPTS) $(MODULE_DIRS) $(FCSUFFIX) $*.f90 ; \
        fi

# compile without OMP
input_wrf.o \
module_domain.o \
module_domain_type.o \
module_physics_init.o \
module_io.o \
wrf_bdyin.o \
wrf_bdyout.o \
wrf_ext_read_field.o \
wrf_ext_write_field.o \
wrf_histin.o \
wrf_histout.o \
wrf_inputin.o \
wrf_inputout.o \
wrf_restartin.o \
wrf_restartout.o \
module_state_description.o \
module_alloc_space.o \
module_alloc_space_0.o \
module_alloc_space_1.o \
module_alloc_space_2.o \
module_alloc_space_3.o \
module_alloc_space_4.o \
module_alloc_space_5.o \
module_alloc_space_6.o \
module_alloc_space_7.o \
module_alloc_space_8.o \
module_alloc_space_9.o \
module_comm_dm.o \
module_comm_dm_0.o \
module_comm_dm_1.o \
module_comm_dm_2.o \
module_comm_dm_3.o \
module_comm_nesting_dm.o \
module_configure.o :
        $(RM) $@
        $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $(OMPCPP) $*.F  > $*.bb
        $(SED_FTN) $*.bb | $(CPP) > $*.f90
        @ if echo $(ARCHFLAGS) | $(FGREP) 'DVAR4D'; then \
          echo COMPILING $*.F for 4DVAR ; \
          $(WRF_SRC_ROOT_DIR)/var/build/da_name_space.pl $*.f90 > $*.f90.tmp ; \
          mv $*.f90.tmp $*.f90 ; \
        fi
        $(RM) $*.b $*.bb
        $(FC) -c $(PROMOTION) $(FCSUFFIX) $(FCNOOPT) $(FCBASEOPTS) $(MODULE_DIRS) $*.f90
密码修改失败请联系微信:mofangbao
发表于 2014-4-1 20:22:33 | 显示全部楼层
大概看了一下,lib部分没有问题。
既然是netcdf的问题,那只能先重新安装netcdf试试看了。建议把版本降低。

另外,看到你选择的是dm+sm,你的系统是ubuntu桌面版吧,那应该就是单机使用,选择serial或者sm就好,dm适合于集群。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-4-1 20:37:14 | 显示全部楼层
longlivehj 发表于 2014-4-1 20:22
大概看了一下,lib部分没有问题。
既然是netcdf的问题,那只能先重新安装netcdf试试看了。建议把版本降低 ...

好,降低版本试试。

另外,请教一下要是不降低版本,有没有什么好的解决方法?diffwrf对WRF运行有什么具体的作用么?
密码修改失败请联系微信:mofangbao
发表于 2014-4-1 21:00:04 | 显示全部楼层
本帖最后由 longlivehj 于 2014-4-1 21:01 编辑
dongysh 发表于 2014-4-1 20:37
好,降低版本试试。

另外,请教一下要是不降低版本,有没有什么好的解决方法?diffwrf对WRF运行有什么 ...

既然这个错误被wrf编译过程中忽略,而且最重要的两个exe能够出来,应该对模式运行没有影响。从这个链接来看,diffwrf只是一个小工具罢了。

如果不降低版本,也只能是重新编译并检查netcdf的c库和fortran库。一般只要netcdf安装并配置正确了,后面的wrf编译很容易的。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-4-1 22:18:31 | 显示全部楼层
longlivehj 发表于 2014-4-1 21:00
既然这个错误被wrf编译过程中忽略,而且最重要的两个exe能够出来,应该对模式运行没有影响。从这个链接来 ...

ok,多谢指导!
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表