Trouble installing 'rsvg' getting unix pkg-config error.

Problem:

The pkg-congif on my unix server can not find librsvg-2.0 in the pkg-config search path

Debug process

I tried to get rsvg installed and I got the error posted at the bottom.
I know librsvg is installed since I reinstalled it and it said the latest version was installed using:

sudo apt-get install librsvg2-bin

I think Ithe next step is to set the pkg-config to see the new install.

How do I do this?

I have the package installed on a separate nonproject server and I get this result

pkg-config --cflags librsvg-2.0
-pthread -I/usr/include/librsvg-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16

on the problem server I get


pkg-config --cflags librsvg-2.0Package librsvg-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `librsvg-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'librsvg-2.0' found`

Error

> install.packages("rsvg")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rsvg_2.1.2.tar.gz'
Content type 'application/x-gzip' length 233709 bytes (228 KB)
==================================================
downloaded 228 KB

* installing *source* package ‘rsvg’ ...
** package ‘rsvg’ successfully unpacked and MD5 sums checked
** using staged installation
Package librsvg-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `librsvg-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'librsvg-2.0' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lrsvg
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the librsvg-2.0 library. Try installing:
 * deb: librsvg2-dev (Debian, Ubuntu, etc)
 * rpm: librsvg2-devel (Fedora, EPEL)
 * csw: librsvg_dev, sunx11_devel (Solaris)
 * brew: librsvg (OSX)
If librsvg-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a librsvg-2.0.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: librsvg/rsvg.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘rsvg’
* removing ‘/usr/local/lib/R/site-library/rsvg’
Warning in install.packages :
  installation of package ‘rsvg’ had non-zero exit status

What operating system are you using on your server? Why do you install librsvg2-bin instead of librsvg2-dev as indicated in the error message?

yeah that was it. I did

sudo apt-get install -y librsvg2-dev

and that fixed it. The configuration file is now found. I think I just copied a similar answer I found, but it used package-bin and I didn't realize the difference till you pointed it out. Sometimes you just need a second set of eyes.
Thanks!