Skip Menu |

This queue is for tickets about the Time-HiRes CPAN distribution.

Report information
The Basics
Id: 111391
Status: resolved
Priority: 0/
Queue: Time-HiRes

People
Owner: Nobody in particular
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.9727_03
Fixed in: (no value)



Subject: Add an environment variable to skip running configuration probes
Hi, I'm looking at cross compiling Time-HiRes, and the configuration probes are something of a problem. They are currently implemented by compiling and running small test programs, but in cross compiling situations running the probes is hard or impossible. On at least my GNU/Linux system, just compilation success or failure seems to be enough for getting the right configuration. Would you consider adding an opt-in facility to just compile but not run the probes? An environment variable would work fine for this purpose, see the attached patch (also available at https://github.com/ntyni/Time-HiRes/commit/8ad8c8af5fd04e272de370314940d5c28649c8e1 ). Alternatively, I suppose the hints mechanism could be used, but there doesn't currently seem to be a hook for overriding $DEFINE when sourcing the hints. Perhaps one could be added? A downside of this approach is that it requires locally patching the source to be built, as I expect it's not realistic to arrive at a generic 'linux' configuration. Maybe a way to provide an external hint file could solve this? Many thanks for your work, -- Niko Tyni ntyni@debian.org
Subject: 0001-Add-an-environment-variable-to-skip-running-configur.patch
From 8ad8c8af5fd04e272de370314940d5c28649c8e1 Mon Sep 17 00:00:00 2001 From: Niko Tyni <ntyni@debian.org> Date: Thu, 21 Jan 2016 18:47:05 +0200 Subject: [PATCH] Add an environment variable to skip running configuration probes When cross-compiling, running the probes is hard or impossible, but compiling them seems to get most things right at least on modern systems. Having an opt-in method to skip the running part by setting TIME_HIRES_DONT_RUN_PROBES=1 in the environment makes cross-compiling possible on such systems. The available method of skipping the probes completely based on %Config information does not seem usable: $Config{d_nanosleep} was short lived (perl-5.8.0-259-g2d73687 until perl-5.8.0-1750-g6bdd71e), and the d_clock* entries don't seem to ever have existed. See also the thread around http://www.nntp.perl.org/group/perl.perl5.porters/2003/07/msg77404.html --- Makefile.PL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.PL b/Makefile.PL index bbdd7a7..22aa0c2 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -150,7 +150,7 @@ __EOD__ my $res = system($cccmd); $ok = defined($res) && $res == 0 && -s $tmp_exe && -x _; - if ( $ok && exists $args{run} && $args{run}) { + if ( $ok && exists $args{run} && $args{run} && !$ENV{TIME_HIRES_DONT_RUN_PROBES} ) { my $tmp_exe = File::Spec->catfile(File::Spec->curdir, $tmp_exe); my @run = $tmp_exe; -- 2.7.0.rc3
How about skipping the test if we are running cross-compilation?
Subject: Re: [rt.cpan.org #111391] Add an environment variable to skip running configuration probes
Date: Sat, 13 Feb 2016 10:24:35 +0200
To: Jarkko_Hietaniemi via RT <bug-Time-HiRes [...] rt.cpan.org>
From: Niko Tyni <ntyni [...] iki.fi>
On Fri, Feb 12, 2016 at 09:45:37PM -0500, Jarkko_Hietaniemi via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=111391 > > > How about skipping the test if we are running cross-compilation?
(I assume you mean skipping to run the probes rather than skipping the probes altogether; compile-only probes work fine in cross settings.) How would we check for cross-compilation? With $Config{usecrosscompile} ? usecrosscompile (Cross.U): This variable conditionally defines the USE_CROSS_COMPILE symbol, and indicates that Perl has been cross-compiled. In practice, that's rather tied to the Perl core build method where you copy files over to a target machine with SSH or similar and run them there. Our current cross building method in Debian ends up with that unset. (I can elaborate on that, but this may not be quite the right place.) Of course, not having $Config{usecrosscompile} set can be considered a bug on the Debian side and not something that others should be bothered about. I'll just mention that there are some conflicting requirements here, as Debian cross building aims for ideally bit-by-bit identical build results between cross and native building. While we're not there yet, relying on a difference in Config.pm would be a step backward rather than forward. Putting aside the Debian constraints, it might also be useful to be able to cross build a separate Time-HiRes distribution for a target architecture perl (=Config.pm) that was not cross built itself, and therefore $Config{usecrosscompile} isn't set. So I'd like a check that's based on the current cross-compilation situation and not the properties of how Perl itself was compiled. Using $Config{usecrosscompile} but leaving an environment variable override would work for me, we have Debian-specific methods for detecting cross builds. But maybe I'm just missing some other simple and generic check for detecting cross compiling situations? Thanks for looking at this, -- Niko
Fixed in 1.9731.