classification
Title: failed to build _ctypes: undefined reference to `ffi_closure_FASTCALL'
Type: Stage:
Components: Build, ctypes Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, siming85, zach.ware
Priority: normal Keywords: patch

Created on 2018-03-13 02:31 by siming85, last changed 2018-03-13 19:14 by siming85.

Files
File name Uploaded Description Edit
ffi.patch siming85, 2018-03-13 02:33
Messages (7)
msg313716 - (view) Author: Siming Yuan (siming85) * Date: 2018-03-13 02:31
compiling Python 3.5.5 under RHEL 6.4, 32-bit:

build/temp.linux-x86_64-3.5/opt/python/Python-3.5.5/Modules/_ctypes/libffi/src/x86/ffi.o: In function `ffi_prep_closure_loc':
/opt/python/Python-3.5.5/Modules/_ctypes/libffi/src/x86/ffi.c:678: undefined reference to `ffi_closure_FASTCALL'
/usr/bin/ld: build/temp.linux-x86_64-3.5/opt/python/Python-3.5.5/Modules/_ctypes/libffi/src/x86/ffi.o: relocation R_386_GOTOFF against undefined hidden symbol `ffi_closure_FASTCALL' can not be used when making a shared object
/usr/bin/ld: final link failed: Bad value


related to https://bugs.python.org/issue23042 - but it seems like the patch for x86/ffi.c never made it to release.
msg313717 - (view) Author: Siming Yuan (siming85) * Date: 2018-03-13 02:33
attached patch that fixes the build issue.

credit to davin @ https://bugs.python.org/issue23042
msg313720 - (view) Author: Siming Yuan (siming85) * Date: 2018-03-13 02:53
tested again with Python 3.4.8 and the bug is observed. patch & builds fine.

strangely, tested building python 3.6.4 on the same environment without patch, no issues, even though the ffi.c code is exactly the same.
msg313755 - (view) Author: Siming Yuan (siming85) * Date: 2018-03-13 14:48
edit - I do see this in python 3.6.4 on a different server when building 32-bit 

Red Hat Enterprise Linux Workstation release 6.7 (Santiago)

gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)
msg313759 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2018-03-13 14:56
3.4 and 3.5 are in security release-only mode.
msg313760 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2018-03-13 15:25
Your better option is to install libffi-devel (or whatever the correct name is ) on your system and use `./configure --with-system-ffi`.  This is the default in 3.6 and the only option in 3.7 (on any platform but Windows and macOS).
msg313769 - (view) Author: Siming Yuan (siming85) * Date: 2018-03-13 19:14
interesting, didn't know that option existed.
History
Date User Action Args
2018-03-13 19:14:24siming85setmessages: + msg313769
2018-03-13 15:25:33zach.waresetnosy: + zach.ware
messages: + msg313760
2018-03-13 14:56:40christian.heimessetnosy: + christian.heimes

messages: + msg313759
versions: - Python 3.4, Python 3.5
2018-03-13 14:48:36siming85setmessages: + msg313755
versions: + Python 3.6
2018-03-13 02:53:21siming85setmessages: + msg313720
components: + ctypes
versions: + Python 3.4
2018-03-13 02:33:32siming85setfiles: + ffi.patch
keywords: + patch
messages: + msg313717
2018-03-13 02:31:35siming85create