Re: make problem with xs file (Time::Object)

2003-12-31 Thread Will Glass-Husain
Great!  I'm impressed. That was really quite obscure.

For the record, here's how I installed Time-Object following your advice
(changing the name of the two subroutines to avoid name conflicts with Perl
5.8.x)

perl -MCPAN -e 'get Time::Object'
cd /tmp/.cpan/build/Time-Object-1.00
perl -pi -e s/init_tm/time_object_init_tm/ Object.xs
perl -pi -e s/mini_mktime/time_object_mini_mktime/ Object.xs
perl Makefile.PL
make
make install

Thanks, WILL


- Original Message - 
From: Drieux [EMAIL PROTECTED]
Newsgroups: perl.beginners
To: Will Glass-Husain [EMAIL PROTECTED]
Cc: Perl Beginners Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 3:09 PM
Subject: Re: make problem with xs file (Time::Object)



 On Dec 29, 2003, at 11:00 AM, Will Glass-Husain wrote:
 [..]
  P.S.  In case anyone else has hit this error, this was pulled directly
  from
  cpan install Time::Object.
 
  [EMAIL PROTECTED] Time-Object-1.00]# make
  gcc -c   -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING
  -fno-str
  ict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
  -D_FILE_OFFSET_BITS=64
   -I/usr/include/gdbm -DPERL_POLLUTE  -O2 -march=i386 -mcpu=i686 -g
  -DVERSI
  ON=\1.00\ -DXS_VERSION=\1.00\ -fPIC
  -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE   Object.c
  Object.xs:34: parse error before '(' token
 [..]

 folks are probably not going to believe what I think
 is the Problem here is a bit convoluted to try to explain.

 What seems to have happened in 5.8.X is that now the
 embed.h is there and it is being called out by perl.h
 and it would be really nice if there were some form of

 #ifndef PERL_EMB_H
 #define PERL_EMB_H
 
 #endif

 then one could modify the Makefile.PL for Time::Object

 'XSPROTOARG' = ' -prototypes',
  'DEFINE' = '-D PERL_EMB_H',

 and it would prevent the compiler from picking up where
 it is re-defining bouth init_tm() and mini_mktime()

 meatbop: 65:] grep init_tm *.h
 embed.h:#define init_tm Perl_init_tm
 embed.h:#define init_tm(a)  Perl_init_tm(aTHX_ a)
 proto.h:PERL_CALLCONV void  Perl_init_tm(pTHX_ struct tm *ptm);
 meatbop: 66:] grep mini_mktime *.h
 embed.h:#define mini_mktime Perl_mini_mktime
 embed.h:#define mini_mktime(a)  Perl_mini_mktime(aTHX_ a)
 proto.h:PERL_CALLCONV void  Perl_mini_mktime(pTHX_ struct tm *pm);
 meatbop: 67:] pwd
 /usr/lib/perl5/5.8.1/i586-linux-thread-multi/CORE
 meatbop: 68:]

 so the trick is to edit the Object.xs file so that
 one commits the two tolks to being really the ones
 that are local to the code that it will be creating

 1,$s/init_tm/time_object_init_tm/g
 1,$s/mini_mktime/time_object_mini_mktime/g

 and now your code will not have function names that will
 get into an argument. I have cc'd matt into this, in the
 hope that he may have a better fix.

 ciao
 drieux





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: make problem with xs file (Time::Object)

2003-12-30 Thread drieux
On Dec 29, 2003, at 11:00 AM, Will Glass-Husain wrote:
[..]
P.S.  In case anyone else has hit this error, this was pulled directly 
from
cpan install Time::Object.

[EMAIL PROTECTED] Time-Object-1.00]# make
gcc -c   -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
-fno-str
ict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64
 -I/usr/include/gdbm -DPERL_POLLUTE  -O2 -march=i386 -mcpu=i686 -g   
-DVERSI
ON=\1.00\ -DXS_VERSION=\1.00\ -fPIC
-I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE   Object.c
Object.xs:34: parse error before '(' token
[..]

folks are probably not going to believe what I think
is the Problem here is a bit convoluted to try to explain.
What seems to have happened in 5.8.X is that now the
embed.h is there and it is being called out by perl.h
and it would be really nice if there were some form of
#ifndef PERL_EMB_H
#define PERL_EMB_H

#endif
then one could modify the Makefile.PL for Time::Object

'XSPROTOARG' = ' -prototypes',
'DEFINE' = '-D PERL_EMB_H',
and it would prevent the compiler from picking up where
it is re-defining bouth init_tm() and mini_mktime()
meatbop: 65:] grep init_tm *.h
embed.h:#define init_tm Perl_init_tm
embed.h:#define init_tm(a)  Perl_init_tm(aTHX_ a)
proto.h:PERL_CALLCONV void  Perl_init_tm(pTHX_ struct tm *ptm);
meatbop: 66:] grep mini_mktime *.h
embed.h:#define mini_mktime Perl_mini_mktime
embed.h:#define mini_mktime(a)  Perl_mini_mktime(aTHX_ a)
proto.h:PERL_CALLCONV void  Perl_mini_mktime(pTHX_ struct tm *pm);
meatbop: 67:] pwd
/usr/lib/perl5/5.8.1/i586-linux-thread-multi/CORE
meatbop: 68:]
so the trick is to edit the Object.xs file so that
one commits the two tolks to being really the ones
that are local to the code that it will be creating
1,$s/init_tm/time_object_init_tm/g
1,$s/mini_mktime/time_object_mini_mktime/g
and now your code will not have function names that will
get into an argument. I have cc'd matt into this, in the
hope that he may have a better fix.
ciao
drieux


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response