Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not compile with opencv3 on Mac at the latest version #3876

Closed
RenfengLiu opened this issue Mar 22, 2016 · 8 comments
Closed

Can not compile with opencv3 on Mac at the latest version #3876

RenfengLiu opened this issue Mar 22, 2016 · 8 comments

Comments

@RenfengLiu
Copy link

In makefile.config, I enabled opencv3

git log
commit be163be0ea5befada208dbf0db29e6fa5811dc86
Merge: 6ed3b2a a53fa51
Author: Evan Shelhamer <shelhamer@imaginarynumber.net>
Date:   Wed Mar 9 12:42:24 2016 -0800
# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3
caffe/$ make
PROTOC src/caffe/proto/caffe.proto
CXX .build_release/src/caffe/proto/caffe.pb.cc
CXX src/caffe/blob.cpp
CXX src/caffe/common.cpp
CXX src/caffe/data_reader.cpp
CXX src/caffe/data_transformer.cpp
src/caffe/data_transformer.cpp:2:10: fatal error: 'opencv2/core/core.hpp' file not found
#include <opencv2/core/core.hpp>
@victorv
Copy link

victorv commented Apr 21, 2016

Have you installed opencv3 with brew install opencv3?

@RenfengLiu
Copy link
Author

Hi, yes, I install opencv3 by the command you mentioned, did you have the same problem?

@victorv
Copy link

victorv commented Apr 25, 2016

No problem here. Can you post your Makefile.config?

@RenfengLiu
Copy link
Author

I cloned the latest caffe, and now it works

@zeyios
Copy link

zeyios commented May 17, 2016

I solved this problem by add opencv path to INCLUDE_DIRS in Makefile.config.

Whatever else you find you need goes here.

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/Cellar/opencv3/3.1.0_3/include

@victorv
Copy link

victorv commented May 17, 2016

On OS X with brew, you really should use :

INCLUDE_DIRS += $(shell brew --prefix)/include
LIBRARY_DIRS += $(shell brew --prefix)/lib

@zhiyishou
Copy link

Like the comment said by @AsiamCn, base on this config, you also need add library direction to LIBRARY_DIR, the full config should be:

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/Cellar/opencv3/3.1.0_3/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/local/Cellar/opencv3/3.1.0_3/lib

@kp421
Copy link

kp421 commented Dec 2, 2019

For me for some reason it only worked if I added opencv4 at the end of INCLUDE_DIRS

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/Cellar/opencv/4.1.2/include/opencv4
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/local/Cellar/opencv/4.1.2/lib

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

No branches or pull requests

5 participants