Bug 89354 - compilation errors on AIX (conflicting types for 'fgetpos64' ...)
Summary: compilation errors on AIX (conflicting types for 'fgetpos64' ...)
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other AIX
: medium normal
Assignee: Chris Wilson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-27 09:29 UTC by Michael Haubenwallner
Modified: 2015-03-07 01:57 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
fix include order for AIX in test/ (16.83 KB, patch)
2015-02-27 09:36 UTC, Michael Haubenwallner
Details | Splinter Review
fix include order for AIX in perf/micro/ (1.93 KB, patch)
2015-02-27 09:38 UTC, Michael Haubenwallner
Details | Splinter Review
fix include order for AIX in perf/ (1.13 KB, patch)
2015-02-27 09:39 UTC, Michael Haubenwallner
Details | Splinter Review
fix include order for AIX for headers-standalone check (1.63 KB, patch)
2015-02-27 10:40 UTC, Michael Haubenwallner
Details | Splinter Review
fix include order for AIX for cairo-xcb-private.h too (790 bytes, patch)
2015-02-27 13:31 UTC, Michael Haubenwallner
Details | Splinter Review

Description Michael Haubenwallner 2015-02-27 09:29:04 UTC
In file included from /.../cairo-9999/boilerplate/cairo-boilerplate.h:33,
                 from /.../cairo-9999/test/cairo-test.h:29,
                 from /.../cairo-9999/test/clip-nesting.c:27:
/tools/haubi/.../usr/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.4/include/stdio.h:542: error: conflicting types for fgetpos64
/tools/haubi/.../usr/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.4/include/stdio.h:337: error: previous declaration of fgetpos64 was here
/tools/haubi/.../usr/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.4/include/stdio.h:545: error: conflicting types for fseeko64
/tools/haubi/.../usr/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.4/include/stdio.h:485: error: previous declaration of fseeko64 was here
/tools/haubi/.../usr/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.4/include/stdio.h:546: error: conflicting types for fsetpos64
/tools/haubi/.../usr/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.4/include/stdio.h:339: error: previous declaration of fsetpos64 was here
/tools/haubi/.../usr/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.4/include/stdio.h:547: error: conflicting types for ftello64
/tools/haubi/.../usr/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.4/include/stdio.h:486: error: previous declaration of ftello64 was here
Makefile:3198: recipe for target cairo_test_suite-clip-nesting.o failed
make[4]: *** [cairo_test_suite-clip-nesting.o] Error 1

Analysis along fgetpos64():

clip-nesting.c        does include <math.h>
<math.h>              does include <standards.h>
<standards.h>         does #define _LARGE_FILE_API
<math.h>              does include <stdlib.h>
<stdlib.h>            does include <sys/wait.h>
<sys/wait.h>          does include <sys/types.h>
<sys/types.h>         does typedef long fpos_t;        //for !_LARGE_FILES
                           typedef long long fpos64_t; //for _LARGE_FILE_API
clip-nesting.c        does include "cairo-test.h"
"cairo-test.h"        does include "cairo-boilerplate.h"
"cairo-boilerplate.h" does include "config.h"
"config.h"            does #define _LARGE_FILES        //too late for fpos_t
"cairo-boilerplate.h" does include <stdio.h>
<stdio.h>             does #define fgetpos fgetpos64   //for _LARGE_FILES
                           declare fgetpos(fpos_t)
                           declare fgetpos64(fpos64_t) //for _LARGE_FILE_API

Resolving defines and typedefs, the conflicting result is:
  extern int fgetpos64(FILE*, long);
  extern int fgetpos64(FILE*, long long);

Root cause is that _LARGE_FILES was not defined before <sys/types.h>,
otherways <sys/types.h> would have done typedef long long fpos_t;

So for AIX it is really important to define ABI-macros (here: _LARGE_FILES) _before_ including _any_ system header.
Comment 1 Michael Haubenwallner 2015-02-27 09:36:39 UTC
Created attachment 113860 [details] [review]
fix include order for AIX in test/
Comment 2 Michael Haubenwallner 2015-02-27 09:38:41 UTC
Created attachment 113861 [details] [review]
fix include order for AIX in perf/micro/
Comment 3 Michael Haubenwallner 2015-02-27 09:39:37 UTC
Created attachment 113862 [details] [review]
fix include order for AIX in perf/

The last one for this bug.
Comment 4 Michael Haubenwallner 2015-02-27 10:40:24 UTC
Created attachment 113865 [details] [review]
fix include order for AIX for headers-standalone check

Additionally, make check raised two more of these problems.
Comment 5 Michael Haubenwallner 2015-02-27 13:31:01 UTC
Created attachment 113866 [details] [review]
fix include order for AIX for cairo-xcb-private.h too

Somehow forgot to add cairo-xcb-private.h, raised by the standalone-headers check as well.
Comment 6 Bryce Harrington 2015-03-06 01:21:44 UTC
Thanks, whole set applied:
   e9a615a..4e680ff  master -> master


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.