I have assembled a bit of code that tries to determine the location of  
'typemap' in a more robust way, see below. Only tested on OS X 10.5.8  
so far. Would this be a viable replacement for the current logic in  
PP.pm (or does anybody know of a better way)? If so it needs testing  
on a bunch of platforms.

Christian

use File::Basename;
use File::Spec;

# so we get the system to pick up the path to the ExtUtils folder
require ExtUtils::MakeMaker;

my @res = grep /ExtUtils.*MakeMaker.pm/, keys %INC;
my $dir;
if (@res == 1) {
     $dir = dirname($INC{$res[0]});
} else {
     die "couldn't find ExtUtils::MakeMaker in %INC hash";
}

$tmloc = File::Spec->catfile($dir,'typemap');
if (-f $tmloc) {
     print "found typemap at $tmloc\n";
} else {
     die "no typemap at $tmloc";
}


On 5/09/2009, at 10:13 PM, Benjamin Schuster-Boeckler wrote:

> Yes, that did it! Thanks a lot, I don't think I'd have spotted that.
>
> Ben
>
> On 5 Sep 2009, at 11:46, Christian Soeller wrote:
>
>> For what it's worth, I came across a similar problem the other day.  
>> Basically, the (probably flaky) way that PP.pm guesses at the  
>> location of typemap files seems to fail on OS X.
>>
>> The line
>>
>>  my $_rootdir=$Config{installprivlib}."/ExtUtils/";
>>
>> is *not* finding typemap in any of the subdirs.
>>
>> I ended up hardcoding the location to the correct ExtUtils dir  
>> after finding it eventually:
>>
>> # try hardcoding for the moment
>> my $_rootdir="/System/Library/Perl/5.8.8/ExtUtils/";
>>
>> There should be a better (fully platform independent) way using one  
>> of the Config vars or using the value of @INC or some such, maybe  
>> somebody skilled in the art can enlighten us.
>>
>> Hope that helps,
>>
>> Christian
>>
>> On 5/09/2009, at 11:50 AM, Sisyphus wrote:
>>
>>>
>>> ----- Original Message -----
>>> From: "Benjamin Schuster-Boeckler" <[email protected]>
>>> To: <[email protected]>
>>> Sent: Friday, September 04, 2009 10:17 PM
>>> Subject: [Perldl] PDL compilation error on OS X 10.6
>>>
>>>
>>>> The new Snow Leopard system comes with perl 8.10.0 (from 5.8.6
>>>> previously), hence I wanted to recompile PDL. I'm getting the  
>>>> following:
>>>>
>>>> ---------------------------------------------
>>>> /usr/bin/perl -I/Users/schuster/Downloads/PDL-2.4.4_08/blib/lib -I/
>>>> Users/schuster/Downloads/PDL-2.4.4_08/blib/arch "-MPDL::PP qw/ 
>>>> PDL::Bad
>>>> PDL::Bad Bad/" bad.pd
>>>> The type =double= does not have a typemap entry!
>>>> make[2]: *** [Bad.pm] Error 2
>>>> make[1]: *** [subdirs] Error 2
>>>> make: *** [subdirs] Error 2
>>>> ---------------------------------------------
>>>>
>>>> A google suggests to check whether Inline::C works fine, and it  
>>>> does.
>>>> Does anyone have a clue what's going on here? PDL is the only  
>>>> module
>>>> that I'm having problems with...
>>>>
>>>
>>> It sems to be suggesting that there's no typemap entry for  
>>> 'double' - which
>>> is a bit hard to believe.
>>> Take a look in your /ExtUtils/typemap (same folder as  
>>> Makemaker.pm) and
>>> check that there is an entry for "double" in that file. Mine has:
>>>
>>> .....
>>> double   T_DOUBLE
>>> .....
>>> INPUT
>>> .....
>>> T_DOUBLE
>>> $var = (double)SvNV($arg)
>>> .....
>>> OUTPUT
>>> .....
>>> T_DOUBLE
>>> sv_setnv($arg, (double)$var);
>>>
>>> For an Inline::C check to see that there's no problems with  
>>> passing and
>>> returning doubles try:
>>>
>>> ###########################
>>> use warnings;
>>>
>>> use Inline C => Config =>
>>>  BUILD_NOISY => 1;
>>>
>>> use Inline C => <<'EOC';
>>>
>>> double foo(double x) {
>>>     return (double)x  * 2;
>>> }
>>>
>>> EOC
>>>
>>> print foo(17.3);
>>> ###########################
>>>
>>> Cheers,
>>> Rob
>>>
>>>
>>> _______________________________________________
>>> Perldl mailing list
>>> [email protected]
>>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>>
>> --
>> Christian Soeller PhD   Dept. of Physiology  +64 9 3737599 x82770
>> University of Auckland  Auckland, New Zealand  fax +64 9 3737499
>>
>
> --
> Benjamin Schuster-Böckler
> Frundsbergstrasse 23a
> 82064 Strasslach
> Deutschland
>
>

--
Christian Soeller PhD   Dept. of Physiology  +64 9 3737599 x82770
University of Auckland  Auckland, New Zealand  fax +64 9 3737499



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to