Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtUtils::CBuilder bug finding C++ compiler #16080

Closed
p5pRT opened this issue Jul 13, 2017 · 17 comments
Closed

ExtUtils::CBuilder bug finding C++ compiler #16080

p5pRT opened this issue Jul 13, 2017 · 17 comments

Comments

@p5pRT
Copy link

p5pRT commented Jul 13, 2017

Migrated from rt.perl.org#131749 (status was 'resolved')

Searchable as RT131749$

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2017

From zhouzhen1@gmail.com

Created by zhouzhen1@gmail.com

There is a bug in finding C++ compiler. Patch is at https://github.com/Perl-
Toolchain-Gang/ExtUtils-CBuilder/pull/6

Perl Info

Flags:
    category=library
    severity=low
    module=ExtUtils::CBuilder

Site configuration information for perl 5.26.0:

Configured by zhenyz at Sat Jun 10 17:08:39 CST 2017.

Summary of my perl5 (revision 5 version 26 subversion 0) configuration:

  Platform:
    osname=linux
    osvers=4.11.3-1-arch
    archname=x86_64-linux
    uname='linux saturn 4.11.3-1-arch #1 smp preempt sun may 28 10:40:17
cest 2017 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0
-Aeval:scriptdir=/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/bin'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include'
    ccversion=''
    gccversion='7.1.1 20170516'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    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-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/include-fixed
/usr/lib /lib/../lib /usr/lib/../lib /lib /lib64 /usr/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
-lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.25.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.25'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    Devel::PatchPerl 1.48


@INC for perl 5.26.0:
    /home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/site_
perl/5.26.0/x86_64-linux
    /home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0
    /home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/5.26.0/x86_64-linux
    /home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/5.26.0


Environment for perl 5.26.0:
    HOME=/home/zhenyz
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/zhenyz/perl5/perlbrew/bin:/home/zhenyz/
perl5/perlbrew/perls/perl-5.26.0/bin:/usr/local/sbin:/usr/
local/bin:/usr/bin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/
usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
    PERL5LIB=
    PERLBREW_LIB=
    PERLBREW_MANPATH=/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/man
    PERLBREW_PATH=/home/zhenyz/perl5/perlbrew/bin:/home/
zhenyz/perl5/perlbrew/perls/perl-5.26.0/bin
    PERLBREW_PERL=perl-5.26.0
    PERLBREW_ROOT=/home/zhenyz/perl5/perlbrew
    PERLBREW_SKIP_INIT=1
    PERLBREW_VERSION=0.78
    PERL_BADLANG (unset)
    PERL_LOCAL_LIB_ROOT=
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2017

From ambs@zbr.pt

There is a patch for this​:
  Perl-Toolchain-Gang/ExtUtils-CBuilder#6
I am working on it, and then send a patch.

On 07/13/2017 04​:39 PM, Zhenyi Zhou (via RT) wrote​:

# New Ticket Created by Zhenyi Zhou
# Please include the string​: [perl #131749]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=131749 >

This is a bug report for perl from zhouzhen1@​gmail.com,
generated with the help of perlbug 1.40 running under perl 5.26.0.

-----------------------------------------------------------------
[Please describe your issue here]
There is a bug in finding C++ compiler. Patch is at https://github.com/Perl-
Toolchain-Gang/ExtUtils-CBuilder/pull/6

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags​:
category=library
severity=low
module=ExtUtils​::CBuilder
---
Site configuration information for perl 5.26.0​:

Configured by zhenyz at Sat Jun 10 17​:08​:39 CST 2017.

Summary of my perl5 (revision 5 version 26 subversion 0) configuration​:

Platform​:
osname=linux
osvers=4.11.3-1-arch
archname=x86_64-linux
uname='linux saturn 4.11.3-1-arch #1 smp preempt sun may 28 10​:40​:17
cest 2017 x86_64 gnulinux '
config_args='-de -Dprefix=/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0
-Aeval​:scriptdir=/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/bin'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler​:
cc='cc'
ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
optimize='-O2'
cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include'
ccversion=''
gccversion='7.1.1 20170516'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
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-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/include-fixed
/usr/lib /lib/../lib /usr/lib/../lib /lib /lib64 /usr/lib64
libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
-lgdbm_compat
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.25.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.25'
Dynamic Linking​:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches​:
Devel​::PatchPerl 1.48

---
@​INC for perl 5.26.0​:
/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/site_
perl/5.26.0/x86_64-linux
/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/site_perl/5.26.0
/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/5.26.0/x86_64-linux
/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/5.26.0

---
Environment for perl 5.26.0​:
HOME=/home/zhenyz
LANG=en_US.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/zhenyz/perl5/perlbrew/bin​:/home/zhenyz/
perl5/perlbrew/perls/perl-5.26.0/bin​:/usr/local/sbin​:/usr/
local/bin​:/usr/bin​:/opt/cuda/bin​:/usr/lib/jvm/default/bin​:/
usr/bin/site_perl​:/usr/bin/vendor_perl​:/usr/bin/core_perl
PERL5LIB=
PERLBREW_LIB=
PERLBREW_MANPATH=/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/man
PERLBREW_PATH=/home/zhenyz/perl5/perlbrew/bin​:/home/
zhenyz/perl5/perlbrew/perls/perl-5.26.0/bin
PERLBREW_PERL=perl-5.26.0
PERLBREW_ROOT=/home/zhenyz/perl5/perlbrew
PERLBREW_SKIP_INIT=1
PERLBREW_VERSION=0.78
PERL_BADLANG (unset)
PERL_LOCAL_LIB_ROOT=
SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2017

From ambs@zbr.pt

Patch attached.

On Thu, 13 Jul 2017 09​:34​:43 -0700, ambs@​perl-hackers.net wrote​:

There is a patch for this​:
Perl-Toolchain-Gang/ExtUtils-CBuilder#6
I am working on it, and then send a patch.

On 07/13/2017 04​:39 PM, Zhenyi Zhou (via RT) wrote​:

# New Ticket Created by Zhenyi Zhou
# Please include the string​: [perl #131749]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=131749 >

This is a bug report for perl from zhouzhen1@​gmail.com,
generated with the help of perlbug 1.40 running under perl 5.26.0.

-----------------------------------------------------------------
[Please describe your issue here]
There is a bug in finding C++ compiler. Patch is at
https://github.com/Perl-
Toolchain-Gang/ExtUtils-CBuilder/pull/6

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags​:
category=library
severity=low
module=ExtUtils​::CBuilder
---
Site configuration information for perl 5.26.0​:

Configured by zhenyz at Sat Jun 10 17​:08​:39 CST 2017.

Summary of my perl5 (revision 5 version 26 subversion 0)
configuration​:

Platform​:
osname=linux
osvers=4.11.3-1-arch
archname=x86_64-linux
uname='linux saturn 4.11.3-1-arch #1 smp preempt sun may 28
10​:40​:17
cest 2017 x86_64 gnulinux '
config_args='-de -Dprefix=/home/zhenyz/perl5/perlbrew/perls/perl-
5.26.0
-Aeval​:scriptdir=/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/bin'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler​:
cc='cc'
ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-
strong
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
optimize='-O2'
cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-
strong
-I/usr/local/include'
ccversion=''
gccversion='7.1.1 20170516'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
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-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib/gcc/x86_64-pc-linux-
gnu/7.1.1/include-fixed
/usr/lib /lib/../lib /usr/lib/../lib /lib /lib64 /usr/lib64
libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
-lgdbm_compat
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.25.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.25'
Dynamic Linking​:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

Locally applied patches​:
Devel​::PatchPerl 1.48

---
@​INC for perl 5.26.0​:
/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/site_
perl/5.26.0/x86_64-linux
/home/zhenyz/perl5/perlbrew/perls/perl-
5.26.0/lib/site_perl/5.26.0
/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/5.26.0/x86_64-
linux
/home/zhenyz/perl5/perlbrew/perls/perl-5.26.0/lib/5.26.0

---
Environment for perl 5.26.0​:
HOME=/home/zhenyz
LANG=en_US.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/zhenyz/perl5/perlbrew/bin​:/home/zhenyz/
perl5/perlbrew/perls/perl-5.26.0/bin​:/usr/local/sbin​:/usr/
local/bin​:/usr/bin​:/opt/cuda/bin​:/usr/lib/jvm/default/bin​:/
usr/bin/site_perl​:/usr/bin/vendor_perl​:/usr/bin/core_perl
PERL5LIB=
PERLBREW_LIB=
PERLBREW_MANPATH=/home/zhenyz/perl5/perlbrew/perls/perl-
5.26.0/man
PERLBREW_PATH=/home/zhenyz/perl5/perlbrew/bin​:/home/
zhenyz/perl5/perlbrew/perls/perl-5.26.0/bin
PERLBREW_PERL=perl-5.26.0
PERLBREW_ROOT=/home/zhenyz/perl5/perlbrew
PERLBREW_SKIP_INIT=1
PERLBREW_VERSION=0.78
PERL_BADLANG (unset)
PERL_LOCAL_LIB_ROOT=
SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2017

From ambs@zbr.pt

0001-Update-to-ExtUtils-CBuilder-0.280226.patch
From e515ffb2a45403a38e6528246bca7288c1514915 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alberto=20Sim=C3=B5es?= <ambs@cpan.org>
Date: Fri, 14 Jul 2017 14:14:05 +0100
Subject: [PATCH] Update to ExtUtils::CBuilder 0.280226

---
 dist/ExtUtils-CBuilder/Changes                     |  9 ++++++++-
 dist/ExtUtils-CBuilder/LICENSE                     |  6 +++---
 dist/ExtUtils-CBuilder/Makefile.PL                 |  6 +++---
 dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm    |  2 +-
 .../lib/ExtUtils/CBuilder/Base.pm                  | 22 ++++++++++++++++------
 .../lib/ExtUtils/CBuilder/Platform/Unix.pm         |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/VMS.pm          |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/Windows.pm      |  4 ++--
 .../lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm  |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm  |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/aix.pm          |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/android.pm      |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/cygwin.pm       |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/darwin.pm       |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/dec_osf.pm      |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/os2.pm          |  2 +-
 17 files changed, 44 insertions(+), 27 deletions(-)

diff --git a/dist/ExtUtils-CBuilder/Changes b/dist/ExtUtils-CBuilder/Changes
index aaebade..630309a 100644
--- a/dist/ExtUtils-CBuilder/Changes
+++ b/dist/ExtUtils-CBuilder/Changes
@@ -1,5 +1,12 @@
 Revision history for Perl extension ExtUtils::CBuilder.
 
+0.280226 - 2017-07-14
+
+  Fixed:
+
+  - Fix C++ compiler detection (RT #131749)
+    (thanks to stphnlyd)
+
 0.280225 - 2016-01-04
 
   Fixed:
@@ -8,7 +15,7 @@ Revision history for Perl extension ExtUtils::CBuilder.
 
 0.280224 - 2015-10-09
 
-  Enhncements:
+  Enhancements:
 
   - Use warnings/strict on all modules.
 
diff --git a/dist/ExtUtils-CBuilder/LICENSE b/dist/ExtUtils-CBuilder/LICENSE
index 97b386c..6171f8b 100644
--- a/dist/ExtUtils-CBuilder/LICENSE
+++ b/dist/ExtUtils-CBuilder/LICENSE
@@ -1,4 +1,4 @@
-This software is copyright (c) 2015 by Ken Williams.
+This software is copyright (c) 2017 by Ken Williams.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -12,7 +12,7 @@ b) the "Artistic License"
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2015 by Ken Williams.
+This software is Copyright (c) 2017 by Ken Williams.
 
 This is free software, licensed under:
 
@@ -272,7 +272,7 @@ That's all there is to it!
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2015 by Ken Williams.
+This software is Copyright (c) 2017 by Ken Williams.
 
 This is free software, licensed under:
 
diff --git a/dist/ExtUtils-CBuilder/Makefile.PL b/dist/ExtUtils-CBuilder/Makefile.PL
index 44cb33a..c599fcd 100644
--- a/dist/ExtUtils-CBuilder/Makefile.PL
+++ b/dist/ExtUtils-CBuilder/Makefile.PL
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.039.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.010.
 use strict;
 use warnings;
 
@@ -29,7 +29,7 @@ my %WriteMakefileArgs = (
   "TEST_REQUIRES" => {
     "Test::More" => "0.47"
   },
-  "VERSION" => "0.280225",
+  "VERSION" => "0.280226",
   "test" => {
     "TESTS" => "t/*.t"
   }
@@ -60,6 +60,6 @@ delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
   unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
 
 $WriteMakefileArgs{INSTALLDIRS} = 'perl'
-    if $] >= 5.009003 && $] <= 5.011000;
+    if "$]" >= 5.009003 && "$]" <= 5.011000;
 
 WriteMakefile(%WriteMakefileArgs);
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm
index 6ce0c68..99ee1fb 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder;
-$ExtUtils::CBuilder::VERSION = '0.280225';
+$ExtUtils::CBuilder::VERSION = '0.280226';
 use File::Spec ();
 use File::Path ();
 use File::Basename ();
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
index 60b2f43..511e5fe 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Base;
-$ExtUtils::CBuilder::Base::VERSION = '0.280225';
+$ExtUtils::CBuilder::Base::VERSION = '0.280226';
 use strict;
 use warnings;
 use File::Spec;
@@ -45,16 +45,26 @@ sub new {
      if defined $ENV{LDFLAGS};
 
   unless ( exists $self->{config}{cxx} ) {
-    my ($ccpath, $ccbase, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/);
+
+    my ($ccbase, $ccpath, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/);
+
+    ## If the path is just "cc", fileparse returns $ccpath as "./"
+    $ccpath = "" if $self->{config}{cc} =~ /^$ccbase$ccsfx$/;
+      
     foreach my $cxx (@{$cc2cxx{$ccbase}}) {
-      if( can_run( File::Spec->catfile( $ccpath, $cxx, $ccsfx ) ) ) {
-        $self->{config}{cxx} = File::Spec->catfile( $ccpath, $cxx, $ccsfx );
+      my $cxx1 = File::Spec->catfile( $ccpath, $cxx . $ccsfx);
+
+      if( can_run( $cxx1 ) ) {
+        $self->{config}{cxx} = $cxx1;
 	last;
       }
-      if( can_run( File::Spec->catfile( $cxx, $ccsfx ) ) ) {
-        $self->{config}{cxx} = File::Spec->catfile( $cxx, $ccsfx );
+      my $cxx2 = $cxx . $ccsfx;
+
+      if( can_run( $cxx2 ) ) {
+        $self->{config}{cxx} = $cxx2;
 	last;
       }
+
       if( can_run( $cxx ) ) {
         $self->{config}{cxx} = $cxx;
 	last;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm
index 399e254..1e75806 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::Unix;
-$ExtUtils::CBuilder::Platform::Unix::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::Unix::VERSION = '0.280226';
 use warnings;
 use strict;
 use ExtUtils::CBuilder::Base;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm
index e9d9f6f..4c62d6d 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::VMS;
-$ExtUtils::CBuilder::Platform::VMS::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::VMS::VERSION = '0.280226';
 use warnings;
 use strict;
 use ExtUtils::CBuilder::Base;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
index 80b8f29..2ff44b6 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::Windows;
-$ExtUtils::CBuilder::Platform::Windows::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::Windows::VERSION = '0.280226';
 use strict;
 use warnings;
 
@@ -151,7 +151,7 @@ sub link {
   # if running in perl source tree, look for libs there, not installed
   my $lddlflags = $cf->{lddlflags};
   my $perl_src = $self->perl_src();
-  $lddlflags =~ s/\Q$cf->{archlibexp}\E[\\\/]CORE/$perl_src\/lib\/CORE/ if $perl_src;
+  $lddlflags =~ s{\Q$cf->{archlibexp}\E[\\/]CORE}{$perl_src`/lib/CORE} if $perl_src;
 
   my %spec = (
     srcdir        => $to,
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm
index 513c4ac..fb64717 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::Windows::BCC;
-$ExtUtils::CBuilder::Platform::Windows::BCC::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::Windows::BCC::VERSION = '0.280226';
 use strict;
 use warnings;
 
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm
index 19851df..4e7123c 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::Windows::GCC;
-$ExtUtils::CBuilder::Platform::Windows::GCC::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::Windows::GCC::VERSION = '0.280226';
 use warnings;
 use strict;
 
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
index c8d675f..0cf2159 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::Windows::MSVC;
-$ExtUtils::CBuilder::Platform::Windows::MSVC::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::Windows::MSVC::VERSION = '0.280226';
 use warnings;
 use strict;
 
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm
index 488d3e6..150b196 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::aix;
-$ExtUtils::CBuilder::Platform::aix::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::aix::VERSION = '0.280226';
 use warnings;
 use strict;
 use ExtUtils::CBuilder::Platform::Unix;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm
index b9e6af3..e2d8677 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::android;
-$ExtUtils::CBuilder::Platform::android::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::android::VERSION = '0.280226';
 use warnings;
 use strict;
 use File::Spec;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm
index 339840f..bd9d0d8 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::cygwin;
-$ExtUtils::CBuilder::Platform::cygwin::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::cygwin::VERSION = '0.280226';
 use warnings;
 use strict;
 use File::Spec;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
index 04a87da..e360f04 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::darwin;
-$ExtUtils::CBuilder::Platform::darwin::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::darwin::VERSION = '0.280226';
 use warnings;
 use strict;
 use ExtUtils::CBuilder::Platform::Unix;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm
index d503e86..d4e7f0f 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::dec_osf;
-$ExtUtils::CBuilder::Platform::dec_osf::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::dec_osf::VERSION = '0.280226';
 use warnings;
 use strict;
 use ExtUtils::CBuilder::Platform::Unix;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm
index 8d0e3eb..61e3342 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm
@@ -1,5 +1,5 @@
 package ExtUtils::CBuilder::Platform::os2;
-$ExtUtils::CBuilder::Platform::os2::VERSION = '0.280225';
+$ExtUtils::CBuilder::Platform::os2::VERSION = '0.280226';
 use warnings;
 use strict;
 use ExtUtils::CBuilder::Platform::Unix;
-- 
2.7.4

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2017

From @jkeenan

On Thu, 13 Jul 2017 15​:39​:49 GMT, zhouzhen1@​gmail.com wrote​:

This is a bug report for perl from zhouzhen1@​gmail.com,
generated with the help of perlbug 1.40 running under perl 5.26.0.

-----------------------------------------------------------------
[Please describe your issue here]
There is a bug in finding C++ compiler. Patch is at
https://github.com/Perl-
Toolchain-Gang/ExtUtils-CBuilder/pull/6

For the record, could we get in this RT (from you or from ambs) a bit more description as to what the bug actually is?

The description in that pull request is rather terse.

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2017

From @jkeenan

On Fri, 14 Jul 2017 13​:17​:48 GMT, ambs wrote​:

Patch attached.

Are there any regression tests that we could perform and include in the patch?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2017

From ambs@zbr.pt

On 07/14/2017 08​:42 PM, James E Keenan via RT wrote​:

For the record, could we get in this RT (from you or from ambs) a bit
more description as to what the bug actually is?

Regarding the problem, parsefile return arguments were being considered
as 'path', 'basename' and 'extension' but they are 'basename', 'path'
and 'extension'

Are there any regression tests that we could perform and include in the patch?

As far as I can tell, there was already a test, but it was returning 'no
C++ compiler' to everyone, even for those who had it. But the test
passed anyway because we can't fail if the user doesn't have a C++ compiler.

So, not sure how to make a regression test. But suggestions are welcome.

Thanks
ambs

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2017

From @csjewell

Maybe have it look for a 'pretend compiler' of your own in a directory
that you put in front of the path?

(throwing out an idea - I don't know how feasible it would be)

--Curtis

--
Curtis Jewell
csjewell@​cpan.org http​://csjewell.dreamwidth.org/
perl@​curtisjewell.name http​://www.curtisjewell.name/
"Your random numbers are not that random" -- perl-5.10.1.tar.gz/util.c

On Fri, Jul 14, 2017, at 14​:04, Alberto Simoes wrote​:

On 07/14/2017 08​:42 PM, James E Keenan via RT wrote​:

For the record, could we get in this RT (from you or from ambs) a bit
more description as to what the bug actually is?

Regarding the problem, parsefile return arguments were being considered
as 'path', 'basename' and 'extension' but they are 'basename', 'path'
and 'extension'

Are there any regression tests that we could perform and include in the patch?

As far as I can tell, there was already a test, but it was returning 'no
C++ compiler' to everyone, even for those who had it. But the test
passed anyway because we can't fail if the user doesn't have a C++
compiler.

So, not sure how to make a regression test. But suggestions are welcome.

Thanks
ambs

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2017

From ambs@zbr.pt

On 07/14/2017 09​:22 PM, Curtis Jewell wrote​:

Maybe have it look for a 'pretend compiler' of your own in a directory
that you put in front of the path?

(throwing out an idea - I don't know how feasible it would be)

Not sure.
I think this is a major bug the shouldn't be kept from correction for a
missing test.

But I will try to find something... when I have some more time.
ambs

--Curtis

--
Curtis Jewell
csjewell@​cpan.org http​://csjewell.dreamwidth.org/
perl@​curtisjewell.name http​://www.curtisjewell.name/
"Your random numbers are not that random" -- perl-5.10.1.tar.gz/util.c

On Fri, Jul 14, 2017, at 14​:04, Alberto Simoes wrote​:

On 07/14/2017 08​:42 PM, James E Keenan via RT wrote​:

For the record, could we get in this RT (from you or from ambs) a bit
more description as to what the bug actually is?

Regarding the problem, parsefile return arguments were being considered
as 'path', 'basename' and 'extension' but they are 'basename', 'path'
and 'extension'

Are there any regression tests that we could perform and include in the patch?

As far as I can tell, there was already a test, but it was returning 'no
C++ compiler' to everyone, even for those who had it. But the test
passed anyway because we can't fail if the user doesn't have a C++
compiler.

So, not sure how to make a regression test. But suggestions are welcome.

Thanks
ambs

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2017

From @jkeenan

On Fri, 14 Jul 2017 20​:05​:00 GMT, ambs@​perl-hackers.net wrote​:

On 07/14/2017 08​:42 PM, James E Keenan via RT wrote​:

For the record, could we get in this RT (from you or from ambs) a bit
more description as to what the bug actually is?

Regarding the problem, parsefile return arguments were being
considered
as 'path', 'basename' and 'extension' but they are 'basename', 'path'
and 'extension'

Yes. What I would like to do is work the attachment '131749-extra-commit.txt' into the commit message. Is that wording acceptable?

Are there any regression tests that we could perform and include in
the patch?

As far as I can tell, there was already a test, but it was returning
'no
C++ compiler' to everyone, even for those who had it. But the test
passed anyway because we can't fail if the user doesn't have a C++
compiler.

So, not sure how to make a regression test. But suggestions are
welcome.

I extracted ExtUtils-CBuilder from core and treated it as if it were its own distribution. I ran the tests through Devel​::Cover and observed that much of the code following this line in ExtUtils​::CBuilder​::Base​::new() was not being exercised at all by the test suite​:

#####
  foreach my $cxx (@​{$cc2cxx{$ccbase}}) {
#####

I then applied your patch to this code base and re-ran it through Devel​::Cover. Coverage visibly improved. So now the tests are better doing what they were intended to do. For me, at least, this diminishes the need for new regression tests.

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2017

From @jkeenan

File​::Basename​::fileparse(), when called with two arguments, is documented to return a list of three elements​:

  The non-suffix part of the file's basename.

  The file's dirname, plus trailing path separator.

  The suffix part of the file's basename.

Thus,

  my ($name,$path,$suffix) = fileparse('/tmp/perl/p5p/foo.patch', qr/\.[^.]*/);

returns​:

  $name​: foo
  $path​: /tmp/perl/p5p/
  $suffix​: .patch

If we want to take those values and compose a path with File​::Spec->catfile(), we have to bear in mind that File​::Spec generally expects to have directories precede filenames in its arguments. Thus, the correct way to use the values returned by fileparse() would be​:

  my $cf = File​::Spec->catfile($path, $name . $suffix);

In ExtUtils​::CBuilder​::Base​::new(), however, the return values from fileparse() were named in a way that suggested that the first value would be the dirname and the second would be the non-suffix part of the basename​:

  my ($ccpath, $ccbase, $ccsfx ) = fileparse($self->{config}{cc}, qr/\.[^.]*/);

$ccpath -- which here is really a basename -- was then used as the first argument to catfile()​:

  File​::Spec->catfile( $ccpath, $cxx, $ccsfx )

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2017

From ambs@zbr.pt

On 07/15/2017 03​:06 PM, James E Keenan via RT wrote​:

On Fri, 14 Jul 2017 20​:05​:00 GMT, ambs@​perl-hackers.net wrote​:

On 07/14/2017 08​:42 PM, James E Keenan via RT wrote​:

For the record, could we get in this RT (from you or from ambs) a bit
more description as to what the bug actually is?

Regarding the problem, parsefile return arguments were being
considered
as 'path', 'basename' and 'extension' but they are 'basename', 'path'
and 'extension'

Yes. What I would like to do is work the attachment '131749-extra-commit.txt' into the commit message. Is that wording acceptable?

Yes. I would had that there was another issue​:

  catfile was used with three arguments, path, basename and extension.
But extension needs to be concatenated without a path separator, and
therefore, can't be used as a single argument in catfile.

Thanks

Are there any regression tests that we could perform and include in
the patch?

As far as I can tell, there was already a test, but it was returning
'no
C++ compiler' to everyone, even for those who had it. But the test
passed anyway because we can't fail if the user doesn't have a C++
compiler.

So, not sure how to make a regression test. But suggestions are
welcome.

I extracted ExtUtils-CBuilder from core and treated it as if it were its own distribution. I ran the tests through Devel​::Cover and observed that much of the code following this line in ExtUtils​::CBuilder​::Base​::new() was not being exercised at all by the test suite​:

#####
foreach my $cxx (@​{$cc2cxx{$ccbase}}) {
#####

I then applied your patch to this code base and re-ran it through Devel​::Cover. Coverage visibly improved. So now the tests are better doing what they were intended to do. For me, at least, this diminishes the need for new regression tests.

Thank you very much.

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2017

From ambs@zbr.pt

On 07/15/2017 03​:46 PM, Alberto Simoes wrote​:

On 07/15/2017 03​:06 PM, James E Keenan via RT wrote​:

On Fri, 14 Jul 2017 20​:05​:00 GMT, ambs@​perl-hackers.net wrote​:

On 07/14/2017 08​:42 PM, James E Keenan via RT wrote​:

For the record, could we get in this RT (from you or from ambs) a bit
more description as to what the bug actually is?

Regarding the problem, parsefile return arguments were being
considered
as 'path', 'basename' and 'extension' but they are 'basename', 'path'
and 'extension'

Yes. What I would like to do is work the attachment
'131749-extra-commit.txt' into the commit message. Is that wording
acceptable?

Yes. I would had that there was another issue​:

catfile was used with three arguments, path, basename and extension.
But extension needs to be concatenated without a path separator, and
therefore, can't be used as a single argument in catfile.

Thanks

Gosh. I would *add*

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2017

From @jkeenan

On Sat, 15 Jul 2017 14​:47​:13 GMT, ambs@​perl-hackers.net wrote​:

On 07/15/2017 03​:06 PM, James E Keenan via RT wrote​:

On Fri, 14 Jul 2017 20​:05​:00 GMT, ambs@​perl-hackers.net wrote​:

On 07/14/2017 08​:42 PM, James E Keenan via RT wrote​:

For the record, could we get in this RT (from you or from ambs) a
bit
more description as to what the bug actually is?

Regarding the problem, parsefile return arguments were being
considered
as 'path', 'basename' and 'extension' but they are 'basename',
'path'
and 'extension'

Yes. What I would like to do is work the attachment '131749-extra-
commit.txt' into the commit message. Is that wording acceptable?

Yes. I would had that there was another issue​:

catfile was used with three arguments, path, basename and extension.
But extension needs to be concatenated without a path separator, and
therefore, can't be used as a single argument in catfile.

Thanks

Are there any regression tests that we could perform and include in
the patch?

As far as I can tell, there was already a test, but it was returning
'no
C++ compiler' to everyone, even for those who had it. But the test
passed anyway because we can't fail if the user doesn't have a C++
compiler.

So, not sure how to make a regression test. But suggestions are
welcome.

I extracted ExtUtils-CBuilder from core and treated it as if it were
its own distribution. I ran the tests through Devel​::Cover and
observed that much of the code following this line in
ExtUtils​::CBuilder​::Base​::new() was not being exercised at all by the
test suite​:

#####
foreach my $cxx (@​{$cc2cxx{$ccbase}}) {
#####

I then applied your patch to this code base and re-ran it through
Devel​::Cover. Coverage visibly improved. So now the tests are
better doing what they were intended to do. For me, at least, this
diminishes the need for new regression tests.

Thank you very much.

Thanks, pushed to blead in a83beb4.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2017

@jkeenan - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Jul 15, 2017
@p5pRT
Copy link
Author

p5pRT commented Jul 15, 2017

From ambs@zbr.pt

On 07/15/2017 06​:03 PM, James E Keenan via RT wrote​:

Thanks, pushed to blead in a83beb4.

Ty!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant