Artsize still not quite right in CURRENT
alexk at demon.net
Thu Apr 19 06:02:27 UTC 2001
James Ralston <qralston+ml.inn-workers at andrew.cmu.edu> writes:
> On 18 Apr 2001, Alex Kiernan wrote:
> > I found a RedHat 7 box to play on here, and whilst it needs a
> > #include <stdint.h> to get the uint32_t type, when run it gives:
> > pread broken - wrote badc0de, read deadbeef
> > [BTW someone who knows Linux better than me - should this build line
> > do the right thing:
> > gcc -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 checkpread.c]
> Close, but not quite. You're getting bitten because without at least
> "-D_XOPEN_SOURCE=500" (as per the pread man page), the definitions of
> the pread/pwrite functions are essentially commented out of unistd.h.
> You can see what's happening if you turn on warnings:
> $ gcc -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 checkpread.c
> checkpread.c: In function `main':
> checkpread.c:38: warning: implicit declaration of function `pread'
Darn, forgot about -Wall (I hardly ever use gcc).
> Because pread isn't declared, the -D_FILE_OFFSET_BITS=64 doesn't have
> a chance to apply to it, so when you link you wind up with the 32-bit
> version of pread.
> Since defining _XOPEN_SOURCE to 500 or greater automatically triggers
> _LARGEFILE_SOURCE, this is the compilation command you want:
> $ gcc -Wall -D_XOPEN_SOURCE=500 -D_FILE_OFFSET_BITS=64 checkpread.c
> I compiled checkpread.c on a Red Hat 7.1 system using the above
> compilation command, and when run it does the correct thing (that is,
> it produces no output).
So it looks like its just a compilation environment problem (which I
have to admit I didn't check all that closely)- can people who were
seeing the problem rebuild with this flag (or the next one? the linux
box I was using is gone from the network at the mo') & see if it fixes
> Really, I don't see any reason why INN shouldn't be compiled with the
> _GNU_SOURCE feature test macro on any system where the GNU C Library
> is detected. This is what glibc recommends. To quote glibc:
Looks like good advice to me?
Alex Kiernan, Principal Engineer, Development, Thus PLC
More information about the inn-workers