Subject: | ExtUtils::PkgConfig version 1.14 fails to behave as system pkg-config command |
I encountered the following problem with ExtUtils::PkgConfig while
trying to install Math::GSL. I'm pinpointing the problem to
ExtUtils::PkgConfig based on other tests I ran after the build failure.
Attached are some simple tests and the results I wrote using IPC::Cmd to
run the system pkg-config utility to test the output. Using the system
pkg-config utility gsl is located and the results are the same as
gsl-config. The attached files are PkgConf gsl.pl, pkgconfig.pl, and
ipccmd_results.txt.
[myra@gandalf ~/workspace/perl/Math-GSL/Math-GSL-0.27-test]$ perl Build.PL
Checking for GSL..
Found GSL 1.15 (via gsl-config) installed in /usr,
CFLAGS=-I/usr/include, -L/usr/lib -lgsl -lgslcblas -lm
Asking ExtUtils::PkgConfig with
ENV{PKG_CONFIG_PATH}=/usr/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/pkgconfig:/usr/libdata/pkgconfig:/usr/local/libdata/pkgconfig:/opt/pkgconfig:
*** can't find cflags for "gsl"
*** is it properly installed and available in PKG_CONFIG_PATH?
at Build.PL line 157.
ExtUtils::PkgConfig version (1.14) installed.
ExtUtils::Depends (0.304) installed
ls /usr/lib/pkgconfig | grep gsl
gsl.pc
most /usr/lib/pkgconfig/gsl.pc
prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include
GSL_CBLAS_LIB=-lgslcblas
Name: GSL
Description: GNU Scientific Library
Version: 1.15
Libs: -L/usr/lib -lgsl ${GSL_CBLAS_LIB} -lm -lm
Cflags: -I/usr/include
perl -V
Summary of my perl5 (revision 5 version 17 subversion 9) configuration:
Platform:
osname=linux, osvers=3.8.2-1-arch, archname=x86_64-linux-thread-multi
uname='linux gandalf 3.8.2-1-arch #1 smp preempt mon mar 4 09:06:43
cet 2013 x86_64 gnulinux '
config_args='-de
-Dprefix=/home/myra/perl5/perlbrew/perls/perl-5.17.9 -Dusethreads
-Duseshrplib -Doptimize=-march=x86-64 -mtune=generic -O2 -pipe
-fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2
-Dcccdlflags=-fPIC -Dlddlflags=-shared
-Wl,-O1,--sort-common,--as-needed,-z,relro -Dusedevel
-Aeval:scriptdir=/home/myra/perl5/perlbrew/perls/perl-5.17.9/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
--param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.7.2', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib
/lib64 /usr/lib64
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
-lgdbm_compat
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.17.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.17'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/home/myra/perl5/perlbrew/perls/perl-5.17.9/lib/5.17.9/x86_64-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared
-Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib
-fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE
PERL_PRESERVE_IVUV PERL_USE_DEVEL USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Built under linux
Compiled at Mar 6 2013 23:15:22
%ENV:
PERLBREW_BASHRC_VERSION="0.59"
PERLBREW_HOME="/home/myra/.perlbrew"
PERLBREW_MANPATH="/home/myra/perl5/perlbrew/perls/perl-5.17.9/man"
PERLBREW_PATH="/home/myra/perl5/perlbrew/bin:/home/myra/perl5/perlbrew/perls/perl-5.17.9/bin"
PERLBREW_PERL="perl-5.17.9"
PERLBREW_ROOT="/home/myra/perl5/perlbrew"
PERLBREW_VERSION="0.59"
@INC:
/home/myra/perl5/perlbrew/perls/perl-5.17.9/lib/site_perl/5.17.9/x86_64-linux-thread-multi
/home/myra/perl5/perlbrew/perls/perl-5.17.9/lib/site_perl/5.17.9
/home/myra/perl5/perlbrew/perls/perl-5.17.9/lib/5.17.9/x86_64-linux-thread-multi
/home/myra/perl5/perlbrew/perls/perl-5.17.9/lib/5.17.9
Subject: | gsl.pl |
use Modern::Perl '2012' ;
use IPC::Cmd qw[can_run run run_forked];
use Perl6::Say ;
# system gsl-config
#
my $full_path1 = can_run('gsl-config') or warn 'gsl is not installed!';
my $full_path2 = can_run('pkg-config') or warn 'pkg is not installed!';
my $cmd1 = "$full_path1 --version";
my $cmd2 = "$full_path1 --prefix";
my $cmd3 = "$full_path1 --libs";
my $cmd4 = "$full_path1 --cflags";
my $cmd5 = "$full_path2 --exists gsl";
my $cmd6 = "$full_path2 --modversion gsl";
my $cmd7 = "$full_path2 --libs gsl";
my $cmd8 = "$full_path2 --cflags gsl";
my $buffer;
say "Testing gsl with system gsl-config using IPC::Cmd" ;
## in scalar context
if( scalar run( command => $cmd1,
verbose => 1,
buffer => \$buffer,
timeout => 20 )
) {
say "result: $buffer\n";
}
if( scalar run( command => $cmd2,
verbose => 1,
buffer => \$buffer,
timeout => 20 )
) {
say "result: $buffer\n";
}
if( scalar run( command => $cmd3,
verbose => 1,
buffer => \$buffer,
timeout => 20 )
) {
say "result: $buffer\n";
}
if( scalar run( command => $cmd4,
verbose => 1,
buffer => \$buffer,
timeout => 20 )
) {
say "result: $buffer\n";
}
say "Testing gsl with system pkg-config using IPC::Cmd" ;
if( scalar run( command => $cmd5,
verbose => 1,
buffer => \$buffer,
timeout => 20 )
) {
say "result: $buffer\n";
}
if( scalar run( command => $cmd6,
verbose => 1,
buffer => \$buffer,
timeout => 20 )
) {
say "result: $buffer\n";
}
if( scalar run( command => $cmd7,
verbose => 1,
buffer => \$buffer,
timeout => 20 )
) {
say "result: $buffer\n";
}
if( scalar run( command => $cmd8,
verbose => 1,
buffer => \$buffer,
timeout => 20 )
) {
say "result: $buffer\n";
}
Subject: | pkgconfig.pl |
#use Test::Most 'no_plan' ;
use Modern::Perl '2012' ;
use Config;
use Data::Dumper;
use Module::Build;
use File::Spec::Functions qw/:ALL/;
use ExtUtils::PkgConfig ;
use Perl6::Say ;
#this test passes!
#BEGIN {
# use_ok( 'ExtUtils::PkgConfig' );
#}
say "Asking ExtUtils::PkgConfig with ENV{PKG_CONFIG_PATH}=" . ($ENV{PKG_CONFIG_PATH} || '') . "\n";
my %gsl_pkgcfg = ExtUtils::PkgConfig->find ('gsl');
my $pkgcfg_ver = $gsl_pkgcfg{'modversion'};
Subject: | ipccmd_results.txt |
[myra@gandalf ~/workspace/perl/Math-GSL/ipccmd]$ perl gsl.pl
Testing gsl with system gsl-config using IPC::Cmd
Running [/usr/bin/gsl-config --version]...
1.15
result: 1.15
Running [/usr/bin/gsl-config --prefix]...
/usr
result: /usr
Running [/usr/bin/gsl-config --libs]...
-L/usr/lib -lgsl -lgslcblas -lm
result: -L/usr/lib -lgsl -lgslcblas -lm
Running [/usr/bin/gsl-config --cflags]...
-I/usr/include
result: -I/usr/include
Testing gsl with system pkg-config using IPC::Cmd
Running [/usr/bin/pkg-config --exists gsl]...
result: -I/usr/include
Running [/usr/bin/pkg-config --modversion gsl]...
1.15
result: 1.15
Running [/usr/bin/pkg-config --libs gsl]...
-lgsl -lgslcblas -lm
result: -lgsl -lgslcblas -lm