How to solve a missing pkg-config command
-
I can't build a project in Qt Creator for macOS because of the following problem:
/bin/sh: pkg-config: command not found
I tried to install pkg-config with brew and learned, that this library is already installed at /usr/local/bin/pkg-config.
How can I solve this problem?
-
Thanks for your response. I appreciate the time you have invested.
I'm working on macOS 10.13.1 High Sierra and Qt Creator 4.2.1 (Sailfish OS SDK 1710) based on Qt 5.6.2 (Clang 6.0 (Apple), 64 bit).
I did run an update yesterday with the maintenance tool. But the problem occured in the last versios, either. So far I relized, the maintenance tool replaces the existing installation for a major update.
I also tried to clean the project and to close and restart Qt Creator. I assume, that the library pkg-config is linked to the wrong path somewhere. But I don't know, where the library is linked, in the Qt Creator itself or in the project. It is also possible that the library is missed on the virtual machine for thebuild process, that is included in the SDK for SailfishOS.
-
I did have the same idea. Unfortunately the package seems to exist already:
Warning: pkg-config 0.29.2 is already installed, it's just not linked. You can use `brew link pkg-config` to link this version.
I did run the command, but there is a conflict:
Error: Could not symlink bin/pkg-config Target /usr/local/bin/pkg-config already exists. You may want to remove it: rm '/usr/local/bin/pkg-config' To force the link and overwrite all conflicting files: brew link --overwrite pkg-config To list all files that would be deleted: brew link --overwrite --dry-run pkg-config
The list of the last command:
Would remove: /usr/local/bin/pkg-config /usr/local/share/aclocal/pkg.m4 /usr/local/share/doc/pkg-config/pkg-config-guide.html /usr/local/share/man/man1/pkg-config.1
It seems that Qt Creator or the project - I don't know - expects the pkg-config in a different path namely /bin/sh.
I also don't know, whether QT Creator of the SailfishOS SDK expects or the project itself expects pkg-config on my host, where Qt Creator is installed, or on the build engine on the virtual machine.
I would appreciate any help.
-
The
/bin/sh
part refers to the bash interpreter used to callpkg-config
.I don't know, I haven't used that SDK at all. Where to you see that message printed ?
-
Hi @a-burks
i was facing one similar problem with pkg-config, with one qt project (i am not sure , but maybe it is the same problem for you)
and for me the problem was due to missing build var environment in Qt Creator
So to solve this problem i have added pkg-config path with this following steps:
- From Qt creator , go to project mode.
- In build environment add var:
PKG_CONFIG_PATH
And for the value of this variable , you have to add the path to pkgconfig, i think that in your case this should be equal to :
/usr/local/bin/pkg-config
Are you having this error only with one qt project? or with all qt project?
-
@a.burks said in How to solve a missing pkg-config command:
@mostefa Thanks for the recommendation. This is my configuration, I've checked:
![0_1512302492091_Screenshot_SailfishOS_SDK.jpg](Uploading 100%)
I'm afraid, that the parameter is ignored. I get the same error message:
/bin/sh: pkg-config: command not found
Your screenshot is not visible ?
-
@a.burks said in How to solve a missing pkg-config command:
@mostefa Thanks for the recommendation. This is my configuration, I've checked:
I'm afraid, that the parameter is ignored. I get the same error message:
/bin/sh: pkg-config: command not found
From a quick search on stackoverflow , i think that you are facing this problem too
https://stackoverflow.com/a/20805469
Can you try then to add
PKG_CONFIG = /usr/local/bin/pkg-config
Inside your .pro?
-
@mostefa Unfortunately this has no impact. I get the same output. This is, how the *.pro file looks like:
TEMPLATE = subdirs SUBDIRS += src plugin tools tests doc plugin.depends = src tools.depends = src tests.depends = src PKG_CONFIG = /usr/local/bin/pkg-config QMAKE_CLEAN += \ build-stamp \ configure-stamp \ artifacts/*.deb \ *.log.xml \ *.log QMAKE_DISTCLEAN += \ build-stamp \ configure-stamp \ *.log.xml \ *.log PKG_CONFIG = /usr/local/bin/pkg-config
The output is still the following:
/bin/sh: pkg-config: command not found
-
I posted the issue in GitHib. Unfortunately I can't understand the answer. Can someone help?
Building a Mer/Sailfish OS project within Qt Creator relies on the definition and use of qtc_* macros inside the .spec file, which is not the case of lipstick library. Opened #122 to let mb2 issue warning when qtc_* macros are not used in the .spec file.