Skip to content
This repository has been archived by the owner on Jul 25, 2020. It is now read-only.

compiling issue #3

Closed
pc2013 opened this issue Feb 25, 2013 · 5 comments
Closed

compiling issue #3

pc2013 opened this issue Feb 25, 2013 · 5 comments

Comments

@pc2013
Copy link

pc2013 commented Feb 25, 2013

Hello

I am trying to install FaceTracker on Ubuntu 11.10. Following the instructions, the opencv was correctly installed.

When make FaceTracker, I got the following errors:

g++ -MM -MT src/lib/IO.o -MF src/lib/IO.d -Wextra -Wall -pedantic-errors -arch x86_64 -O3 -I/usr/local/include -Iinclude/ src/lib/IO.cc
g++: error: x86_64: No such file or directory
g++: error: unrecognized option ‘-arch’
make: *** [src/lib/IO.o] Error 1

If removing "-arch x86_64", there are many linking errors.

BTW, there seems to be a type in the readme.md file, "OPECV_PATH" may should be "OPENCV_PATH".

Thanks,
Peter
ARCH_FLAGS=-arch x86_64

@paulomuggler
Copy link

It turns out the -arch flag is specific to the Apple-specific version of gcc. The equivalent flag to compile in linux is either -m32 or -m64, depending on your architecture. I got it to compile by editing the Makefile, changing the line "ARCH_FLAGS= -arch x86_64'" to "ARCH_FLAGS=-m64", for 64 bits architecture.

@pc2013
Copy link
Author

pc2013 commented Mar 15, 2013

Thanks for the note. I modified the Makefile, and compiled all the C++ files to .o files. But now when generating bin/FaceTracker, I have a lot linking errors to opencv functions.

My machine runs Ubuntu, and all the opencv library files can be found at /usr/local/lib. I don't know why g++ cannot find and link to them. My opencv sample programs can compile just fine.

Have you tried compiling FaceTracker on Ubuntu ?

Thanks,

@paulomuggler
Copy link

I built it in debian unstable, and I didn't get any other errors while
building besides that. Though I did have a build of OpenCV compiled without
video capture support, so it took me a couple of tries to figure it out and
recompile OpenCV correctly.

In your case, it might be worth a shot recompiling OpenCV including any
additional features that seem related to your missing libraries. I like to
use cmake-gui to make the building process less painful, you can find it in
the ubuntu repos with a search for cmake. Hard to tell more without looking
at your Makefile and the error output from make, though.

cheers,

On Fri, Mar 15, 2013 at 8:20 PM, pc2013 notifications@github.com wrote:

Thanks for the note. I modified the Makefile, and compiled all the C++
files to .o files. But now when generating bin/FaceTracker, I have a lot
linking errors to opencv functions.

My machine runs Ubuntu, and all the opencv library files can be found at
/usr/local/lib. I don't know why g++ cannot find and link to them. My
opencv sample programs can compile just fine.

Have you tried compiling FaceTracker on Ubuntu ?

Thanks,


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-14979878
.

@CptMonac
Copy link

After getting the same problem, some research into this issue revealed that starting from Ubuntu 11.10, libraries must be placed behind objects needing them. For example, g++ pkg-config --cflags opencv easyprog.cpp pkg-config --libs opencv -o easyprog. I also attached the modified Makefile if you would find it useful:

Paths

OPENCV_PATH=/usr/local

Programs

CC=
CXX=g++

Flags

ARCH_FLAGS=-m64
CFLAGS=-Wextra -Wall -pedantic-errors $(ARCH_FLAGS) -O3
LDFLAGS=$(ARCH_FLAGS)
DEFINES=
INCLUDES=-I$(OPENCV_PATH)/include -Iinclude/
#LIBRARIES=-L$(OPENCV_PATH)/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_objdetect
LIBRARIES=pkg-config --libs opencv

Files which require compiling

SOURCE_FILES=
src/lib/IO.cc
src/lib/PDM.cc
src/lib/Patch.cc
src/lib/CLM.cc
src/lib/FDet.cc
src/lib/PAW.cc
src/lib/FCheck.cc
src/lib/Tracker.cc

Source files which contain a int main(..) function

SOURCE_FILES_WITH_MAIN=src/exe/face_tracker.cc

End Configuration

SOURCE_OBJECTS=$(patsubst %.cc,%.o,$(SOURCE_FILES))

ALL_OBJECTS=
$(SOURCE_OBJECTS)
$(patsubst %.cc,%.o,$(SOURCE_FILES_WITH_MAIN))

DEPENDENCY_FILES=
$(patsubst %.o,%.d,$(ALL_OBJECTS))

all: bin/face_tracker

%.o: %.cc Makefile
@# Make dependecy file
$(CXX) -MM -MT $@ -MF $(patsubst %.cc,%.d,$<) $(CFLAGS) $(DEFINES) $(INCLUDES) $<
@# Compile
$(CXX) $(CFLAGS) $(DEFINES) $(INCLUDES) -c -o $@ $<

-include $(DEPENDENCY_FILES)

bin/face_tracker: $(ALL_OBJECTS)
$(CXX) $(LDFLAGS) -o $@ $(ALL_OBJECTS) $(LIBRARIES)

.PHONY: clean
clean:
@echo "Cleaning"
@for pattern in '~' '.o' '*.d' ; do
find . -name "$$pattern" | xargs rm ;
done

@pc2013
Copy link
Author

pc2013 commented Mar 22, 2013

Thanks, I can compile it now.


From: CptMonac notifications@github.com
To: kylemcdonald/FaceTracker FaceTracker@noreply.github.com
Cc: pc2013 pengchang03@yahoo.com
Sent: Tuesday, March 19, 2013 10:59 PM
Subject: Re: [FaceTracker] compiling issue (#3)

After getting the same problem, some research into this issue revealed that starting from Ubuntu 11.10, libraries must be placed behind objects needing them. For example, g++ pkg-config --cflags opencv easyprog.cpp pkg-config --libs opencv -o easyprog. I also attached the modified Makefile if you would find it useful:
Paths
OPENCV_PATH=/usr/local
Programs
CC=
CXX=g++
Flags
ARCH_FLAGS=-m64
CFLAGS=-Wextra -Wall -pedantic-errors $(ARCH_FLAGS) -O3
LDFLAGS=$(ARCH_FLAGS)
DEFINES=
INCLUDES=-I$(OPENCV_PATH)/include -Iinclude/
#LIBRARIES=-L$(OPENCV_PATH)/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_objdetect
LIBRARIES=pkg-config --libs opencv
Files which require compiling
SOURCE_FILES=
src/lib/IO.cc
src/lib/PDM.cc
src/lib/Patch.cc
src/lib/CLM.cc
src/lib/FDet.cc
src/lib/PAW.cc
src/lib/FCheck.cc
src/lib/Tracker.cc
Source files which contain a int main(..) function
SOURCE_FILES_WITH_MAIN=src/exe/face_tracker.cc
End Configuration
SOURCE_OBJECTS=$(patsubst %.cc,%.o,$(SOURCE_FILES))
ALL_OBJECTS=
$(SOURCE_OBJECTS)
$(patsubst %.cc,%.o,$(SOURCE_FILES_WITH_MAIN))
DEPENDENCY_FILES=
$(patsubst %.o,%.d,$(ALL_OBJECTS))
all: bin/face_tracker
%.o: %.cc Makefile
@# Make dependecy file
$(CXX) -MM -MT $@ -MF $(patsubst %.cc,%.d,$<) $(CFLAGS) $(DEFINES) $(INCLUDES) $<
@# Compile
$(CXX) $(CFLAGS) $(DEFINES) $(INCLUDES) -c -o $@ $<
-include $(DEPENDENCY_FILES)
bin/face_tracker: $(ALL_OBJECTS)
$(CXX) $(LDFLAGS) -o $@ $(ALL_OBJECTS) $(LIBRARIES)
.PHONY: clean
clean:
@echo "Cleaning"
@for pattern in '~' '.o' '*.d' ; do
find . -name "$$pattern" | xargs rm ;
done

Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants