[cairo] Problems to compile cairo with pango support

Ken Guerin ken.guerin at kenware.com
Fri Oct 9 17:09:46 UTC 2020


My recent struggles with Cairo, Pango and pkg-config may help.

I write code for both OSX and Linux. I use Homebrew to install 3rd party 
libraries on OSX and apt on Pop_OS/Ubuntu.

I had some initial issues with libturbojpeg on OSX and this led me to 
start adding paths to my PKG_CONFIG_PATH in order to find missing .pc 
files.  However, this workaround was unnecessary; an invalid package 
install usually leads to these sorts of errors.

In my OSX environment using Homebrew, which was also used to install 
pkgconfig, all .pc files should be in /usr/local/lib/pkgconfig. However, 
Homebrew installs most packages in /usr/local/Cellar.  The .pc files in 
/usr/local/lib/pkgconfig are symbolic links back into 
../../Cellar/<package>/...  For my libturbojpeg install, the symbolic 
link was not generated for some reason and I could not build with this 
library until I created the symlink by hand.

When I ported my environment into Linux, TurboJPEG still wouldn't build, 
but the problem was between the chair and the keyboard: libjpeg-turbo is 
not libturbojpeg.  One was pre-installed and one was not.  Once I 
installed libturbojpeg on my Linux system, I was good to go.

I bring this up b/c I am writing "functional" C bindings into both Cairo 
and Pango for some Ruby-based graphics tools/scripts that I'm writing. 
When I upgraded my OSX laptop to Catalina, the Ruby Pango gem stopped 
working and all of my tools/scripts stopped working due to a Pango gem 
load failure.  (Something about relative paths not being allowed during 
dlopen.)  After months of trying to figure this out on my own, I decided 
to forego my reliance on 7+ Ruby gem API bindings and write my own 
functional C-language bindings, using only those features of the 
underlying libraries that I need.

To see the default search path(s) used by pkg-config, use the following 
 > pkg-config --variable pc_path pkg-config

I hope this helps.  Avoid modifying PKG_CONFIG_PATHS in your environment 
and try to find where the .pc files are in your installs and make sure 
that they were either installed or symlink'd in the appropriate places.

Best regards,
Ken Guerin

On 10/9/20 7:31 AM, Johann Lermer wrote:
> On Fri, 09 Oct 2020 04:16:22 +0300
> alexandre schenberg <ale.schenberg at yandex.com> wrote:
>> Can I draw any relevant conclusions based on this?
> Yes: a search on google revails that
> gmodule-no-export-2.0.pc is a part of the glib developer package, at
> least on Ubuntu or Suse. So it seems obvious to me, that that package
> is not properly installed on your system. And pango btw also not, since
> pkg-config wasn't able to find it without modifying PKG_CONFIG_PATH.
> On my system (btw. which doesn't seem to have a PKG_CONFIG_PATH)
> a pkg-config --libs pango gives:
> -lpango-1.0 -lgobject-2.0 -lglib-2.0
> and a pkg-config --libs gmodule-no-export-2.0 gives:
> -lgmodule-2.0 -pthread -lglib-2.0

More information about the cairo mailing list