pkg-config: command not found, using cygwin on windows 7

user961627 picture user961627 · Apr 8, 2014 · Viewed 8.5k times · Source

I'm using Cygwin on windows to run this command:

 g++ `pkgconfig --libs --cflags opencv` -I. -o mergevec mergevec.cpp ....

But I get an error:

-bash: pkg-config: command not found

I've installed cygwin directly on C:. I've added to the PATH environment variable the following:

C:\cygwin64\bin;
C:\cygwin64\lib

I've run cygcheck -c and it gives me a whole list of packages, but pkg-config isn't in that list. There is a folder called pkgconfig in C:\cygwin64\lib though. How do I fix this error?

Answer

Lucas picture Lucas · Jul 8, 2014

pkg-config is a piece of software that allow your computer to check installed libraries for source compilation. It may not be installed on Windows so in last scenario please check for install.

However in your case i think it is installed, but not set on the right path for linux commands. Try to type in cygwin:

$ export PKG_CONFIG_PATH=c:\\cygwin\\usr\\local\\lib\\pkgconfig 

as stated in this post.

Otherwise just abandon Windows and try to compile mergevec on an Linux VM, which is really easier (it was made for it). The only down point of this method is that you will have to do the mergevec operation (and the ones before, otherwise you may have encoding problems) under your linux space. See my previous answer for this manipulation.

If any problem don't hesitate.