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: ctypes not building under OS X because of ffi_closure_free not being defined early enough
Type: compile error Stage: resolved
Components: ctypes Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: benjamin.peterson, brett.cannon, georg.brandl, lukasz.langa, ned.deily, ronaldoussoren, skip.montanaro, theller
Priority: release blocker Keywords:

Created on 2010-08-22 20:45 by brett.cannon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (12)
msg114704 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-08-22 20:45
When I build under OS X 10.6 with LLVM I get four warnings of the type:


/Users/brett/Dev/python/3.x/scratch/Modules/_ctypes/callbacks.c:20:9: warning: 
      implicit declaration of function 'ffi_closure_free' is invalid in C99
      [-Wimplicit-function-declaration]
        ffi_closure_free(self->pcl_write);
        ^


They are for ffi_closure_free, ffi_closure_alloc, and ffi_prep_closure_loc.
msg114707 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-08-22 21:38
Is LLVM a supported platform?
msg114709 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-08-22 21:56
It might as well be. OS X ships with it and is working towards making it their default compiler over gcc. Unladen also relies on it.

This compiler issue is a fairly new one (I would guess past week or so), so making sure LLVM can compile Python shouldn't be a big deal. I would have added the proper function declarations myself to fix this but I wanted to let Thomas put them where he wanted them to go.
msg115629 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-09-05 07:14
I don't think this should block 3.2a2.

+1 for supporting LLVM in general.  BTW, why doesn't it build because of warnings?
msg115632 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-09-05 07:47
It's not just LLVM.  Building a standard OS X installer on OS X 10.5 (gcc-4.0, 10.4u SDK, i386/ppc, deployment target=10.3) or 10.6 (gcc-4.2, 10.6 SDK, i386/x86_64, dept target 10.6), _ctypes fails:

*** WARNING: renaming "_ctypes" since importing it failed: dlopen(build/lib.macosx-10.3-fat-3.2/_ctypes.so, 2): Symbol not found: _ffi_closure_alloc

That is definitely a regression.
msg115633 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-09-05 08:11
OK.  Assigning to Ronald for now; he'll have to deal with it when building the binaries anyway.
msg115641 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2010-09-05 11:40
This was broken in r83837 with a patch for issue #5504.
msg115649 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-09-05 13:50
I'm looking into this issue.

One problem is that the version of libffi used on OSX is no longer in sync with the version that is used on other platforms. The version that is used on OSX does not have some of the symbols expected by ctypes, such as 'ffi_prep_closure_loc'.
msg115650 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2010-09-05 13:51
Ronald, please see #5504.
msg115653 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-09-05 14:20
Thanks! That patch fixes the issue for me and I will commit it later today.
msg115666 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-09-05 18:43
I've committed the patch in #5504 in r84535 (3.2) and that fixes this issue. 

The same problem affects 2.7, I'm currently running the testsuite with the backport of this commit.
msg116522 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-09-16 11:35
(Finally...) Checked in for 2.7 in r84846
History
Date User Action Args
2022-04-11 14:57:05adminsetgithub: 53871
2010-09-16 11:35:42ronaldoussorensetstatus: open -> closed

messages: + msg116522
2010-09-06 08:26:29georg.brandlsetpriority: deferred blocker -> release blocker
2010-09-05 18:43:26ronaldoussorensetresolution: fixed
stage: needs patch -> resolved
messages: + msg115666
versions: + Python 2.7
2010-09-05 14:20:14ronaldoussorensetmessages: + msg115653
2010-09-05 13:51:59lukasz.langasetmessages: + msg115650
2010-09-05 13:50:56ronaldoussorensetmessages: + msg115649
2010-09-05 11:40:09lukasz.langasetnosy: + lukasz.langa
messages: + msg115641
2010-09-05 08:11:27georg.brandlsetassignee: theller -> ronaldoussoren

messages: + msg115633
nosy: + ronaldoussoren
2010-09-05 07:48:07ned.deilysetmessages: - msg115631
2010-09-05 07:47:59ned.deilysetmessages: + msg115632
2010-09-05 07:43:11ned.deilysetnosy: + ned.deily
messages: + msg115631
2010-09-05 07:14:48georg.brandlsetpriority: release blocker -> deferred blocker
nosy: + georg.brandl
messages: + msg115629

2010-08-22 21:56:10brett.cannonsetmessages: + msg114709
2010-08-22 21:38:47benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg114707
2010-08-22 20:59:29skip.montanarosetnosy: + skip.montanaro
2010-08-22 20:45:22brett.cannoncreate