4

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?

user961627
  • 12,379
  • 42
  • 136
  • 210

3 Answers3

3

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.

Community
  • 1
  • 1
Lucas
  • 106
  • 1
  • 5
0

enter image description here

run cgywin setup and in package search type pkg-config then make sure that pkg-config utility is installed. it should solve the not found command problem.

user889030
  • 4,353
  • 3
  • 48
  • 51
0

I think that in this case it has nothing to do with the PKG_CONFIG_PATH, because the user complains on the "command not found" error message.

The user probably mixes up pkg-config as a tool (with -) and pkgconfig (without -) as a directory as I see from the command. If I run it without dash on my system I get the same error message of course:

$ pkgconfig --libs --cflags opencv
-bash: pkgconfig: command not found

On Cygwin there is pkgconf.exe as a tool, pkg-config as a symlink to it and pkgconfig as a directory. There is no tool pkgconfig.

If it is not found as pkg-config then it means that pkg-config tool is missing in the Cygwin installation (the solution is to upgate Cygwin tools and select it in the checkbox) or it is probably the symlink problem which I described in https://stackoverflow.com/a/66037850/4807875 (the solution in this case is to use the indeed Cygwin console instead of the native cmd.exe with C:\Cygwin64\bin in PATH in it, or to call explicitly pkgconf.exe).

Alexander Samoylov
  • 2,358
  • 2
  • 25
  • 28