* Nick Ing-Simmons <[EMAIL PROTECTED]> shaped the electrons to say...

I have seen weird fails like this when varying large file support
and 64/32 bit IV Configure options.

What happens is that 'offset' (your variable) is wrong size for Off_t and PerlIO_seek mis-interprets what it gets in its incoming args.

You seem to have a small-file 32-bit perl (from -V output below).

That is correct. And yes, the 'offset' is really a 'ogg_int64_t'. Although
it's certainly not a 64bit value.

'ogg' ?? How big is it.

It depends on the platform:


  typedef __int64 ogg_int64_t;
  typedef _G_int64_t ogg_int64_t;
  typedef SInt64 ogg_int64_t;
  typedef int64_t ogg_int64_t;
  typedef int64_t ogg_int64_t;
  typedef long long ogg_int64_t;
  typedef long long ogg_int64_t;
  typedef long ogg_int64_t;

I've tried casting it to a Off_t to no effect.

Hmm, perhaps Off_t itself is off.
Did you pass same -D flags to your compile as perl build?
For 32-bit build perl uses off_t as Off_t - which is all very well
but Linux at least varies size of off_t based on -D options of _your_ compile. So if your command line or one of headers included by your XS code defines (say) __USE_FILE_OFFSET64 things get confused.

This is debian unstable, and it appears that -D_FILE_OFFSET_BITS=64 is passed.


cc -c -I/usr/include/vorbis -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -DVERSION=\"0.5\" -DXS_VERSION=\"0.5\" -fPIC "-I/usr/lib/perl/5.8/CORE" -g Decoder.c

Suggestions here?

Add some diagnostics to XS code e.g. warn("Passing offset size=%d Off_t=%d",sizeof(offset),sizeof(Off_t));

Passing offset size=8 Off_t=8 at test.pl line 12.


Can I/we see:
 A. Your declaration of "offset"

static int ovcb_seek(void *vdatasource, ogg_int64_t offset, int whence) {


B. Typedef(s) of types involved from any system/library .h files?

typedef int64_t ogg_int64_t;


C. CPP-ed code of call to PerlIO_seek().

int Perl_PerlIO_seek(register PerlInterpreter *my_perl __attribute__((unused)), PerlIO *, off64_t, int);


and

return Perl_PerlIO_seek(((PerlInterpreter *)pthread_getspecific((*Perl_Gthr_key_ptr(((void *)0))))), datasource->stream,offset,whence);

-D
--
Are we there yet?

Reply via email to