How to add directories to the PKG_CONFIG_PATH environment variable - windows

I have installed Gtk in Windows using Msys2 as instructed here.
pacman -S mingw-w64-x86_64-gtk3
I am trying to build example code on the this page. However, I am getting following errors:
C:MeGolang>go build mygtk_eg.go
# pkg-config --cflags -- gio-2.0 glib-2.0 gobject-2.0 gio-2.0 glib-2.0 gobject-2.0 gio-2.0
Package gio-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gio-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gio-2.0' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Package gobject-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gobject-2.0' found
Package gio-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gio-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gio-2.0' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Package gobject-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gobject-2.0' found
Package gio-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gio-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gio-2.0' found
pkg-config: exit status 1
How do I add directories to the PKG_CONFIG_PATH environment variable?

Related

pkg-config file openmp dependency

I want to write a pkg-config for a library that uses openmp internally.
My .pc file reads
prefix=/usr/local
exec_prefix=/usr/local
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: LightFEM
Description:
Version: 1.0.0
Requires: openmp
Libs: -L${libdir} -lLightFEM
Cflags: -I${includedir}
However pkg-config returns the following error
Package openmp was not found in the pkg-config search path.
Perhaps you should add the directory containing `openmp.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openmp', required by 'LightFEM', not found
How sould I write my .pc file ?

Cannot compile gstreamer on Windows because it is missing glib-2.0

I'm trying to build a Rust program that implements gstreamer on Windows, but I can't figure out how to get the dependencies right. I keep getting this error:
--- stderr
`"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.42"` did not exit successfully: exit code: 1
--- stderr
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glib-2.0' found
Process finished with exit code 101
Here are my dependencies in Cargo.toml:
[dependencies]
gstreamer = "0.16.1"
I installed pkg-config via chocolatey pkgconfiglite. I don't know how to get past this error and I'm stumped.
You need to add C:\gstreamer\1.0\x86_64\lib\pkgconfig to PKG_CONFIG_PATH so that pkg-config can find the .pc file for GStreamer.
(Moved actual solution to asker's problem up here from comments. Original answer below the line so the comments make sense.)
According to the gstreamer-rs README:
pacman -S mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \
mingw-w64-x86_64-gst-rtsp-server
The README mentions issues with pkg-config and suggests pkg-config-lite, but you seem to already have that so it shouldn't be an issue.
The Chocolatey gstreamer-devel package might have similar results, but it's not the (apparently) official method.

How to get pkg-config to use PKG_CONFIG_PATH?

I've written a small library and I'm trying to set it up to be usable with pkg-config, for those in my organization who might need to make use of it later. So my installer places a .pc file in /usr/local/lib/pkgconfig, and I've recently discovered that for some reason this isn't in the default list of directories that pkg-config scans for its pc files, despite /usr/local being the canonical prefix for locally-compiled software. So, I need to add /usr/local/lib/pkgconfig to PKG_CONFIG_PATH.
However, I'm finding that despite claims in the man page, pkg-config's own error message and everywhere online, pkg-config doesn't actually look at PKG_CONFIG_PATH. The error message tells me to add /usr/local/lib/pkgconfig (which contains the .pc file I'm looking for) to PKG_CONFIG_PATH, when I've clearly already done that.
[chris#delphinus-a pkgconfig]$ pwd
/usr/local/lib/pkgconfig
[chris#delphinus-a pkgconfig]$ ls
libexample.pc
[chris#delphinus-a pkgconfig]$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
[chris#delphinus-a pkgconfig]$ echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig
[chris#delphinus-a pkgconfig]$ pkg-config --cflags libexample
Package libexample was not found in the pkg-config search path.
Perhaps you should add the directory containing `libexample.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libexample', required by 'virtual:world', not found
[chris#delphinus-a pkgconfig]$ echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig
[chris#delphinus-a pkgconfig]$ pkg-config --variable pc_path pkg-config
/usr/lib64/pkgconfig:/usr/share/pkgconfig
[chris#delphinus-a pkgconfig]$ pkg-config --version
1.6.3
The contents of libexample.pc:
prefix=/usr/local
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: libexample
Description: example library.
Libs: -L${libdir} -lpthread -ltimeutil -lczmq -lzmq
Cflags: -I${includedir}
So, if PKG_CONFIG_PATH is indeed the environment variable I need to set, how to I get pkg-config to actually use it? Or what else am I missing here? This is in Fedora 31, FWIW.
Apparently (judging by the very large version number), you're using some other implementation of pkg-config: namely, from this page I gather that it's something called pkgconf and is intended to somehow replace the FDO pkg-config program.
To succeed with PKG_CONFIG_PATH, I suppose, you should install a real pkg-config from FDO, whose version should be in the range of 0.29.x.

Problems installing gozmq with go get

I was trying to install gozmq with the usual go get:
go get github.com/alecthomas/gozmq
However, I was having the following error:
# pkg-config --cflags libzmq libzmq libzmq libzmq
exec: "pkg-config": executable file not found in $PATH
I don't really understand what this error means. Does it mean that its trying to run the command # pkg-config --cflags libzmq libzmq libzmq libzmqand its failing because pkg-config is not on $PATH? What is pkg-config anyway and why do I need it? how do I install it?
I tried brew installing pkg-config but it didn't work and it threw me the following error:
# pkg-config --cflags libzmq libzmq libzmq libzmq
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
Package libzmq was not found in the pkg-config search path.
Perhaps you should add the directory containing `libzmq.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libzmq' found
exit status 1
not sure why that happened.
EDIT:
As the first answerer suggested, I did:
brew install --devel zeromq
however, I get the following error after I do go get github.com/alecthomas/gozmq
Error:
# github.com/alecthomas/gozmq
37: error: use of undeclared identifier 'ZMQ_SWAP'
37: error: use of undeclared identifier 'ZMQ_RECOVERY_IVL_MSEC'
37: error: use of undeclared identifier 'ZMQ_MCAST_LOOP'
38: error: use of undeclared identifier 'ZMQ_HWM'
seem to be "normal" go errors/warning. But they come from a library I got online. I am not sure what to do, if I should fix them myself or what I should to to address it or e-mail the original developers/community or git issue etc.
You need to install the development versions of those libraries.
$ brew install --devel zeromq
According to issue 98, if you're using zeromq v3.x you need to use :
go get -tags zmq_3_x github.com/alecthomas/gozmq
# or if you're using 4x
go get -tags zmq_4_x github.com/alecthomas/gozmq
Check the README.

How to overshadow a package from repository with another version?

I have a glib-2.0 2.36.0 package, installed from ubuntu repo. So now
pkg-config --modversion glib-2.0
Prints 2.36.0 Recently, I downloaded and built a fresh new version 2.40.0. I need it to build a Clutter, also downloaded manually. It requires glib version 2.37.3 at least.
How can I point out a custom pkgconfig directory, that is located in the glib binaries such, that --modversion will return 2.40.0?
The solution is PKG_CONFIG_PATH :
PKG_CONFIG_PATH="$PKG_CONFIG_PATH $HOME/frameworks/glib/lib/pkgconfig/" pkg-config --modversion glib-2.0
Gives the right result.

Resources