Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

undefined symbols problem

karpen
Beginner
888 Views
Hi, I am using Intel Fortran v11.0.67 on a Mac with OS 10.5.8, and gcc version 4.0.1 (Apple Inc. build 5493). I recently installed MPICH with your help (thanks again!) to run a code that requires MPI although it is actually running on a single processor. The makefile for this code is given at the end of this message (sorry but I couldnt figure out how to upload it).

The problem I am having is that the subroutines and modules compile OK, but then I get the following error messages:

Undefined symbols:
"_amr_1blk_guardcell_srl_", referenced from:
_amr_1blk_guardcell_ in mpi_amr_1blk_guardcell.o
_amr_1blk_guardcell_ in mpi_amr_1blk_guardcell.o
"_amr_1blk_cc_prol_gen_work_fun_", referenced from:
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_amr_prolong_ in mpi_amr_prolong.o
"_amr_1blk_cc_prol_gen_unk_fun_", referenced from:
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_amr_prolong_ in mpi_amr_prolong.o
"_amr_1blk_fc_prol_gen_fun_", referenced from:
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_mpi_amr_1blk_guardcell_c_to_f_ in mpi_amr_1blk_guardcell_c_to_f.o
_amr_prolong_ in mpi_amr_prolong.o
_amr_prolong_ in mpi_amr_prolong.o
_amr_prolong_ in mpi_amr_prolong.o
ld: symbol(s) not found

The "undefined symbols" are subroutine names, but the subroutines themselves have been compiled successfully (you can see them listed in the makefile, and I checked the compile output to make sure the object files were created). I found somewhat similar problems in earlier Forum postings, but no answers that were sufficiently general to provide a solution for me. If you could point me in the right direction to determine what is going on, I'd be most grateful!

regards, Judy K
----------------------------makefile below-------------------
# This makefile was designed to compile a users application with
# the amr package on an Intel processor. The amr package is assumed to
# be located in a sub-directory tree rooted at the sub-directory
# specified as AMRDIR below. The amr source files are assumed to
# be in the sub-directory AMRDIR/source and the required header
# files in AMRDIR/headers. The users own application source and
# headers files are assumed to be in the same sub-directory as
# this makefile.


# specify path to amr top directory USER EDIT
AMRDIR = ..

# define the application specific object files required USER EDIT
APP_OBJS= loop_coarse.nosh.o\
area_subs_uniform.nosh.o \
output_soln_area.nosh.o \
read_dump.nosh.o \
dump_for_restart.nosh.o \
nthermal_area.jakrad.nosh.o \
ntrislv.nosh.o \
nadvect_muscl_area.lesh.o \
ninitial_muscl_area.jtknosh.o \
solar_initial.nosh.o \
muscl_lib_area.nosh.o \
ngravity_lookup.nosh.o \
cfd1d_area.nosh.o \
rieman04_area.nosh.o \
amr_bc_block.nosh.o \
amr_1blk_bcset_area.nosh.o \
rheapsort.nosh.o \
amr_test_refinement.nosh.o

# list of modules required by the code
APP_MODULES= \
paramesh_dimensions.o \
paramesh_interfaces.o \
physicaldata.o \
prolong_arrays.o \
timings.o \
tree.o \
workspace.o \
io.o \
constants.o \
paramesh_comm_data.o \
mpi_morton.o \
paramesh_mpi_interfaces.o \
module_constants.o \
module_gravtable.o \
module_loopparams.o \
module_padded_block.o \
module_pointers.o \
accel.o \
storage.o
# module_tracer.o
# module_workspace.o \
# module_amr_shmem.o \
# module_shmem_reduce.o \
# module_physicaldata.o \
# module_tree.o \

# sets the list of object files needed from the amr source - DO NOT ALTER
AMR_OBJS= \
amr_1blk_cc_cp_remote.o \
amr_1blk_cc_prol_gen_unk_fun.o \
amr_1blk_cc_prol_inject.o \
amr_1blk_cc_prol_linear.o \
amr_1blk_cc_prol_genorder.o \
amr_1blk_cc_prol_user.o \
amr_1blk_cc_prol_gen_work_fun.o \
amr_1blk_cc_prol_work_inject.o \
amr_1blk_cc_prol_work_linear.o \
amr_1blk_cc_prol_work_genorder.o \
amr_1blk_cc_prol_work_user.o \
amr_1blk_copy_soln.o \
amr_1blk_ec_cp_remote.o \
amr_1blk_ec_prol_gen_fun.o \
amr_1blk_ec_prol_genorder.o \
amr_1blk_ec_prol_user.o \
amr_1blk_ec_prol_linear.o \
amr_1blk_fc_prol_dbz.o \
clean_field.o \
poisson_sor.o \
amr_1blk_fc_clean_divb.o \
amr_1blk_fc_cp_remote.o \
amr_1blk_fc_prol_gen_fun.o \
amr_1blk_fc_prol_inject.o \
amr_1blk_fc_prol_linear.o \
amr_1blk_fc_prol_genorder.o \
amr_1blk_fc_prol_user.o \
amr_1blk_guardcell_reset.o \
amr_1blk_guardcell_srl.o \
set_f2c_indexes.o \
amr_1blk_nc_cp_remote.o \
amr_1blk_nc_prol_gen_fun.o \
amr_1blk_nc_prol_genorder.o \
amr_1blk_nc_prol_user.o \
amr_1blk_nc_prol_linear.o \
amr_1blk_save_soln.o \
amr_1blk_t_to_perm.o \
amr_1blk_to_perm.o \
amr_bcset_init.o \
amr_block_geometry.o \
user_coord_transfm.o \
amr_close.o \
amr_initialize.o \
amr_set_runtime_parameters.o \
amr_mpi_find_blk_in_buffer.o \
amr_perm_to_1blk.o \
amr_prolong_cc_fun_init.o \
amr_prolong_face_fun_init.o \
amr_prolong_fun_init.o \
amr_reorder_grid.o \
amr_restrict_ec_fun.o \
amr_restrict_ec_genorder.o \
amr_restrict_ec_user.o \
amr_restrict_edge.o \
amr_restrict_fc_fun.o \
amr_restrict_fc_genorder.o \
amr_restrict_fc_user.o \
amr_restrict_red.o \
amr_restrict_unk_fun.o \
amr_restrict_unk_genorder.o \
amr_restrict_unk_user.o \
amr_restrict_nc_fun.o \
amr_restrict_nc_user.o \
amr_restrict_nc_genorder.o \
amr_restrict_work_fun.o \
amr_restrict_work_genorder.o \
amr_restrict_work_user.o \
amr_restrict_work_fun_recip.o \
amr_system_calls.o \
amr_q_sort.o \
amr_q_sort_real.o \
mpi_amr_singular_line.o \
mpi_amr_1blk_guardcell.o \
mpi_amr_1blk_guardcell_c_to_f.o \
mpi_amr_1blk_restrict.o \
mpi_amr_comm_setup.o \
mpi_amr_edge_average.o \
mpi_amr_edge_average_udt.o \
mpi_amr_edge_average_vdt.o \
mpi_amr_edge_diagonal_check.o \
mpi_amr_flux_conserve.o \
mpi_amr_flux_conserve_udt.o \
mpi_amr_flux_conserve_vdt.o \
mpi_amr_get_remote_block.o \
mpi_amr_get_remote_block_fvar.o \
mpi_amr_global_domain_limits.o \
mpi_amr_guardcell.o \
mpi_amr_local_surr_blks_lkup.o \
mpi_amr_prolong.o \
mpi_amr_prolong_fc_divbconsist.o \
mpi_amr_refine_derefine.o \
amr_morton_process.o \
local_tree.o \
find_surrblks.o \
local_tree_build.o \
tree_search_for_surrblks.o \
mpi_amr_restrict.o \
mpi_amr_restrict_fulltree.o \
mpi_amr_restrict_bnd_data_vdt.o \
mpi_amr_restrict_edge_data_vdt.o \
mpi_amr_store_comm_info.o \
mpi_amr_timing_report.o \
mpi_amr_tree_setup.o \
mpi_get_buffer.o \
mpi_get_edge_buffer.o \
mpi_get_flux_buffer.o \
mpi_morton_bnd.o \
process_fetch_list.o \
compress_fetch_list.o \
mpi_morton_bnd_fluxcon.o \
mpi_morton_bnd_prolong.o \
mpi_morton_bnd_restrict.o \
mpi_pack_blocks.o \
mpi_unpack_blocks.o \
mpi_put_buffer.o \
mpi_pack_edges.o \
mpi_pack_fluxes.o \
mpi_put_edge_buffer.o \
mpi_put_edge_buffer_1blk.o \
mpi_put_flux_buffer.o \
mpi_set_message_limits.o \
mpi_set_message_sizes.o \
mpi_unpack_edges.o \
mpi_unpack_fluxes.o \
rationalize_fetch_list.o \
mpi_amr_checkpoint_wr.o \
mpi_amr_checkpoint_re.o \
mpi_amr_checkpoint_wr_default.o \
mpi_amr_checkpoint_re_default.o \
mpi_amr_checkpoint_wr_hdf5.o \
mpi_amr_checkpoint_re_hdf5.o \
mpi_amr_checkpoint_wr_mpiio.o \
mpi_amr_checkpoint_re_mpiio.o \
read_blocks_hdf5_r4.o \
read_blocks_hdf5_r8.o \
write_blocks_hdf5_r4.o \
write_blocks_hdf5_r8.o \
mpi_amr_plotfile_chombo.o \
write_blocks_chombo_r4.o \
write_blocks_chombo_r8.o \
mpi_amr_derefine_blocks.o \
mpi_amr_check_derefine.o \
amr_morton_order.o \
amr_compute_morton.o \
amr_sort_morton.o \
amr_sort_morton_reorder_grid.o \
amr_sort_by_work.o \
amr_migrate_tree_data.o \
fill_old_loc.o \
morton_sort.o \
mpi_amr_redist_blk.o \
send_block_data.o \
mpi_amr_refine_blocks.o \
amr_check_refine.o \
mpi_amr_restrict_bnd_data.o \
mpi_amr_restrict_edge_data.o \
mpi_amr_boundary_block_info.o \
mpi_amr_test_neigh_values.o \
mpi_lib.o \
mpi_pack_tree_info.o \
mpi_unpack_tree_info.o \
mpi_wrapper_int.o \
mpi_wrapper_logical.o \
mpi_wrapper_real.o \
mpi_wrapper_dble.o \
namr_shmem_lib_1proc.o

.SUFFIXES : .F90 .c .F .f .o

.F90.o :
$(FC) $(FFLAGS) -c $<
.F.o :
$(FC) $(FFLAGS) -c $<
.f.o :
$(FC) $(FFLAGS) -c $<
.c.o :
$(CC) $(CFLAGS) -c $<


# Tunable parameters
#
# FC Name of the fortran compiling system to use
# CC Name of C compiler
# LDFLAGS Flags to the loader
# LIBS List of libraries
# CMD Name of the executable
# PROFLIB Library needed for profiling
#--------------------------
# For running on the intel fortran compiler
#FC = ifort
FC = mpif90
CC = mpicc
#----------------------
LIBS =
CMD = condense
PROFLIB =

#for intel fortran compiler.
FFLAGS = -w -fpp1 -axSSSE3 -O3 -pad -align -prefetch -r8 -rdynamic
#for g95 fortran compiler.
#FFLAGS = -O3 -r8 -i4 -fbounds-check -ftrace=full

# for gcc compiler
CFLAGS = -O -I../headers

# USER EDIT

# end test
#----------------------------------------------------------


# Lines from here on down should not need to be changed. They are the
# actual rules which make uses to build the command
#
shmem: $(CMD)

$(CMD): $(APP_MODULES) $(AMR_OBJS) $(APP_OBJS)
$(FC) $(LDFLAGS) -o $(@) $(APP_MODULES) $(APP_OBJS) $(AMR_OBJS) $(LIBS)


$(AMR_OBJS): $(APP_MODULES)
$(APP_OBJS): $(APP_MODULES)

clean:
@rm -f *.o
0 Kudos
6 Replies
karpen
Beginner
888 Views
What am I, chopped liver? ;^> NO answers at all? How disappointing......

0 Kudos
Steven_L_Intel1
Employee
888 Views
I'm not a Mac expert, but perhaps I can try to help. Have you used "nm" to verify that the names not found are in the objects exactly as spelled, complete with trailing underscore?
0 Kudos
karpen
Beginner
888 Views
I'm not a Mac expert, but perhaps I can try to help. Have you used "nm" to verify that the names not found are in the objects exactly as spelled, complete with trailing underscore?

That's the odd part, the missing symbols are subroutines that do not have (and are never referred to with) underscores anywhere in their names. I am stumped because earlier versions of the code (which did not use MPI references) never had this problem. Thanks for responding Steve!
0 Kudos
Steven_L_Intel1
Employee
888 Views

The leading and trailing underscores are normal "decoration" for Fortran routines on Mac OS. Did you use nm to look at the names as I suggested?
0 Kudos
karpen
Beginner
888 Views

The leading and trailing underscores are normal "decoration" for Fortran routines on Mac OS. Did you use nm to look at the names as I suggested?

I just produced a large file of output from nm for all of the object files in my code. I have never used nm before, so I will have to decipher what it does and what it is reporting before I can answer your question. Thanks!
0 Kudos
zuch
Beginner
888 Views
I had the same problem and solved by adding extra line in make file for each library.
Before you link libraries to executable you have to run ranlib -c on them
e.g.ranlib -c libmodules.a

I could not find a way to make it work in Xcode project.

0 Kudos
Reply