mwalimu has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl -w use strict; use ExtUtils::PkgConfig; my %pango = ExtUtils::PkgConfig->find('pango'); my %pangocairo = ExtUtils::PkgConfig->find ('pangocairo'); my $libs = $pango{libs} ; printf("libs = $libs|\n"); my $pclibs = $pangocairo{libs}; printf("pclibs = $pclibs|\n"); $libs .= $pclibs; printf("libs = $libs|\n");

Background: I'm a longtime gentoo linux user with two different systems both using testing (as opposed to stable). On one system I had an issue compiling Pango, on the other I didn't. I can't figure out why so I turn to the monks for help.

The problem was a missing space. On the system without problems the above code (adapted from the Makefile.PL from Pango for illustration) outputs this (the vertical bars are there to show the spaces)

libs = -lpango-1.0 -lgobject-2.0 -lglib-2.0 | pclibs = -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lcairo + | libs = -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lpangocairo-1.0 -lpango-1 +.0 -lgobject-2.0 -lglib-2.0 -lcairo |
but on the other system, using the same version of ExtUtils::PkgConfig and anything else relevant I could think of (perl-5.20 for instance) the output was missing the spaces at the end causing the last line to smash together the "-lglib-2.0 -lpangocairo-1.0" bit into one piece and causing a compile error.

libs = -lpango-1.0 -lgobject-2.0 -lglib-2.0| pclibs = -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lcairo +| libs = -lpango-1.0 -lgobject-2.0 -lglib-2.0-lpangocairo-1.0 -lpango-1. +0 -lgobject-2.0 -lglib-2.0 -lcairo|

Can anyone tell me what the heck is going on? I am at a complete loss as to where to look for the problem, which started around 2-3 months ago. Before that the same code worked as expected.

Replies are listed 'Best First'.
Re: ExtUtils:PkgConfig adds proper spaces on one system, not on another, why?
by Anonymous Monk on Dec 31, 2014 at 03:20 UTC

    ExtUtils::PkgConfig just calls pkg-config, and from what I can tell doesn't do much mangling of its output. What exactly (including spaces) does pkg-config --libs pango output on your two systems?

    According to its manpage, pkg-config reads the .pc files in whatever directory those files are located on your system. On mine, pango.pc includes a line "Libs: -L${libdir} -lpango-1.0" - with a space on the end.

      That was it. For some reason an experimental version of pkgconfig was unmasked. Tracking that down next. Thanks.