Skip Menu |
 

This queue is for tickets about the Params-Validate CPAN distribution.

Report information
The Basics
Id: 17644
Status: resolved
Priority: 0/
Queue: Params-Validate

People
Owner: Nobody in particular
Requestors: cpan [...] fireartist.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.80
Fixed in: 0.85



Subject: compiler detection broken with mingw on winXP
Download (untitled) / with headers
text/plain 2.4k
Show quoted text
>perl Makefile.PL
Testing if you have a C compiler dmake: Error: -- Don't know how to make `test.o' Compiler detection doesn't work. Compiles, tests and installs ok if --xs flag used. WinXP SP 2 gcc 3.4.5 Show quoted text
>perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=define use5005threads=undef useithreads=define usemultiplicity=de fine useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTE XT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -DPERL_MSVCRT_READFIX', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='3.4.5', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long long', lseek size=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"c:\vanilla-perl\perl\lib\CORE" -L"C:\vanilla-perl\ MinGW\lib"' libpth=C:\vanilla-perl\MinGW\lib libs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 perllibs= -lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdl g32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lw inmm -lversion -lodbc32 -lodbccp32 libc=-lmsvcrt, so=dll, useshrplib=yes, libperl=libperl58.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"c:\vanilla-perl\perl\lib\CORE" -L"C:\ vanilla-perl\MinGW\lib"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO Built under MSWin32 Compiled at Feb 10 2006 10:33:10 @INC: c:/vanilla-perl/perl/lib c:/vanilla-perl/perl/site/lib .
Subject: Re: [rt.cpan.org #17644] compiler detection broken with mingw on winXP
Date: Tue, 14 Feb 2006 10:09:45 -0600 (CST)
To: Carl Franks via RT <bug-Params-Validate [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
Download (untitled) / with headers
text/plain 564b
On Tue, 14 Feb 2006, Carl Franks via RT wrote: Show quoted text
>> perl Makefile.PL
> Testing if you have a C compiler > dmake: Error: -- Don't know how to make `test.o' > > Compiler detection doesn't work. > Compiles, tests and installs ok if --xs flag used.
This isn't going to get fixed without a patch. I don't know anything about compiling on Windows. -dave /*=================================================== VegGuide.Org www.BookIRead.com Your guide to all that's veg. My book blog ===================================================*/
Download (untitled) / with headers
text/plain 502b
Dave, I've just had a look at how scalar-list-utils does it now, and come up with this new Makefile.PL (attached) It uses Module::Install's can_cc() routine. I've missed out your if ( -d '.svn' ) {} section, you'll probably want to add that back in. It automatically compiles and tests ok on my machine. When you run the Makefile.PL for the first time, you should find it creates a new "inc" directory, which will be included in the tarball - that's as should be. Hope it works for you. Carl
Download Makefile.PL
text/x-perl 568b
use inc::Module::Install; my $do_xs = can_cc(); for (@ARGV) { /^--xs/ and $do_xs = 1; } name ('Params-Validate'); module_name ('Params::Validate'); author ('Dave Rolsky, <autarch@urth.org>'); abstract_from ('lib/Params/Validate.pm'); version_from ('lib/Params/Validate.pm'); license ('perl'); makemaker_args ( XS => {}, C => []) unless $do_xs; check_nmake(); # check and download nmake.exe for Win32 requires( 'Test::More' => 0 ); requires( 'Attribute::Handlers' => 0 ) if $] >= 5.006; &Makefile->write; &Meta->write;
Download (untitled) / with headers
text/plain 949b
On Tue Feb 14 11:39:10 2006, CFRANKS wrote: Show quoted text
> Dave, > > I've just had a look at how scalar-list-utils does it now, and come up > with this new Makefile.PL (attached) > It uses Module::Install's can_cc() routine. > > I've missed out your > if ( -d '.svn' ) {} > section, you'll probably want to add that back in. > > It automatically compiles and tests ok on my machine. > When you run the Makefile.PL for the first time, you should find it > creates a new "inc" directory, which will be included in the tarball - > that's as should be.
I'm not too keen on the idea of switching to Module::Install. I've never used it before and I'm just a little afraid that I'll get new and different bug reports if I do. Looking at can_cc, it's not even checking if you can compile code, just that you might have a compiler, although maybe that's better. Anyway, if you can come up with a fix that doesn't require Module::Install I'd be happy to apply it.
Download (untitled) / with headers
text/plain 313b
I've copied the logic from the can_run() and can_cc() routines from Module/Install/Can.pm and added it to the Makefile.PL I've tested this on: a windows xp machine with mingw compiler a windows xp with no compiler a linux machine with gnu gcc compiler and they've all worked as expected. The patch is attached.
Download Makefile.PL.diff
text/x-diff 1.1k
29,39c29,30 < unless ( open F, ">test.c" ) < { < warn "Cannot write test.c, skipping test compilation and install pure Perl version.\n"; < no_cc(); < } < < print F <<'EOF'; < int main() { return 0; } < EOF < < close F or no_cc(); --- > my @chunks = split(/ /, $Config::Config{cc}) or no_cc(); > my $found_cc; 41c32,41 < system("$Config{make} test$Config{obj_ext}") and no_cc(); --- > # $Config{cc} may contain args; try to find out the program part > while (@chunks) { > if ( $found_cc = can_run("@chunks") ) { > last; > } > else { > pop @chunks; > next; > } > } 42a43,48 > if ($found_cc) { > print "Using compiler: $found_cc\n"; > } > else { > no_cc(); > } 124a131,144 > } > > sub can_run { > my ($cmd) = @_; > > my $_cmd = $cmd; > return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); > > for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { > my $abs = File::Spec->catfile($dir, $cmd); > return $abs if (-x $abs or $abs = MM->maybe_command($abs)); > } > > return;
Download (untitled) / with headers
text/plain 542b
On Thu Apr 20 09:16:50 2006, CFRANKS wrote: Show quoted text
> I've copied the logic from the can_run() and can_cc() routines from > Module/Install/Can.pm and added it to the Makefile.PL > > I've tested this on: > a windows xp machine with mingw compiler > a windows xp with no compiler > a linux machine with gnu gcc compiler > > and they've all worked as expected. > > The patch is attached.
Another option may be to just use ExtUtils::CBuilder, which has a compiler detection function. It's used by Module::Build so it should be fairly widely tested.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.