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.

Title: libffi does not build with clang on amd64
Type: compile error Stage: resolved
Components: Build Versions:
Status: closed Resolution: duplicate
Dependencies: Superseder: libffi assembler relocation check is not robust, fails with clang
View: 11729
Assigned To: Nosy List: koobs, shenki, skrah
Priority: normal Keywords: patch

Created on 2011-08-22 06:30 by shenki, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
libffi-3.0.11-clang.patch koobs, 2012-12-02 13:39
Messages (4)
msg142686 - (view) Author: Joel (shenki) Date: 2011-08-22 06:30
tl;dr libffi needs to be updated so Python will build with clang on Linux on amd64

libffi, part of ctypes, has a test for PC relative relocations. It assembles a assembler file with CC, and looks for the string "warning" in the output.

clang produces harmless warning unrelated to the assembly operation, but the test causes HAVE_AS_X86_PCREL to be left unset. When trying to assemble Modules/_ctypes/libffi/src/x86/unix64.S, the compiler finds invalid syntax and the build fails.

This was raised on the libffi mailing list, with a proposed patch

The patch appears to be part of upstream libffi:

So perhaps the best fix would be to update the version of libffi in the tree.
msg176793 - (view) Author: Kubilay Kocak (koobs) (Python triager) Date: 2012-12-02 13:39
This is also an issue for clang builds of Python on FreeBSD and results in the _ctypes extension failing to compile (See: koobs-freebsd-clang buildbot)

The original mozilla patch (see References below) did not make it into the libffi 3.0.11 release, which has already been committed to the Cpython tree (see #15194)

Attached here is the original Mozilla patch to configure & which I have included in a PR submitted to the FreeBSD ports tree for python27

The PR includes test builds with gcc and clang on multiple FreeBSD versions and architectures, along with a libffi unit test run with clang (

I propose this patch be committed to all branches to re-enable _ctypes extension builds with clang.


msg176794 - (view) Author: Kubilay Kocak (koobs) (Python triager) Date: 2012-12-02 13:45
Correction, the PR mentioned in the previous comment has been submitted for devel/libffi in the FreeBSD ports tree (update from 3.0.9 -> 3.0.11), not lang/python27
msg180129 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-01-17 13:19
This is a duplicate of #11729, which is fixed.
Date User Action Args
2022-04-11 14:57:20adminsetgithub: 57021
2013-01-17 13:19:39skrahsetstatus: open -> closed

superseder: libffi assembler relocation check is not robust, fails with clang
type: compile error

nosy: + skrah
messages: + msg180129
resolution: duplicate
stage: resolved
2012-12-02 13:45:22koobssetmessages: + msg176794
2012-12-02 13:39:34koobssetfiles: + libffi-3.0.11-clang.patch

nosy: + koobs
messages: + msg176793

keywords: + patch
2011-08-22 06:30:47shenkicreate