Boost C++ Libraries: Ticket #10122: Recent Python versions trigger compiler error on AIX when compiling modules/regex.c: conflicting types for 'fgetpos64' https://svn.boost.org/trac10/ticket/10122 <p> 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 &lt;pyconfig.h&gt;, exposed to the user via &lt;Python.h&gt;. </p> <p> Now, bootstrapping boost.build for AIX using such a Python release causes the compiler errors shown in attached files when compiling modules/regex.c. </p> <p> The problem with modules/regex.c is: </p> <ul><li><code>modules/regex.c</code> first includes <code>"../mem.h"</code> </li><li><code>mem.h</code> includes <code>&lt;stdlib.h&gt;</code> includes <code>&lt;standards.h&gt;</code> </li></ul><p> Due to nothing relevant being defined yet, <code>&lt;standards.h&gt;</code> defines <code>_LARGE_FILE_API</code> </p> <ul><li><code>stdlib.h</code> includes <code>&lt;sys/types.h&gt;</code> </li><li><code>sys/types.h</code> does {<code>typedef long fpos_t;</code>}, because <code>_LARGE_FILES</code> is not defined </li></ul><p> If <code>_LARGE_FILES</code> were defined before, <code>sys/types.h</code> would have done {<code>typedef long long fpos_t;</code>} here. </p> <ul><li><code>sys/types.h</code> does {<code>typedef long long fpos64_t;</code>} due to <code>_LARGE_FILE_API</code> being defined </li><li><code>modules/regex.c</code> includes <code>"../native.h"</code> includes <code>"function.h"</code> includes <code>"frames.h"</code> includes <code>"lists.h"</code> includes <code>&lt;Python.h&gt;</code> includes [<code>&lt;pyconfig.h&gt;</code>, <code>&lt;stdio.h&gt;</code>] </li><li><code>pyconfig.h</code> defines <code>_LARGE_FILES</code> </li><li><code>stdio.h</code> does not redefine the <code>fpos_t</code> things </li><li><code>stdio.h</code> does {<code>#define fgetpos fgetpos64</code>} due to <code>_LARGE_FILES</code> being defined now </li><li><code>stdio.h</code> declares {<code>extern int fgetpos(FILE*,fpos_t);</code>}, but remember <code>fgetpos</code> is defined to <code>fgetpos64</code> </li><li><code>stdio.h</code> declares {<code>extern int fgetpos64(FILE*,fpos64_t);</code>} due to <code>_LARGE_FILE_API</code> being defined </li></ul><p> This problem is the same for the other functions the compilers yell about. </p> <p> Also, the same errors occur with current git master. </p> <p> 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 <code>"jam.h"</code> does is to include <code>&lt;Python.h&gt;</code>. But with <code>modules/regex.c</code> first including <code>"../mem.h"</code> including <code>&lt;stdlib.h&gt;</code>, this rule is not followed. So the fix here is: </p> <pre class="wiki">--- 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. */ </pre><p> While the fix for this very problem is quite simple, it doesn't look like if <code>&lt;Python.h&gt;</code> being included first everywhere else in build.git/src/engine is on purpose actually... </p> <p> Thank you! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10122 Trac 1.4.3 Michael Haubenwallner <michael.haubenwallner@…> Fri, 13 Jun 2014 13:13:22 GMT attachment set https://svn.boost.org/trac10/ticket/10122 https://svn.boost.org/trac10/ticket/10122 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-build-gcc.log.gz</span> </li> </ul> <p> compiler errors with gcc </p> Ticket Michael Haubenwallner <michael.haubenwallner@…> Fri, 13 Jun 2014 13:13:59 GMT attachment set https://svn.boost.org/trac10/ticket/10122 https://svn.boost.org/trac10/ticket/10122 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-build-xlc.log.gz</span> </li> </ul> <p> compiler errors with xlc </p> Ticket