header file problem

Hi,

First off:
I am using Monentics 6.3 with service pack 1

I’ve been tring to compile libxml2 and keep getting errors invloving
fseeko. Heres the actual error:
/usr/qnx630/target/qnx6/usr/include/stdio.h:245: conflicting types for
fseeko' /usr/qnx630/target/qnx6/usr/include/stdio.h:175: previous declaration of fseeko’

I tracked the error to sys/platform.h before I got lost. If you somehow
include sys/platform.h, then define _FILE_OFFSET_BITS to 64, then
include stdio.h you get the error.

In 3 files libxml2 includes string.h before their libxml.h (which
defines _FILE_OFFSET_BITS to 64 and includes stdio.h). If I move the
string.h below libxml.h everthing compiles.

I was able to reproduce the problem out side of libxml2. Try to compile:
#include <sys/platform.h>
#define _FILE_OFFSET_BITS 64
#include <stdio.h>

int main()
{
printf(“hello\n”);
}

Move #include <sys/platform.h> below #include <stdio.h> and it will compile.

I believe this was not a problem before service pack 1.

Bryan

Bryan Newstrom wrote:

I was able to reproduce the problem out side of libxml2. Try to compile:
#include <sys/platform.h
#define _FILE_OFFSET_BITS 64
#include <stdio.h

You must define _FILE_OFFSET_BITS prior to the inclusion of any headers
(to avoid the mismatches between it changing between 32 or 64, so off_t
and other types are either 32 or 64 bits). Set it on the compile line
via -D_FILE_OFFSET_BITS= or via a CCFLAGS+=-D_FILE_OFFSET_BITS=.

In 3 files libxml2 includes string.h before their libxml.h (which
defines _FILE_OFFSET_BITS to 64 and includes stdio.h).

I would claim that is wrong. Although actually what they do is define
it only if it isn’t already defined, and at the very start of libxml.h,
so it would work if this was the very first file ever included. The
problem is our environment defaults to it being 32 if unset, and libxml
define it to be 64 if unset.

I believe this was not a problem before service pack 1.

6.3.0 didn’t have full 64-bit support for FILE*, so there was no
fseeko64() etc.

If you modify your Makefiles/configure to define _FILE_OFFSET_BITS=64,
or pass in via -D, so things will all have a consistent view, this
should work for you …

That cleared it up.

CFLAGS="-D_FILE_OFFSET_BITS=64" ./configure

Thanks John.

Bryan




John Garvey wrote:

Bryan Newstrom wrote:

I was able to reproduce the problem out side of libxml2. Try to compile:
#include <sys/platform.h
#define _FILE_OFFSET_BITS 64
#include <stdio.h


You must define _FILE_OFFSET_BITS prior to the inclusion of any headers
(to avoid the mismatches between it changing between 32 or 64, so off_t
and other types are either 32 or 64 bits). Set it on the compile line
via -D_FILE_OFFSET_BITS= or via a CCFLAGS+=-D_FILE_OFFSET_BITS=.

In 3 files libxml2 includes string.h before their libxml.h (which
defines _FILE_OFFSET_BITS to 64 and includes stdio.h).

I would claim that is wrong. Although actually what they do is define
it only if it isn’t already defined, and at the very start of libxml.h,
so it would work if this was the very first file ever included. The
problem is our environment defaults to it being 32 if unset, and libxml
define it to be 64 if unset.

I believe this was not a problem before service pack 1.

6.3.0 didn’t have full 64-bit support for FILE*, so there was no
fseeko64() etc.

If you modify your Makefiles/configure to define _FILE_OFFSET_BITS=64,
or pass in via -D, so things will all have a consistent view, this
should work for you …