What causes package samplerate not being found in the pkg-config search path?

2.3k Views Asked by At

I stumbled upon a problem when I was trying to install gosamplerate for my project. I was following installation manual on the repository https://github.com/dh1tw/gosamplerate but after succesfully installing libsamplerate0, I get error response while trying to execute go get github.com/dh1tw/gosamplerate:

# pkg-config --cflags  -- samplerate
Package samplerate was not found in the pkg-config search path.
Perhaps you should add the directory containing `samplerate.pc'
to the PKG_CONFIG_PATH environment variable
No package 'samplerate' found
pkg-config: exit status 1

Can anyone help me resolve this issue?

1

There are 1 best solutions below

0
On

This particular error is unrelated to Go and indicates samplerate.pc isn't in the pkgconfig search path. You may have installed libsamplerate under /usr/local or somewhere else that is outside the default pkg-config search path.

Options:

  1. Install libsamplerate from your distribution (if it exists) so samplerate.pc is installed in one of the default pkgconfig directories.

  2. Set PKG_CONFIG_PATH to enable pkg-config to find samplerate.pc:

First, find where the samplerate.pc is installed (maybe /usr/local/lib/pkgconfig?). Then set PKG_CONFIG_PATH:

$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

pkg-config should find the config now.

  1. Manually rebuild and install libsamplerate in using ./configure --prefix /usr. This will install it along other system libraries, but makes it much harder to uninstall. NOT RECOMMENDED