Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Undefined references when building from Makefile

$
0
0

I'm in the process of porting an application from Windows over to Linux, and have written my Makefile as follows:

INTEL_LIBS=/opt/intel/composer_xe_2013_sp1/lib/intel64
MKLROOT=/opt/intel/composer_xe_2013_sp1.3.174/mkl
SRC_PATH = ../FortranSource
SOURCES_OBJ = $(OBJECT_FOLDER)/BLAS.o \
              #... and many others
DEBUG_FLAGS =   -g -debug parallel -debug-parameters all -warn declarations  \
                -auto -traceback -check pointer -check bounds -check uninit -check format -check output_conversion
IFORT_FLAGS =   $(DEBUG_FLAGS) -nologo -fpp  -DUSE_MKL -recursive -reentrancy threaded -openmp -align rec8byte \
                -threads -fp-model source -fp-model except -c -I $(MKLROOT)/include/intel64/lp64 -I $(MKLROOT)/include
DBG_LIBS = -lirc -lsvml -limf $(TARGETFOLDER)/libintlc.so.5 $(TARGETFOLDER)/nCutilsd.so

LINKLIBS = $(MKLROOT)/lib/intel64/libmkl_blas95_lp64.a $(MKLROOT)/lib/intel64/libmkl_lapack95_lp64.a \
       --start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a \
                     $(MKLROOT)/lib/intel64/libmkl_sequential.a --end-group -lpthread -lm $(DBG_LIBS)
LINKFLAGS =  $(DBG_FLAGS)
LINKLIBS_PATH = -L $(INTEL_LIBS)

F90 = /opt/intel/bin/ifort
LINK_CMD=/opt/intel/bin/xild
OBJECT_FOLDER = Debug
TARGETFOLDER = ../../Builds
TARGETNAME = nCored

$(OBJECT_FOLDER)/%.o : $(SRC_PATH)/%.f90
	$(F90) $< $(IFORT_FLAGS) -I $(MKLROOT)/include -I $(MKLROOT)/include/intel64/lp64 -o $@ -module $(OBJECT_FOLDER)

$(OBJECT_FOLDER)/%.o : $(SRC_PATH)/%.F90
	$(F90) $< $(IFORT_FLAGS) -I $(MKLROOT)/include -I $(MKLROOT)/include/intel64/lp64 -o $@ -module $(OBJECT_FOLDER)

.PHONY: all clean

all: $(OBJECT_FOLDER)
	$(MAKE) $(TARGETFOLDER)/nCored.so

$(OBJECT_FOLDER) :
	mkdir -p $(OBJECT_FOLDER)

clean:
	rm -rf Debug
	cd $(TARGETFOLDER) && rm -rf $(TARGETNAME).so

$(TARGETFOLDER)/nCored.so : $(OBJECT_FOLDER)/nCore.o
	$(LINK_CMD)  -o $@ $(SOURCES_OBJ) $(DBGLIBS) $(LINKLIBS) $(LINKLIBS_PATH)

# The makefile ends with a long table of dependencies between my various modules...

When I try to build, all of my object files and module files build as expected, but during the link step I get literally thousands of error messages which are all of the pattern:

/home/Eos/Development/Makefiles/../FortranSource/Cal_Fitting.f90:666: undefined reference to `for__rtc_uninit_use'

...where the reference can be many different things. It seems self-evident that I've missed out some reference to the compiler's own libraries or that there is a path which is not defined, but I cannot find any ideas from the documentation for what this may be. Running:

/opt/intel/bin/ifortvars.sh intel64

...from the command line before typing 'make' doesn't seem to help, nor indeed does inserting the same line into the makefile itself on the line before $(LINK_CMD) - even though when I do the latter, the output from 'make' shows that the shell script is indeed being run. 

So, please may I have some advice about what it is that I've missed out?

 


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>