◐ Shell
clean mode source ↗

Message 118246 - Python tracker

Building Python 2.7 fails on FreeBSD 4.11 with gcc 2.95.4 as below:

"""
gcc -pthread -c -fno-strict-aliasing -g -O2 -DNDEBUG -g  -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -o Python/dtoa.o Python/dtoa.c
Python/dtoa.c:158: #error "Failed to find an exact-width 32-bit integer type"
gmake: *** [Python/dtoa.o] Error 1
"""

This error occurs when HAVE_UINT32_T or HAVE_INT32_T are not defined.
Those constants are defined in Include/pyport.h as:

"""
#if (defined UINT32_MAX || defined uint32_t)
#ifndef PY_UINT32_T
#define HAVE_UINT32_T 1
#define PY_UINT32_T uint32_t
#endif
#endif
"""

"""
#if (defined INT32_MAX || defined int32_t)
#ifndef PY_INT32_T
#define HAVE_INT32_T 1
#define PY_INT32_T int32_t
#endif
#endif
"""

This doesn't work for FreeBSD 4, where exact-width integer types are defined #typedef and does not provide *_MAX for them.

I don't think this is the right fix but adding following macro to pyport.h fixed the problem.

"""
#define UINT32_MAX 0xffffffff
#define INT32_MAX 0x7fffffff
"""