在pkg-config搜索路径中找不到软件包rdkafka

Package rdkafka was not found in the pkg-config search path.

Confluent go package is throwing error like so

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

how do I fix this ? I tried adding it to the path but no dice ! any suggestions ?

pkg-config looks at some default directories for the .pc files, typically /usr/lib/pkgconfig and /usr/share/pkgconfig. However some libraries use /usr/local as the their installation prefix.

Try searching for rdkafka.pc in your /usr directory then add the directory to your PKG_CONFIG_PATH

e.g. export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

Edit: Here is a discussion about PKG_CONFIG_PATH: https://askubuntu.com/questions/210210/pkg-config-path-environment-variable

git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --prefix /usr
make
sudo make install

See doc for details