Ask Your Question

Revision history [back]

pkg-config file for 3.0.0 beta incomplete?

Hello,

I am currently switching from OpenCV 2.4.9 to 3.0.0 beta on my 64-bit Ubuntu 14.04 system. I built OpenCV from source, installed it and tried to link against it using a Makefile that worked fine with OpenCV 2.4.9. It basically looks like this:

CXX ?= g++

CXXFLAGS += -c -Wall `pkg-config --cflags opencv`
LDFLAGS += -static `pkg-config --libs --static opencv`

all: test.exe

test.exe: test.o
    $(CXX) $< -o $@ $(LDFLAGS)

%.o: %.cpp
    $(CXX) $< -o $@ $(CXXFLAGS)

clean:
    rm -f test.o test.exe

I am using the following minimal example source file (test.cpp):

#include <iostream>
#include "opencv2/core/core.hpp"

using namespace std;
using namespace cv;

int main(const int argc, const char * const argv[])
{
  cout << getBuildInformation() << endl;
  return 0;
}

Linking fails due to several unresolved references. Although it was not hard to figure out that I had to add -lpthread -lz -ldlto LDFLAGS, it seemed strange to me that pkg-config did not do that already. When I looked at the .pc file of OpenCV in the pkg-config directory, I noticed that no other libraries than the OpenCV libraries themselves were listed there. In version 2.4.9., the pkg-config file included -lphread -lz -ldl and many other in its "Libs:" line, but 3.0.0 does not do so any longer. What is the reason for this? Is the pkg-config file incomplete on purpose or is this an artifact of the beta version? If so, is there any way to get a complete pkg-config file like in 2.4.9 before the final release?

Best regards Andreas