I recently built OpenCV 4.4 with some contributed modules, but I cannot call them from C++.
What I did
From the make install output:
...
-- Installing: /usr/local/lib/libopencv_ximgproc.so.4.4
-- Set runtime path of "/usr/local/lib/libopencv_ximgproc.so.4.4.0" to "/usr/local/lib"
-- Installing: /usr/local/lib/libopencv_ximgproc.so
-- Installing: /usr/local/include/opencv4/opencv2/ximgproc.hpp
---
When I ls to check that the file is there:
ls /usr/local/lib/libopencv_ximgproc.so.4.4
> /usr/local/lib/libopencv_ximgproc.so.4.4
But when I compile my code in g++ with:
OBJS=frame_extractor.o
BIN=g++ frame_extraction.cpp
CFLAGS+=-Wfatal-errors
LDFLAGS+=-L/opt/vc/lib/ -lpthread
LDFLAGS+=-L/usr/local/lib/ -lopencv_ximgproc
LDFLAGS+=`pkg-config --cflags --libs opencv4`
$(BIN) $(CFLAGS) $(LDFLAGS) $(RPATH) $(INCLUDES) -o $(OBJS)
and compile my program which includes the following:
#include "opencv2/opencv.hpp"
#include "opencv2/ximgproc.hpp"
I get the error in the title.
The Question
Why can't I grab this library? Is there something funny going on with the symlinking I can check? Am I missing something obvious?
What I've tried
- Explicit path in
g++
I attempted to add an rpath to my Makefile but that did not help.
RPATH+=-Wl,-rpath=/usr/local/lib/libopencv_ximgproc.so.4.4
- Confusing library names
I also checked that the code is calling ximgproc rather than imgproc, a similarly titled header.
- Checking that the lib has content
Running:
cat /usr/local/lib/libopencv_ximgproc.so.4.4
outputs the usual gobbledygook to the terminal one might expect from a binary file.