爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 1604|回复: 0

CMAQ5.2安装问题:在编译icon过程中遇到makefile的问题,请大佬们指导!!

[复制链接]

新浪微博达人勋

发表于 2021-9-28 11:09:41 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 AaronLee 于 2021-9-28 11:12 编辑

请问家园们的各位大佬前辈们一个编译问题,我在编译ICON的过程中遇到问题,如图所示,请大家指导,谢谢~~~(脚本和log如下)
编译所用脚本:
#! /bin/csh -f

# ====================== ICONv5.2 Build Script ====================   
# Usage: bldit_icon.csh >&! bldit.icon.log                                
# Requirements: I/O API & netCDF libs, and a Fortran compiler   
# Note that this script is configured/tested for Red Hat Linux O/S   

# To report problems or request help with this script/program:        
#             http://www.cmascenter.org/html/help.html               
# ===================================================================

#> Set Compiler Identity by User Input: Options -> intel | pgi | gcc
if ( $#argv == 1 ) then
    setenv compiler $argv[1]
    setenv compilerVrsn Empty
else if ( $#argv == 2 ) then
    #> Compiler Name and Version have been provided
    setenv compiler $1
    setenv compilerVrsn $2
else
    echo "usage: $0 <compiler>"
    echo " where <compiler> is intel, pgi or gcc"
    exit(2)
endif

#> Source the config.cmaq file to set the build environment
cd ../../../
source ./config_cmaq.csh

set echo

# =======================================================================
#> Begin User Input Section
# =======================================================================

#> Source Code Locations
set ICON_SRC = ${CMAQ_REPO}/PREP/icon/src #> location of the ICON source code
setenv REPOROOT $ICON_SRC
set Mechs = ${CMAQ_REPO}/CCTM/src/MECHS   #> location of the chemistry mechanism defining files

#> Working directory and Version IDs
set VRSN  = v52                    #> Code Version
set INPT = profile                #> Input data type: profile or m3conc?
set EXEC = ICON_${VRSN}_$INPT.exe  #> executable name for this application
set CFG  = ICON_${VRSN}_$INPT.cfg  #> BLDMAKE configuration file name

#> Controls for managing the source code and MPI compilation
set CompileBLDMAKE                     #> Recompile the BLDMAKE utility from source
                                       #>   comment out to use an existing BLDMAKE executable
set CopySrc                            #> copy the source files into the BLD directory
#set CopySrcTree                       #> copy the source files and directory tree into the build directory
#set Opt = verbose                     #> show requested commands as they are executed
#set MakeFileOnly                      #> uncomment to build a Makefile, but do not compile;

#>==============================================================================
#> ICON Science Modules selection
#> NOTE: For the modules with multiple choices, choose by uncommenting.
#> look in the ICON source code repository or refer to the CMAQ documentation
#> for other possible options. Be careful. Not all options work together.
#>==============================================================================

set ModCommon = common

set ModType   = profile
#set ModType   = m3conc
#set ModType   = tracer

set ModMech   = prof_data/cb05_ae6_aq #> static boundary conditions profiles (see $CMAQ_HOME/PREP/bcon/src/prof_data)

set Mechanism = cb05tucl_ae6_aq/
#set Mechanism = cb05tump_ae6_aq/
#set Mechanism = cb05e51_ae6_aq/
#set Mechanism = cb05mp51_ae6_aq/
#set Mechanism = saprc07tb_ae6_aq/
#set Mechanism = saprc07tc_ae6_aq/
#set Mechanism = saprc07tic_ae6i_aq/
#set Mechanism = racm2_ae6_aq/
set Tracer    = trac0               # default: no tracer species

#>#>#>#>#>#>#>#>#>#>#>#>#>#> End User Input Section #<#<#<#<#<#<#<#<#<#<#<#<#<#
#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#>#<#<#<#<#<#<#<#<#<#<#<#<#<#<#<#<#<#<#<#<#

#> Set full path of Fortran 90 compiler
set FC = ${myFC}
set FP = $FC
setenv BLDER ${CMAQ_HOME}/UTIL/bldmake/bldmake_${compiler}.exe   #> name of model builder executable

#> Set compiler flags
set xLib_Base  = ${CMAQ_LIB}
set xLib_1     = ioapi/Linux2_x86_64
set xLib_2     = ioapi/fixed_src
set xLib_4     = ioapi/Linux2_x86_64
set FSTD       = "${myFSTD}"
set DBG        = "${myDBG}"
set F_FLAGS    = "${myFFLAGS}"
set F90_FLAGS  = "${myFRFLAGS}"
set CPP_FLAGS  = ""
set LINK_FLAGS = "${myLINK_FLAG}"

set LIB1 = "$ioapi_lib"
set LIB2 = "$netcdf_lib $extra_lib"

#============================================================================================
#> Implement User Input
#============================================================================================

#> Check for CMAQ_REPO and CMAQ_LIB settings:
if ( ! -e $CMAQ_REPO || ! -e $CMAQ_LIB ) then
    echo "   $CMAQ_REPO or $CMAQ_LIB directory not found"
    exit 1
endif
echo "    Model repository base path: $CMAQ_REPO"
echo "                  library path: $CMAQ_LIB"

#> If $CMAQ_MODEL is not set, default to $CMAQ_REPO
if ( $?CMAQ_MODEL ) then
    echo "         Model repository path: $CMAQ_MODEL"
else

#> This script was written for Linux hosts only. If
#> the host system is not Linux, produce an error and stop
set BLD_OS = `uname -s`      
if ($BLD_OS != 'Linux') then
    echo "   $BLD_OS -> wrong bldit script for host!"
    exit 1
endif

#> Set and create the "BLD" directory for checking out and compiling
#> source code. Move current directory to that build directory.
set Bld = $CMAQ_HOME/PREP/icon/scripts/BLD_ICON_${VRSN}_${INPT}_${compiler}
if ( ! -e "$Bld" ) then
    mkdir $Bld
else
    if ( ! -d "$Bld" ) then
       echo "   *** target exists, but not a directory ***"
       exit 1
    endif
endif
cd $Bld

if ( $?CopySrc ) then
    /bin/cp -fp $Mechs/$Mechanism/*.nml $Bld
    /bin/cp -fp $Mechs/$Tracer/*.nml $Bld
else
    /bin/ln -s $Mechs/$Mechanism/*.nml $Bld
    /bin/ln -s $Mechs/$Tracer/*.nml $Bld
endif

#> make the config file

set Cfile = ${CFG}.bld
set quote = '"'

echo                                                               > $Cfile
echo "model       $EXEC;"                                         >> $Cfile
echo                                                              >> $Cfile
echo "repo        $ICON_SRC;"                                        >> $Cfile
echo                                                              >> $Cfile
echo "mechanism   $Mechanism;"                                    >> $Cfile
echo                                                              >> $Cfile
echo "lib_base    $xLib_Base;"                                    >> $Cfile
echo                                                              >> $Cfile
echo "lib_1       $xLib_1;"                                       >> $Cfile
echo                                                              >> $Cfile
echo "lib_2       $xLib_2;"                                       >> $Cfile
echo                                                              >> $Cfile
echo "lib_4       $xLib_4;"                                       >> $Cfile
echo                                                              >> $Cfile
set text = "$quote$CPP_FLAGS$quote;"
echo "cpp_flags   $text"                                          >> $Cfile
echo                                                              >> $Cfile
echo "f_compiler  $FC;"                                           >> $Cfile
echo                                                              >> $Cfile
echo "fstd        $quote$FSTD$quote;"                             >> $Cfile
echo                                                              >> $Cfile
echo "dbg         $quote$DBG$quote;"                              >> $Cfile
echo                                                              >> $Cfile
echo "f_flags     $quote$F_FLAGS$quote;"                          >> $Cfile
echo                                                              >> $Cfile
echo "f90_flags   $quote$F90_FLAGS$quote;"                        >> $Cfile
echo                                                              >> $Cfile
echo "link_flags  $quote$LINK_FLAGS$quote;"                       >> $Cfile
echo                                                              >> $Cfile
echo "ioapi       $quote$LIB1$quote;"                             >> $Cfile
echo                                                              >> $Cfile
echo "netcdf      $quote$LIB2$quote;"                             >> $Cfile
echo   

set text="// mechanism:"
echo "$text ${Mechanism}"                                         >> $Cfile
echo "// project repository: ${ICON_SRC}"                         >> $Cfile
echo                                                              >> $Cfile

set text = "common"
echo "// required" $text                                          >> $Cfile
echo "Module ${ModCommon};"                                       >> $Cfile
echo                                                              >> $Cfile

set text = "profile, m3conc, tracer"
echo "// options are" $text                                       >> $Cfile
echo "Module ${ModType};"                                         >> $Cfile
echo                                                              >> $Cfile

set text = "cb05, saprc99, saprc07t"
echo "// options are" $text                                       >> $Cfile
echo "Module ${ModMech};"                                         >> $Cfile
echo                                                              >> $Cfile

if ( $?ModMisc ) then
    echo "Module ${ModMisc};"                                      >> $Cfile
    echo                                                           >> $Cfile
endif

# ============================================================================
#> Create Makefile and Model Executable
# ============================================================================

unalias mv rm

#> Recompile BLDMAKE from source if requested or if it does not exist
if ( $?CompileBLDMAKE || ! -f $BLDER ) then
   cd ${CMAQ_REPO}/UTIL/bldmake/scripts
   ./bldit_bldmake.csh
endif
set Blder = "$BLDER -serial -verbose"

#> Relocate to the BLD_* directory
cd $Bld

#> Run BLDMAKE Utility
if ( $?MakeFileOnly ) then
    if ( $?CopySrc ) then
       $Blder -makefo $Cfile
    else
       $Blder -makefo -git_local $Cfile   # $Cfile = ${CFG}
     # totalview -a $Blder -makefo $Cfile
    endif
else   # also compile the model
    if ( $?CopySrc ) then
       $Blder $Cfile
    else
       $Blder -git_local $Cfile
    endif
endif

#> Rename Makefile to specify compiler option and link back to Makefile
mv Makefile Makefile.$compiler
# if ( -e Makefile.$compiler && -e Makefile ) rm Makefile
ln -s Makefile.$compiler Makefile

if ( $status != 0 ) then
    echo "   *** failure in $Blder ***"
    exit 1
endif

#> Preserve old Config file, if it exists, before moving new one to
#> build directory.
if ( -e "$Bld/${CFG}" ) then
    echo "   >>> previous ${CFG} exists, re-naming to ${CFG}.old <<<"
    unalias mv
    mv $Bld/${CFG} $Bld/${CFG}.old
endif
mv ${CFG}.bld $Bld/${CFG}

exit

log文件:
Compiler is set to gcc
set ICON_SRC = /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src
setenv REPOROOT /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src
set Mechs = /data/lhy/model/CMAQ/CMAQ_REPO/CCTM/src/MECHS
set VRSN = v52
set INPT = profile
set EXEC = ICON_v52_profile.exe
set CFG = ICON_v52_profile.cfg
set CompileBLDMAKE
set CopySrc
set ModCommon = common
set ModType = profile
set ModMech = prof_data/cb05_ae6_aq
set Mechanism = cb05tucl_ae6_aq/
set Tracer = trac0
set FC = /home/lhy/software/mpi/openmpi-16-gnu/bin/mpif90
set FP = /home/lhy/software/mpi/openmpi-16-gnu/bin/mpif90
setenv BLDER /data/lhy/model/CMAQ/CMAQ_REPO/UTIL/bldmake/bldmake_gcc.exe
set xLib_Base = /data/lhy/model/CMAQ/CMAQ_REPO/lib
set xLib_1 = ioapi/Linux2_x86_64
set xLib_2 = ioapi/fixed_src
set xLib_4 = ioapi/Linux2_x86_64
set FSTD = -O3 -funroll-loops -finit-character=32 -Wtabs -Wsurprising
set DBG = -Wall -O0 -g -fcheck=all -ffpe-trap=invalid,zero,overflow -fbacktrace
set F_FLAGS = -ffixed-form -ffixed-line-length-132 -funroll-loops -finit-character=32
set F90_FLAGS = -ffree-form -ffree-line-length-none -funroll-loops -finit-character=32
set CPP_FLAGS =
set LINK_FLAGS = -openmp
set LIB1 = -lioapi
set LIB2 = -lnetcdf -lnetcdff
if ( ! -e /data/lhy/model/CMAQ/CMAQ_REPO || ! -e /data/lhy/model/CMAQ/CMAQ_REPO/lib ) then
echo     Model repository base path: /data/lhy/model/CMAQ/CMAQ_REPO
    Model repository base path: /data/lhy/model/CMAQ/CMAQ_REPO
echo                   library path: /data/lhy/model/CMAQ/CMAQ_REPO/lib
                  library path: /data/lhy/model/CMAQ/CMAQ_REPO/lib
if ( 0 ) then
set BLD_OS = `uname -s`
uname -s
if ( Linux != Linux ) then
set Bld = /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/scripts/BLD_ICON_v52_profile_gcc
if ( ! -e /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/scripts/BLD_ICON_v52_profile_gcc ) then
if ( ! -d /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/scripts/BLD_ICON_v52_profile_gcc ) then
endif
cd /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/scripts/BLD_ICON_v52_profile_gcc
if ( 1 ) then
/bin/cp -fp /data/lhy/model/CMAQ/CMAQ_REPO/CCTM/src/MECHS/cb05tucl_ae6_aq//AE_cb05tucl_ae6_aq.nml /data/lhy/model/CMAQ/CMAQ_REPO/CCTM/src/MECHS/cb05tucl_ae6_aq//GC_cb05tucl_ae6_aq.nml /data/lhy/model/CMAQ/CMAQ_REPO/CCTM/src/MECHS/cb05tucl_ae6_aq//NR_cb05tucl_ae6_aq.nml /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/scripts/BLD_ICON_v52_profile_gcc
/bin/cp -fp /data/lhy/model/CMAQ/CMAQ_REPO/CCTM/src/MECHS/trac0/Species_Table_TR_0.nml /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/scripts/BLD_ICON_v52_profile_gcc
else
set Cfile = ICON_v52_profile.cfg.bld
set quote = "
echo
echo model       ICON_v52_profile.exe;
echo
echo repo        /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src;
echo
echo mechanism   cb05tucl_ae6_aq/;
echo
echo lib_base    /data/lhy/model/CMAQ/CMAQ_REPO/lib;
echo
echo lib_1       ioapi/Linux2_x86_64;
echo
echo lib_2       ioapi/fixed_src;
echo
echo lib_4       ioapi/Linux2_x86_64;
echo
set text = "";
echo cpp_flags   "";
echo
echo f_compiler  /home/lhy/software/mpi/openmpi-16-gnu/bin/mpif90;
echo
echo fstd        "-O3 -funroll-loops -finit-character=32 -Wtabs -Wsurprising";
echo
echo dbg         "-Wall -O0 -g -fcheck=all -ffpe-trap=invalid,zero,overflow -fbacktrace";
echo
echo f_flags     "-ffixed-form -ffixed-line-length-132 -funroll-loops -finit-character=32";
echo
echo f90_flags   "-ffree-form -ffree-line-length-none -funroll-loops -finit-character=32";
echo
echo link_flags  "-openmp";
echo
echo ioapi       "-lioapi";
echo
echo netcdf      "-lnetcdf -lnetcdff ";
echo


set text=// mechanism:
echo // mechanism: cb05tucl_ae6_aq/
echo // project repository: /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src
echo
set text = common
echo // required common
echo Module common;
echo
set text = profile, m3conc, tracer
echo // options are profile, m3conc, tracer
echo Module profile;
echo
set text = cb05, saprc99, saprc07t
echo // options are cb05, saprc99, saprc07t
echo Module prof_data/cb05_ae6_aq;
echo
if ( 0 ) then
unalias mv rm
if ( 1 || ! -f /data/lhy/model/CMAQ/CMAQ_REPO/UTIL/bldmake/bldmake_gcc.exe ) then
cd /data/lhy/model/CMAQ/CMAQ_REPO/UTIL/bldmake/scripts
./bldit_bldmake.csh
endif
set Blder = /data/lhy/model/CMAQ/CMAQ_REPO/UTIL/bldmake/bldmake_gcc.exe -serial -verbose
cd /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/scripts/BLD_ICON_v52_profile_gcc
if ( 0 ) then
if ( 1 ) then
/data/lhy/model/CMAQ/CMAQ_REPO/UTIL/bldmake/bldmake_gcc.exe -serial -verbose ICON_v52_profile.cfg.bld
REPOROOT set to:/data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src


Model set to ICON_v52_profile.exe
Repository set to /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src
Mechanism set to cb05tucl_ae6_aq/
LIB_BASE set to /data/lhy/model/CMAQ/CMAQ_REPO/lib
LIB_1 set to ioapi/Linux2_x86_64
LIB_2 set to ioapi/fixed_src
LIB_4 set to ioapi/Linux2_x86_64
CPP_FLAGS set to
F_COMPILER set to /home/lhy/software/mpi/openmpi-16-gnu/bin/mpif90
FSTD set to -O3 -funroll-loops -finit-character=32 -Wtabs -Wsurprising
DBG set to -Wall -O0 -g -fcheck=all -ffpe-trap=invalid,zero,overflow -fbacktrace
f_flags set to -ffixed-form -ffixed-line-length-132 -funroll-loops -finit-character=32
f90_flags set to -ffree-form -ffree-line-length-none -funroll-loops -finit-character=32
LINK_FLAGS set to -openmp
IOAPI set to -lioapi
NETCDF set to -lnetcdf -lnetcdff




Building file list for module common
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/CGRID_SPCS.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/findex.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/gc_spc_map.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/get_envlist.f added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/HGRD_DEFN.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/icon.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/IC_PARMS.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/lat_lon.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/lr_interp.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/lst_spc_map.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/ngc_spc_map.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/opn_ic_file.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/setup_logdev.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/subhdomain.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/UTILIO_DEFN.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/common/VGRD_DEFN.F added to make list




Building file list for module profile
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/profile/prof_driver.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/profile/prof_icout.F added to make list
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/profile/prof_vinterp.F added to make list




Building file list for module prof_data/cb05_ae6_aq
  file /data/lhy/model/CMAQ/CMAQ_REPO/PREP/icon/src/prof_data/cb05_ae6_aq/ic_profile_CB05.dat added to make list


Determining global module files
  file CGRID_SPCS.F determined to be global
  file HGRD_DEFN.F determined to be global
  file IC_PARMS.F determined to be global
  file UTILIO_DEFN.F determined to be global
  file VGRD_DEFN.F determined to be global


*** Program terminated on Error ***


     Cannot create FILE [Makefile]




else
endif
mv Makefile Makefile.gcc
mv: failed to access "Makefile.gcc": 符号连接的层数过多
ln -s Makefile.gcc Makefile
ln: failed to access "Makefile": 符号连接的层数过多
if ( 1 != 0 ) then
echo    *** failure in /data/lhy/model/CMAQ/CMAQ_REPO/UTIL/bldmake/bldmake_gcc.exe -serial -verbose ***
   *** failure in /data/lhy/model/CMAQ/CMAQ_REPO/UTIL/bldmake/bldmake_gcc.exe -serial -verbose ***
exit 1








WechatIMG502.jpeg
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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