undefined reference to `cvDFT'
I am working with Opencv-2.1 on arm-linux. I am using arm-linux-g++ compiler. I ran in to a strange error during linking. Before talking about the error, I will post my make commands
CC = arm-linux-g++
COMPILEFLAGS = -Wall -fPIC -c -O2 -I./
OUT_DLL = libLensFinder.so
DLL_FLAGS = -shared -o
OBJS = SegmentRegions.o
OBJS2 = EdgeDetection.o
OBJS3 = AnalyseRegions.o
OBJS4 = global.o
LINK_FLAGS = -L./ -lLensFinder
LINK_FLAGS_2 = -L./ -lTwoX
INCPATH = -I/home/zwang/ravi/opencv_include21/opencv/ -I.
all :
$(CC) $(COMPILEFLAGS) $(INCPATH) global.cpp -o global.o
$(CC) $(COMPILEFLAGS) $(INCPATH) EdgeDetection.cpp -o EdgeDetection.o
$(CC) $(COMPILEFLAGS) $(INCPATH) SegmentRegions.cpp -o SegmentRegions.o
$(CC) $(COMPILEFLAGS) $(INCPATH) AnalyseRegions.cpp -o AnalyseRegions.o
$(CC) $(OBJS) $(OBJS2) $(OBJS3) $(OBJS4) $(DLL_FLAGS) ./$(OUT_DLL) -L/home/zwang/ravi/opencv_include21/lib -lcvaux -lcxcore -lhighgui -lcv -lml -lcxts -lrt
$(CC) $(COMPILEFLAGS) $(INCPATH) sample.cpp
#$(CC) $(LINK_FLAGS) sample.o -o sample
$(CC) $(LINK_FLAGS) $(LINK_FLAGS_2) sample.o -o sample
Everything works fine till the end. During the last command i.e., while creating executable file I am getting the following error.
arm-linux-g++ -L./ -lLensFinder -L./ -lTwoX sample.o -o sample
.//libLensFinder.so: undefined reference to `spotrs_'
.//libLensFinder.so: undefined reference to `cvGetOptimalDFTSize'
.//libLensFinder.so: undefined reference to `dgels_'
.//libLensFinder.so: undefined reference to `dgelsd_'
.//libLensFinder.so: undefined reference to `dgesdd_'
.//libLensFinder.so: undefined reference to `cvMulSpectrums'
.//libLensFinder.so: undefined reference to `sgesdd_'
.//libLensFinder.so: undefined reference to `sgetri_'
.//libLensFinder.so: undefined reference to `cvDFT'
.//libLensFinder.so: undefined reference to `dgesv_'
.//libLensFinder.so: undefined reference to `dgetrf_'
.//libLensFinder.so: undefined reference to `dsyevr_'
.//libLensFinder.so: undefined reference to `sgels_'
.//libLensFinder.so: undefined reference to `spotrf_'
.//libLensFinder.so: undefined reference to `sgetrf_'
.//libLensFinder.so: undefined reference to `dpotrf_'
.//libLensFinder.so: undefined reference to `dpotri_'
.//libLensFinder.so: undefined reference to `sgesv_'
.//libLensFinder.so: undefined reference to `ssyevr_'
.//libLensFinder.so: undefined reference to `dpotrs_'
.//libLensFinder.so: undefined reference to `sgelsd_'
.//libLensFinder.so: undefined reference to `spotri_'
.//libLensFinder.so: undefined reference to `dgetri_'
collect2: ld returned 1 exit status
make: *** [all] Error 1
Two of the undefined references are cvMulSpectrums' and
cvGetOptimalDFTSize', which I guess is due to opencv. And I have no clue on other undefined reference. I think I have linked every library. But still can't understand how to solve this. Any suggestions? FYI, the code is working on visual studio.
bear with me for knowing nothing about arm, but your linker line there looks suspective (like something copied from the 1.0 api).
the offending dft-related opencv functions all live in the opencv_core module. i see you linking something named cxcore, but is it the same ?
Like berak said, you are linking against cxcore, which is only part of what is in opencv_core and what changed during the move from openCV1.x to openCV2.x. Try to adapt this and see what happens!
@berek. It belongs to cxcore module. I am linking to the correct cxcore (I can find a function in cxcore.h with cvMulSpectrums and cvGetOptimalSize etc) . I also found the remaining undefined references belong to opencv too. I think I am missing some options while building libraries. Anymore suggestions please.