could not install Cairo in R, error: Cannot find fontconfig/freetype2. but cairo-dev installed

I tried to install packages “Cairo” in R without success (opensuse 42.1).
The error messages:
*
checking whether FreeType needs additional flags… yes
**checking whether pkg-config knows about fontconfig or freetype2… no
**checking whether fontconfig/freetype2 location can be guessed… no
**configure: error: Cannot find fontconfig/freetype2 although cairo claims to support it. Please check your cairo installation and/or update cairo if necessary or set CAIRO_CFLAGS/CAIRO_LIBS accordingly.

*However, Cairo-devel, fontconfig are installed.

When I run the

pkg-config --cflags --libs cairo

, the output is empty.

I guess I need to manually set the *CAIRO_CFLAGS/CAIRO_LIBS? *How to?

Thanks!

Hi
Whenever it spits an error like that it’s always the devel file you need to install, since it’s using pkg-config then it needs the pc file which is only in the devel package (freetype-devel or freetype2-devel, probably the later is better).

Problems solved:
I have installed brew in my system, so there are two pkg-config, and brew’s one comes first.
Then set the PKG_CONFIG_PATH to contain the system search path.