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

Opencv 4.1: different pkg-config library name #3479

Closed
pliablepixels opened this issue Jun 23, 2019 · 6 comments
Closed

Opencv 4.1: different pkg-config library name #3479

pliablepixels opened this issue Jun 23, 2019 · 6 comments

Comments

@pliablepixels
Copy link

pliablepixels commented Jun 23, 2019

OpenCV 4.1 (not sure of earlier versions) seems to use opencv4 instead of opencv for pkg-config (assuming you used -D OPENCV_GENERATE_PKGCONFIG=ON)

Thanks for your fork. It works wonderfully with OpenCV 4.1 and CUDA 10.1

@AlexeyAB
Copy link
Owner

@pliablepixels Hi, thanks!

Do you think we should use both opencv and opencv4 for supporting both OpenCV 4.x and OpenCV3.x/2.x?

I.e. use

LDFLAGS+= `pkg-config --libs opencv`
COMMON+= `pkg-config --cflags opencv`
LDFLAGS+= `pkg-config --libs opencv4`
COMMON+= `pkg-config --cflags opencv4`

instead of:

darknet/Makefile

Lines 79 to 80 in 5ec3592

LDFLAGS+= `pkg-config --libs opencv`
COMMON+= `pkg-config --cflags opencv`

@AlexeyAB
Copy link
Owner

@cenit Hi, what do you think about this?

@pliablepixels
Copy link
Author

pliablepixels commented Jun 23, 2019

I agree, I actually did something like

 OPENCVPKG=`pkg-config --libs opencv || pkg-config --libs opencv4`

I did not PR, because I did not investigate if pkg-config allows alias names etc. which is cleaner if it exists.

@cenit
Copy link
Collaborator

cenit commented Jun 24, 2019

The problem here is only for the makefile. Unfortunately I think it’s not as easy as you say, because if you have both installed then you risk a mess. Autotools usually come to the rescue here, but I’d say it is an overkill.
First of all, i’d revert your common and ldflag order, so to have opencv4 appear first on the build line wrt opencv. Second, includes and linked files might even be ok since the first should resolve everything, but what about defines? You’d have defines for both version active on the same command line. You should test it thoroughly in a specific corner case maybe before pushing it. I think having both is becoming a little bit too common

@AlexeyAB AlexeyAB added question want enhancement Want to improve accuracy, speed or functionality labels Jun 24, 2019
@SalahAdDin
Copy link

pjreddie#1348 This is a try to add supporting OpenCV 4.

@cenit
Copy link
Collaborator

cenit commented Feb 26, 2020

close thanks to #4896 fixing makefile also for OpenCV 4.1

@cenit cenit closed this as completed Feb 26, 2020
@AlexeyAB AlexeyAB removed question want enhancement Want to improve accuracy, speed or functionality labels Feb 27, 2020
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

4 participants