Ask Your Question
0

undefined reference to `cvDFT'

asked 2013-03-15 09:41:46 -0500

rgadde gravatar image

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' andcvGetOptimalDFTSize', 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.

edit retag flag offensive close merge delete

Comments

1

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 ?

berak gravatar imageberak ( 2013-03-15 10:10:58 -0500 )edit
1

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!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-15 14:40:30 -0500 )edit

@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.

rgadde gravatar imagergadde ( 2013-03-15 14:42:43 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-03-18 13:01:17 -0500

rgadde gravatar image

updated 2013-03-18 13:10:53 -0500

Got the solution, I am not linking the cxcore, lapack and rt library at the end. Final command should be

arm-linux-g++ sample.o -o sample -L/home/zwang/ravi/opencv_include21/lib -L./ -lLensFinder -L./ -lTwoX -lcxcore -lopencv_lapack -lrt . Thanks for your support @berak and @StevenPuttemans

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-03-15 09:41:46 -0500

Seen: 566 times

Last updated: Mar 18 '13