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

dfference between ifc and ifort

Sukru_Besiktepe
Beginner
2,035 Views
I have a code that I compile on Linux with ifc V7.1. Just got a Mac and ifort12.1.2.269 and now trying to compile the same programs with makefile on the new machine. These programs also link to netcdf library. I get the following error

Undefined symbols:
"_set_edges_", referenced from:
_step_ in step.o
_step_ in step.o
"_press_bias_", referenced from:
_clinic_ in clinic.o
ld: symbol(s) not found
in linux with ifc I use following options: ifc -w -L/opt/intel -lc-2.2.93 -u -O3


on Mac I use only ifort without any compiler flags.

Thanks
0 Kudos
10 Replies
Sukru_Besiktepe
Beginner
2,036 Views
I would like to add one more thing. I now tried to compile with gfortran together with netcdf libraries build for gfortran and I got the same errors.
Any idea will be appreciated.
Sukru
0 Kudos
mecej4
Honored Contributor III
2,036 Views
It is not feasible to reply until you provide the makefile, or at least those lines from the makefile that show the command used for linking. After all, you have a link-time error.

Simply saying that the makefile worked on an Machine-A and does not on Machine-B is not enough. We were not standing next to you to observe what worked and what did not.
0 Kudos
Sukru_Besiktepe
Beginner
2,036 Views
I dd not want to create mess in the forum with bunch of files. But you are right. Here is the my Makefilefile. Editor does not allow to send more that I sent. Thats why I sent only the part I play with.


NETCDF_ROOT=/Users/mac/Software/intel64/netcdf-3.6.3
SRCDIR =/Users/mac/izmir/HOPS/PE/Src
PARAMDIR = ./
NCDIR =$(NETCDF_ROOT)/include
BINDIR =/Users/mac/Bin
BIN = pe_krfz_PBI
CPPFLAGS = -Ddblsigma -Drmdenbar -Dcubspl -Dvbart \
-Dunesco -Dppvmix -Dshapiro -Dsecondmean -Dvel_conv -Drmdocinc \
-Dcoast -Dresetjulian -Dpressbias -Dshapmean -Dbotfrc -Dcstfrc \
-Dpressinbias
FFLAGS =
#************************************************************************
#******************** End of USER's tunable macros **********************
#************************************************************************
#------------------------------------------------------------------------
#-------- Define string macro to parse C Pre-Processing Flags. ----------
##------------------------------------------------------------------------
find_flag = $(findstring $(flag),$(CPPFLAGS))
#------------------------------------------------------------------------
#--------------------- Internal macro definitions. ----------------------
#------------------------------------------------------------------------
RMBLKLINES = rmblklines
SHELL = /bin/sh
RM = rm -f
ECHO = echo
FALSE = false
LIB = -L$(NETCDF_ROOT)/lib -lnetcdff -lnetcdf
CPP = cpp -P -traditional-cpp -I. -I$(PARAMDIR) -I$(SRCDIR) -I$(NCDIR)
FC = ifort
wk_flags := nest2larger nest2smaller
ifneq (,$(strip $(foreach flag,$(wk_flags),$(find_flag))))
CPP := $(CPP) -I$(PVM_ROOT)/include
LIB := $(LIB) -L$(PVM_ROOT)/lib/$(PVM_ARCH) -lfpvm3 -lpvm3 -lsocket
endif
LIB := $(LIB)
#------------------------------------------------------------------------
#---------------- Look for bad C Pre-Processing Flags. ------------------
#------------------------------------------------------------------------
VALID_CPP_OPT = -Dadd_tide -Dadvtide -Dadvtide0 -Daixdate -Danalytical \
-DAsselinFilt -DAsselinFilt_cod -Dbarotropic -DbioAnder \
-DbioDuse -DbioFasham -DbioMcGillic -Dbio_12_A -Dbioadjloc \
-Dbioadjvert -Dbndy_rlx -Dbotfrc -Dbottom -Dclose_tracers \
-Dcoast -Dcoastedge -Dcod_ing -Dcod_square -Dcodlim -Dcodunlim \
-Dcodvadvect -Dcodvmix -Dcraydate -Dcstfrc -Dcubspl -Dcyclic \
-Ddblprec -Ddblsigma -Ddecdate -DdusDroop -Dexplicitvmix \
-Dext_tide -Dextraction -Dfcsterr -Dforcing -Dfrozentrc \
-Dgendbg -Dgridold -Dgrids -Dhpg4 -Dimp_bnd_rlx -Dislands \
-Dldrifters -Dleqstate -Dlinear_physics -Dmixtide \
-Dnest_ext2lrgr -Dnest_ext2smlr -Dnest2larger -Dnest2smaller \
-Dnestnultest -Dnesttime -Dnkfix -Dnocfl -Dnotadvm \
-Dnotadvt -Dnowcfl -Dnoxtrp -Doias -Dpeprf -Dpindex -Dposmxtid \
-Dppvmix -Dpressbias -Dpressinbias -Dpttrcsrc -Dresetjulian \
-Drivsrc -Drmcomments -Drmdenbar -Drmdocinc -Dsecondmean \
-Dshapiro -Dshapmean -Dshapnocoastflux -Dsimpramp -Dsor5pt \
-Dsundate -Dsunflush -Dsunfpe -Dtide_zero -Dunesco \
-Dusrdiagnostic -Dvbart -Dvel_conv -Dwgterr -Dzoo_ing
INVALID_CPP_OPT = $(strip $(filter-out $(VALID_CPP_OPT),$(CPPFLAGS)))
#------------------------------------------------------------------------
#--------------------- Redefine compiling macros. -----------------------
#------------------------------------------------------------------------
MAKEFLAGS := -r -$(MAKEFLAGS)
.SUFFIXES:
.SUFFIXES: .o .f .F .FF
%.o: %.f
-$(FC) -c $(FFLAGS) -o $*.o $*.f
%.o: %.F
%.o: %.FF
%.f: %.F
-$(CPP) $(CPPFLAGS) $< ./$*.cpp
-./$(RMBLKLINES) < $*.cpp > $*.f
-$(RM) $*.cpp
%.f: %.FF
-$(CPP) $(CPPFLAGS) $< ./$*.f
#------------------------------------------------------------------------
#-------------- Define alternate paths for source codes. ----------------
#------------------------------------------------------------------------
#--------------------------
#--- Define source path ---
#--------------------------
testpath = .
pathstr =
ifeq (,$(strip $(filter $(SRCDIR),$(subst :, ,$(testpath)))))
testpath := $(testpath):$(SRCDIR)
pathstr := $(SRCDIR)
endif
ifneq (,$(pathstr))
vpath %.F $(pathstr)
vpath %.FF $(pathstr)
endif
#---------------------------
#--- Define include path ---
#---------------------------
ifeq (,$(strip $(filter $(PARAMDIR),$(subst :, ,$(testpath)))))
testpath := $(PARAMDIR):$(testpath)
ifneq (,$(pathstr))
pathstr := $(PARAMDIR):$(pathstr)
else
pathstr := $(PARAMDIR)
endif
endif
ifeq (,$(strip $(filter $(NCDIR),$(subst :, ,$(testpath)))))
testpath := $(testpath):$(NCDIR)
ifneq (,$(pathstr))
pathstr := $(pathstr):$(NCDIR)
else
pathstr := $(NCDIR)
endif
endif
wk_flags := nest2larger nest2smaller
ifneq (,$(strip $(foreach flag,$(wk_flags),$(find_flag))))
ifeq (,$(strip $(filter $(PVM_ROOT)/include,$(subst :, ,$(testpath)))))
testpath := $(pathstr):$(PVM_ROOT)/include
ifneq (,$(pathstr))
pathstr := $(pathstr):$(PVM_ROOT)/include
else
pathstr := $(PVM_ROOT)/include
endif
endif
endif
ifneq (,$(pathstr))
vpath %.h $(pathstr)
vpath %.inc $(pathstr)
endif
#------------------------------------------------------------------------
#------- Preserve intermediate source codes only when debugging. --------
#------------------------------------------------------------------------
dbg_flags = sunfpe gendbg
ifneq (,$(strip $(foreach flag,$(dbg_flags),$(find_flag))))
.PRECIOUS: %.f
endif
#------------------------------------------------------------------------
#--- Declare "phony" targets. GNUmake can always run these targets. ----
#------------------------------------------------------------------------
ifeq (,$(INVALID_CPP_OPT))
.PHONY: clean
else
.PHONY: clean $(BIN)
endif
0 Kudos
mecej4
Honored Contributor III
2,036 Views
The missing externals, _set_edges_ and _press_bias_, are not part of NetCDF or HDF5.

Are they routines that are in your source files, or in user libraries that you forgot to include in the list of libraries to search?
0 Kudos
Sukru_Besiktepe
Beginner
2,036 Views
They are routines as part of my source fies. Actually this is the ocean model which consists of several fortran files. According to different requirements I configure the model with C-preprocessor options. Normally model works with all cases excep when I used one specific configuration which includes press_bias0.F. But error shows up in other subroutines (press_bias.F and set_edges.F). I tried diffent options if compiler did not like the underscores etc. Now, I am wondering if the order of linking object files are importnt or not?
0 Kudos
mecej4
Honored Contributor III
2,036 Views
Now, I am wondering if the order of linking object files are importnt or not?

The order in which .o files are listed should not matter. If, however, these files are in a library file, the order of the library files on the command line does matter.

Have you tried

nm press_bias0.o | grep -i press_bias

yet? That is sure to show up mismatches in underscores or case.
0 Kudos
Sukru_Besiktepe
Beginner
2,036 Views
nm press_bias0.o | grep -i press_bias gives
0000000000000000 T _press_bias0_
0000000000000640 d _press_bias0_$FIRST.0.1
000000000000da40 b _press_bias0_$PBID.0.1
000000000000da44 b _press_bias0_$SHID.0.1
0000000000000840 b _press_bias0_$TP2.0.1
00000000000006f0 S _press_bias0_.eh
00000000000005e0 d press_bias0_$format_pack.0.1
when I tried
nm clinic.o | grep -i press_bias which compilation was giving an error
Undefined symbols:
.
.
.
"_press_bias_", referenced from:
_clinic_ in clinic.o
it gives
U _press_bias_
0 Kudos
mecej4
Honored Contributor III
2,036 Views
0000000000000000 T _press_bias0_

is the important output. It shows that there is a routine press_bias0 that can be called, rather than the expected press_bias. Check the other routine name similarly.

Check the subroutine names at the calling point as well as where they are declared.
0 Kudos
Sukru_Besiktepe
Beginner
2,036 Views
I guess I fiexd the problem. After cheking subroutine names at the calling points as you suggested, I found very strange problem. When I list the directory I can not see the clinic.f. But when I gave the command ls clinic.f it shows up. clinic.f was remained from previous configuration which uses press_bias. But in the new configuration I need press_bias0. When I gave rm clinic.f command, I was able to remove clinic.f. Then, I recompiled the program and it works now.
I do not know if I explained clearly, but this is really strange and dangereous and it may be due to the MAC file system.
Thanks for all your help.
0 Kudos
mecej4
Honored Contributor III
2,036 Views
I understand. Such thing happen regularly. GUIs are nice for end users, but they create some problems such as this when used for program development.
0 Kudos
Reply