我正在尝试使用 GNU 编译器编译大代码。但是,当我尝试使用 GNU Fortran (GCC) 6.1.0 编译附加的代码时,一些使用 type 的例程会fn_grid_nodes_t
抛出此错误消息:
@bld .. 链接,... 架构 x86_64 的未定义符号:
“___final_fn_core_grids_dts_Fn_grid_nodes_t.3665”,引用自:___fn_depot_utils_MOD_fn_clean_depot in fn_depot_utils.o
注意使用 Intel 编译器 > 15.0,编译成功。我怀疑这是由于 GNU 和英特尔如何处理最终确定。
有没有人对此有任何建议/解决方法?
type :: fn_grid_nodes_t
! mpi communicator
type(fmpi_fcomm_t) :: fcomm
! grid description
type(fn_grid_descrp_t) :: grid_descrp
! grid partition description
type(fn_parts_descrp_t) :: parts_descrp
! node hdr plan
type(fn_node_hdr_plan_t) :: node_hdr_plan
! node elem plan
type(fn_node_elem_plan_t) :: node_elem_plan
! exchanger
type(fn_exchr_t) :: exchr_nghb
! active node count
integer(kp_i) :: active_ncnt = -1_kp_i
! dynamic node array
type(fn_node_t),allocatable :: nodes(:)
! auxiliary
real(kp_r),allocatable :: aux_block(:,:,:,:)
end type fn_grid_nodes_t
感谢您的回答 - 一些额外的细节:
- 操作系统 = MacOS Sierra 10.12.1
- 编译:生成文件
- 标志:-g -Wall -Wextra -fbacktrace -fbounds-check -fcheck-array-temporaries
- 优化:-O2
模块编译示例:
# FORCE DEPENDECY BETWEEN MODULE AND OBJECT FILES:
$(INCLUDE_DIR)/fn_core_grids_dts.mod \
: $(OBJ_DIR)/fn_core_grids_dts.o
@printf "$(MK_DECOR_BLD) .. build assumed, <$(MK_COLOR_PURPLE)$@$(MK_COLOR_NORMAL)> <-- <$(MK_COLOR_PURPLE)$<$(MK_COLOR_NORMAL)> ... "
@set -e; \
$(MK_COLOR_CMD_SET_RED); \
_tic=$$($(DATE_EPOCH_SEC)); \
$(TOUCH) $@; \
_toc=$$($(DATE_EPOCH_SEC)); \
$(MK_COLOR_CMD_SET_NORMAL); \
printf "[$(MK_COLOR_BLUE)%3.3ds$(MK_COLOR_NORMAL)]" $$(( $$_toc - $$_tic ))
@printf "$(MK_DECOR_OK)\n"
# COMPILE MODULE:
$(OBJ_DIR)/fn_core_grids_dts.o \
: .concoct/fnode-3d/drv/./src/core/grids/write_fn_core_grids_dts/fn_core_grids_dts.f90 \
$(INCLUDE_DIR)/fn_core_nodes_dts.mod \
$(INCLUDE_DIR)/fn_infix_fmpi.mod \
$(INCLUDE_DIR)/fn_core_grids_common.mod \
$(INCLUDE_DIR)/fn_core_exchangers_dts.mod
@printf "$(MK_DECOR_BLD) .. compiling <$(MK_COLOR_YELLOW)$@$(MK_COLOR_NORMAL)> ... "
@set -e; \
$(MK_COLOR_CMD_SET_RED); \
_tic=$$($(DATE_EPOCH_SEC)); \
$(MKDIRP) $(OBJ_DIR) $(INCLUDE_DIR); \
$(FC) -c $< -o $@ $(FCFLAGS) $(FCFT_DIRSRCH_MOD) $(INCLUDE_DIR) $(addprefix $(FCFT_DIRSRCH_INCLUDE),$(wildcard $(IDIRS) $(PREPROC_DIR))); \
$(TOUCH) $@; \
_toc=$$($(DATE_EPOCH_SEC)); \
$(MK_COLOR_CMD_SET_NORMAL); \
printf "[$(MK_COLOR_BLUE)%3.3ds$(MK_COLOR_NORMAL)]" $$(( $$_toc - $$_tic ))
@printf "$(MK_DECOR_OK)\n"
导致问题的makefile部分:
# FORCE DEPENDECY BETWEEN MODULE AND OBJECT FILES:
$(INCLUDE_DIR)/fn_depot_utils.mod \
: $(OBJ_DIR)/fn_depot_utils.o
@printf "$(MK_DECOR_BLD) .. build assumed, <$(MK_COLOR_PURPLE)$@$(MK_COLOR_NORMAL)> <-- <$(MK_COLOR_PURPLE)$<$(MK_COLOR_NORMAL)> ... "
@set -e; \
$(MK_COLOR_CMD_SET_RED); \
_tic=$$($(DATE_EPOCH_SEC)); \
$(TOUCH) $@; \
_toc=$$($(DATE_EPOCH_SEC)); \
$(MK_COLOR_CMD_SET_NORMAL); \
printf "[$(MK_COLOR_BLUE)%3.3ds$(MK_COLOR_NORMAL)]" $$(( $$_toc - $$_tic ))
@printf "$(MK_DECOR_OK)\n"
# COMPILE MODULE:
$(OBJ_DIR)/fn_depot_utils.o \
: .concoct/fnode-3d/drv/./src/depot/write_fn_depot_utils/fn_depot_utils.f90 \
$(INCLUDE_DIR)/fn_depot_common.mod \
$(INCLUDE_DIR)/fn_depot_share.mod
@printf "$(MK_DECOR_BLD) .. compiling <$(MK_COLOR_YELLOW)$@$(MK_COLOR_NORMAL)> ... "
@set -e; \
$(MK_COLOR_CMD_SET_RED); \
_tic=$$($(DATE_EPOCH_SEC)); \
$(MKDIRP) $(OBJ_DIR) $(INCLUDE_DIR); \
$(FC) -c $< -o $@ $(FCFLAGS) $(FCFT_DIRSRCH_MOD) $(INCLUDE_DIR) $(addprefix $(FCFT_DIRSRCH_INCLUDE),$(wildcard $(IDIRS) $(PREPROC_DIR))); \
$(TOUCH) $@; \
_toc=$$($(DATE_EPOCH_SEC)); \
$(MK_COLOR_CMD_SET_NORMAL); \
printf "[$(MK_COLOR_BLUE)%3.3ds$(MK_COLOR_NORMAL)]" $$(( $$_toc - $$_tic ))
@printf "$(MK_DECOR_OK)\n"
请注意,fn_depot_common.mod 包含模块 fn_core_grids_dts。这绝对不是与缺少的模块相关的问题,而没有包含在需要的地方。