This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python 2.7.6 fails to build _ctypes on GCC 2.x toolchain
Type: compile error Stage:
Components: Build Versions: Python 2.7
process
Status: closed Resolution: later
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, jamercee, terry.reedy
Priority: normal Keywords: patch

Created on 2013-12-16 13:34 by jamercee, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ffi_common.h.patch jamercee, 2013-12-16 13:34 Patch to ffi_common.h
Messages (4)
msg206307 - (view) Author: Jim Carroll (jamercee) * Date: 2013-12-16 13:34
When building Python 2.7.6 on older GCC 2.x, the _ctypes module fails to build. The failure is caused due to a header file reference to __builtin_expect (the author expected this to be available when the module was built with gcc, but did not take into account that this was not available in all versions of gcc).

The solution is a simple modification to the test in ffi_common.h

--- Modules/_ctypes/libffi/include/ffi_common.h Sun Nov 10 02:36:41 2013
+++ Modules/_ctypes/libffi/include/ffi_common.h.fix     Mon Dec 16 08:23:56 2013
@@ -115,7 +115,7 @@

 typedef float FLOAT32;

-#ifndef __GNUC__
+#if !defined(__GNUC__) || __GNUC__==2
 #define __builtin_expect(x, expected_value) (x)
 #endif
 #define LIKELY(x)    __builtin_expect(!!(x),1)
msg206366 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2013-12-16 20:47
Modules/_ctypes/libffi directory contains a copy of externally maintained libffi library. Please report problem to libffi maintainers:
https://github.com/atgreen/libffi
msg206480 - (view) Author: Jim Carroll (jamercee) * Date: 2013-12-17 20:17
As requested, I've opened the issue with the libffi project:

https://github.com/atgreen/libffi/issues/63
msg206718 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-12-20 23:28
I believe an upstream change will be automatically picked up by any subsequent CPython release without an explicit tracker patch.
History
Date User Action Args
2022-04-11 14:57:55adminsetgithub: 64197
2013-12-20 23:28:46terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg206718

resolution: later
2013-12-17 20:17:05jamerceesetmessages: + msg206480
2013-12-16 20:47:28Arfreversetnosy: + Arfrever
messages: + msg206366
2013-12-16 13:34:41jamerceecreate