Pkg config no such file or directory windows

pkg-config —cflags opencv: No such file or directory

I’m writing a basic example of opencv, but make command give me message

g++-4.7.real: error: pkg-config —cflags opencv: No such file or directory

g++-4.7.real: error: pkg-config —libs opencv: No such file or directory

issue command pkg-config —cflag opencv give me result as:

and pkg-config —libs opencv give me:

-I/usr/local/include/opencv -I/usr/local/include
vudao@vudaopc:

/work/nmath/ntrainer$ pkg-config —libs opencv /usr/local/lib/libopencv_contrib.a /usr/local/lib/libopencv_stitching.a /usr/local/lib/libopencv_nonfree.a /usr/local/lib/libopencv_superres.a /usr/local/lib/libopencv_ocl.a /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_videostab.a /usr/local/lib/libopencv_gpu.a /usr/local/lib/libopencv_photo.a /usr/local/lib/libopencv_objdetect.a /usr/local/lib/libopencv_legacy.a /usr/local/lib/libopencv_video.a /usr/local/lib/libopencv_ml.a /usr/local/lib/libopencv_calib3d.a /usr/local/lib/libopencv_features2d.a /usr/local/lib/libopencv_highgui.a /usr/local/share/OpenCV/3rdparty/lib/libIlmImf.a /usr/local/share/OpenCV/3rdparty/lib/liblibjasper.a /usr/local/share/OpenCV/3rdparty/lib/liblibtiff.a /usr/local/lib/libopencv_imgproc.a /usr/local/lib/libopencv_flann.a /usr/local/lib/libopencv_core.a /usr/lib/i386-linux-gnu/libbz2.so /usr/lib/i386-linux-gnu/libpng.so /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/i386-linux-gnu/libz.so -lswscale -lavformat -lavutil -lz -lSDL -lasound -lavcodec -lgthread-2.0 -lglib-2.0 -lgobject-2.0 -lfontconfig -lfreetype -lpango-1.0 -lcairo -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpangoft2-1.0 -lgio-2.0 -latk-1.0 -lgdk-x11-2.0 -lgtk-x11-2.0 -lrt -lpthread -lm -ldl -lstdc++

Below is my Makefile:

My system is Ubuntu 12.10. I have installed opencv-2.4.7 successfully (I think) following instructions here http://www.samontab.com/web/2011/06/installing-opencv-2-2-in-ubuntu-11-04/

I also have configured and exported PKG_CONFIG_PATH into /etc/bash.bashrc, I’v also ran ldconfig

Please someone tell me what I’m missing? And how to correct it. Thanks too much.

gtkmm: Simple example fails to compile: gtkmm.h: No such file or directory

I am working through the gtkmm documentation. I have started by trying to compile the «Simple Example». Here is the code. It can also be found here.

I have tried to compile this using

which should work according to the documentation. (See end of linked page.)

Running pkg-config gtkmm-3.0 —cflags —libs produces

I am running Debian 9 Stretch. I installed gtkmm with

Running find /usr -name «gtkmm» produces

So why does the example not compile?

Updates:

(That’s a different error this time.)

Try to find again

Change export command

Re-run, back to square 1

Problem resolved (sort ot)

I have discovered from reading this question that the path should be colon seperated.

However this does not solve the problem of why this variable needs to be set at all. pkg-config is used because it is supposed to make compilation simpler, however this isn’t any more simple than specifying the include paths manually, as multiple environment variables need to be set.

In addition, the lack of information about this issue online makes me suspect that this is an issue which most users do not encounter, and therefore is probably specific to Debian 9. (I would like to know if anyone else has encounted this problem, and on what OS.)

Читайте также:  При загрузке windows открываются окна

1 Answer 1

At first, it is normal that installing gtkmm is a bit complicated. As far as i can see, here in the Stackoverflow forum many users have problem with doing so. Even users in the Windows operating system are confronted with error messages, if they are trying to use gtkmm together with Visual Studio for developing a platform independent app . But to your question. There are many options what can go wrong. A simple explanation would be, that the debian package “libgtk-3-dev” has to be installed, which is used for creating GTK+ apps in C, because gtkmm uses this package. So the first step is to try out, it the compilation of a C sourcecode for GTK+ works. A second explanation is, that the debian “package manager” is in general broken so switching the Linux distribution would be a good advice. For example, in Fedora a simple dnf install gtk3 gtk3-devel gtkmm30 gtkmm30-devel is enough for starting programming.

How to install pkg config in windows?

I am trying to do it, but all I can get is some source code that I don’t know how to do deal with I downloaded from http://pkgconfig.freedesktop.org/releases/ .

8 Answers 8

Download pkg-config and its depend libraries :

This is a step-by-step procedure to get pkg-config working on Windows, based on my experience, using the info from Oliver Zendel’s comment.

I assume here that MinGW was installed to C:\MinGW. There were multiple versions of the packages available, and in each case I just downloaded the latest version.

Now CMake will be able to use pkg-config if it is configured to use MinGW.

A alternative without glib dependency is pkg-config-lite.

Extract pkg-config.exe from the archive and put it in your path.

Nowdays this package is available using chocolatey, then it could be installed whith

I did this by installing Cygwin64 from this link https://www.cygwin.com/ Then — View Full, Search gcc and scroll down to find pkg-config. Click on icon to select latest version. This worked for me well.

  1. Install mingw64 from https://sourceforge.net/projects/mingw-w64/. Avoid program files/(x86) folder for installation. Ex. c:/mingw-w64
  2. Download pkg-config__win64.zip from here
  3. Extract above zip file and copy paste all the files from pkg-config/bin folder to mingw-w64. In my case its ‘C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin’
  4. Now set path = C:\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin taddaaa you are done.

If you find any security issue then follow steps as well

  1. Search for windows defender security center in system
  2. Navigate to apps & browser control> Exploit protection settings> Program setting> Click on ‘+add program customize’
  3. Select add program by name
  4. Enter program name: pkgconf.exe
  5. OK
  6. Now check all the settings and set it all the settings to off and apply.
Читайте также:  Система windows защитила ваш компьютер при установке

I would like to extend the answer of @dzintars about the Cygwin version of pkg-config in that focus how should one use it properly with CMake, because I see various comments about CMake in this topic.

I have experienced many troubles with CMake + Cygwin’s pkg-config and I want to share my experience how to avoid them.

1. The symlink C:/Cygwin64/bin/pkg-config -> pkgconf.exe does not work in Windows console.

It is not a native Windows .lnk symlink and it won’t be callable in Windows console cmd.exe even if you add «.;» to your %PATHEXT% (see https://www.mail-archive.com/cygwin@cygwin.com/msg104088.html).

It won’t work from CMake, because CMake calls pkg-config with the method execute_process() (FindPkgConfig.cmake) which opens a new cmd.exe.

Solution: Add -DPKG_CONFIG_EXECUTABLE=C:/Cygwin64/bin/pkgconf.exe to the CMake command line (or set it in CMakeLists.txt).

2. Cygwin’s pkg-config recognizes only Cygwin paths in PKG_CONFIG_PATH (no Windows paths).

For example, on my system the .pc files are located in C:\Cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\lib\pkgconfig. The following three paths are valid, but only path C works in PKG_CONFIG_PATH:

  • A) c:/Cygwin64/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig — does not work.
  • B) /c/cygdrive/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig — does not work.
  • C) /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig — works.

Solution: add .pc files location always as a Cygwin path into PKG_CONFIG_PATH.

3) CMake converts forward slashes to backslashes in PKG_CONFIG_PATH on Cygwin.

It happens due to the bug https://gitlab.kitware.com/cmake/cmake/-/issues/21629. It prevents using the workaround described in [2].

Solution: manually update the function _pkg_set_path_internal() in the file C:/Program Files/CMake/share/cmake-3.x/Modules/FindPkgConfig.cmake. Comment/remove the line:

4) CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH have no effect on pkg-config in Cygwin.

Solution: Use only PKG_CONFIG_PATH as an environment variable if you run CMake builds on Cygwin. Forget about CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, CMAKE_APPBUNDLE_PATH.

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

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

But I get an error:

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

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?

3 Answers 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:

Читайте также:  Нециклическое переключение раскладки linux

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.

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.

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 option for gtk-2.0

GCC is returning the following error

Using find /usr -name ‘gdk.h’ I was able to locate the missing header in

I’m guessing the error is arising form the fact that the compiler isn’t looking in gtk-2.0 for the gdk directory, though I could be mistaken about that. If I am correct, what is the pkgconfig option for gtk-2.0 , and if I’m wrong, what is it I’m really doing wrong?

3 Answers 3

the first gives the option to link the libs, the second the paths; I usually use something like

of course when I want to compile «on the fly». Otherwise, you should use a semiautomatic way of doing this (configure script, Makefiles and so on)

For me (on Debian) it was a different problem:

checking GTK_CFLAGS. Package libpng12 was not found in the pkg-config search path. Perhaps you should add the directory containing `libpng12.pc’ to the PKG_CONFIG_PATH environment variable Package ‘libpng12’, required by ‘GdkPixbuf’, not found

Then I remembered this X11-startup-fail problem I was having the week before, right after upgrading libpng to latest experimental — which I had fixed by manually restoring previous version’s .so files.. I forgot the pkgconfig files though. So this build problem fixed by properly «downgrading libpng12-0:i386 from 1.5.11-1 to 1.2.49-1.» Bottom line: look at the configure output above the actual error. And don’t install experimental libpng, chances are high it’ll brick your GUI completly 😉

Оцените статью