classification
Title: libffi does not build with clang on amd64
Type: compile error Stage: resolved
Components: Build Versions:
process
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 2013-01-17 13:19 by skrah. This issue is now closed.

Files
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 

  http://sourceware.org/ml/libffi-discuss/2011/msg00024.html

The patch appears to be part of upstream libffi:

 https://github.com/atgreen/libffi/blob/master/configure.ac#L296

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 & configure.ac 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 (http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/171768)

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

References:

- http://www.cygwin.com/ml/libffi-discuss/2011/msg00024.html
- https://bugzilla.mozilla.org/show_bug.cgi?id=631928
- https://github.com/atgreen/libffi/issues/21
- https://bugs.gentoo.org/show_bug.cgi?id=417179
- http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/171768
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.
History
Date User Action Args
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