Opened 8 years ago
#10122 new Patches
Recent Python versions trigger compiler error on AIX when compiling modules/regex.c: conflicting types for 'fgetpos64'
Reported by: | Owned by: | Vladimir Prus | |
---|---|---|---|
Milestone: | To Be Determined | Component: | build |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Since bugs.python.org/issue11184, recent Python releases (like Python-2.7.6) now have proper large-file support for AIX, defining _LARGE_FILES in <pyconfig.h>, exposed to the user via <Python.h>.
Now, bootstrapping boost.build for AIX using such a Python release causes the compiler errors shown in attached files when compiling modules/regex.c.
The problem with modules/regex.c is:
modules/regex.c
first includes"../mem.h"
mem.h
includes<stdlib.h>
includes<standards.h>
Due to nothing relevant being defined yet, <standards.h>
defines _LARGE_FILE_API
stdlib.h
includes<sys/types.h>
sys/types.h
does {typedef long fpos_t;
}, because_LARGE_FILES
is not defined
If _LARGE_FILES
were defined before, sys/types.h
would have done {typedef long long fpos_t;
} here.
sys/types.h
does {typedef long long fpos64_t;
} due to_LARGE_FILE_API
being definedmodules/regex.c
includes"../native.h"
includes"function.h"
includes"frames.h"
includes"lists.h"
includes<Python.h>
includes [<pyconfig.h>
,<stdio.h>
]pyconfig.h
defines_LARGE_FILES
stdio.h
does not redefine thefpos_t
thingsstdio.h
does {#define fgetpos fgetpos64
} due to_LARGE_FILES
being defined nowstdio.h
declares {extern int fgetpos(FILE*,fpos_t);
}, but rememberfgetpos
is defined tofgetpos64
stdio.h
declares {extern int fgetpos64(FILE*,fpos64_t);
} due to_LARGE_FILE_API
being defined
This problem is the same for the other functions the compilers yell about.
Also, the same errors occur with current git master.
For the fix:
It is important to have all the ABI specific precompiler macros being defined before including any system header. Actually, the first thing "jam.h"
does is to include <Python.h>
. But with modules/regex.c
first including "../mem.h"
including <stdlib.h>
, this rule is not followed. So the fix here is:
--- a/src/engine/mem.h +++ b/src/engine/mem.h @@ -8,6 +8,8 @@ #ifndef BJAM_MEM_H #define BJAM_MEM_H +#include "jam.h" + #ifdef OPT_BOEHM_GC /* Use Boehm GC memory allocator. */
While the fix for this very problem is quite simple, it doesn't look like if <Python.h>
being included first everywhere else in build.git/src/engine is on purpose actually...
Thank you!
compiler errors with gcc