Opened 14 years ago

Closed 14 years ago

#22418 closed defect (fixed)

py-ctypes won't build on Snow Leopard (libffi related?)

Reported by: optilude@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.8.1
Keywords: Cc: klemens.mantzos@…, johannes.schrimpf@…
Port: py-ctypes

Description

I get the following error:

$ sudo port install py-ctypes
Password:
--->  Computing dependencies for py-ctypes
--->  Building py-ctypes
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py-ctypes/work/ctypes-1.0.1" && /opt/local/bin/python2.4 setup.py build " returned error 1
Command output: running build
running build_py
running build_ext
building '_ctypes' extension
/usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -Isource/darwin -Ibuild/temp.macosx-10.6-i386-2.4/libffi/include -Ibuild/temp.macosx-10.6-i386-2.4/libffi -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py-ctypes/work/ctypes-1.0.1/source/libffi/src -I/opt/local/include/python2.4 -c source/_ctypes.c -o build/temp.macosx-10.6-i386-2.4/source/_ctypes.o
In file included from source/_ctypes.c:110:
build/temp.macosx-10.6-i386-2.4/libffi/include/ffi.h:161: error: expected specifier-qualifier-list before 'ffi_abi'
build/temp.macosx-10.6-i386-2.4/libffi/include/ffi.h:183: error: expected specifier-qualifier-list before 'ffi_sarg'
build/temp.macosx-10.6-i386-2.4/libffi/include/ffi.h:267: error: expected declaration specifiers or '...' before 'ffi_abi'
In file included from source/_ctypes.c:126:
source/ctypes.h:71: error: expected specifier-qualifier-list before 'ffi_closure'
source/_ctypes.c: In function 'CDataType_in_dll':
source/_ctypes.c:304: warning: format not a string literal and no format arguments
source/_ctypes.c: In function 'CFuncPtr_FromDll':
source/_ctypes.c:2790: warning: format not a string literal and no format arguments
source/_ctypes.c: In function 'CFuncPtr_clear':
source/_ctypes.c:3417: error: 'ffi_info' has no member named 'pcl'
error: command '/usr/bin/gcc-4.2' failed with exit status 1

Error: Status 1 encountered during processing.

libffi installed fine.

Change History (9)

comment:1 Changed 14 years ago by jmroot (Joshua Root)

Port: py-ctypes added

Python < 2.6 has serious issues on 64-bit OS X.

comment:2 Changed 14 years ago by optilude@…

I don't know that it's a Python problem. Other python things work fine. I think you need to set some CC variables, though. http://svn.plone.org/svn/collective/buildout/python/src/python24.cfg may provide some inspiration.

comment:3 Changed 14 years ago by klemens.mantzos@…

Cc: klemens.mantzos@… added

Cc Me!

comment:4 Changed 14 years ago by klemens.mantzos@…

i'm just guessing, but:

ctypes builts an temp/own libffi while building. shouldnt it use the macport libffi instead? could this fix the problem?

comment:5 in reply to:  4 ; Changed 14 years ago by johannes.schrimpf@…

I could compile the packet by overriding the libffi compilation in the ctypes setup.py file, line 167:

/opt/local/var/macports/build/_opt_..._py-ctypes/work/ctypes-1.0.1/setup.py

changing from:

build_ext.build_ext.build_extensions(self)

to

#build_ext.build_ext.build_extensions(self)

I do not know if this skips to much code, but it did install for me. I can import ctypes in python, but i did not test the functionality. Maybe it helps to build a patch or a workaround.

comment:6 Changed 14 years ago by johannes.schrimpf@…

Cc: johannes.schrimpf@… added

Cc Me!

comment:7 in reply to:  5 Changed 14 years ago by klemens.mantzos@…

Replying to johannes.schrimpf@…:

I could compile the packet by overriding the libffi compilation in the ctypes setup.py file, line 167:

/opt/local/var/macports/build/_opt_..._py-ctypes/work/ctypes-1.0.1/setup.py

changing from:

build_ext.build_ext.build_extensions(self)

to

#build_ext.build_ext.build_extensions(self)

I do not know if this skips to much code, but it did install for me. I can import ctypes in python, but i did not test the functionality. Maybe it helps to build a patch or a workaround.

think it works fine this way (libffi is installed anyway, doesnt need to build it again - especially if its a "broken" build). but...

...fyi: i switched to python 2.6 (ctypes is integrated). everything i need works fine on it (django, mysqldb, geoip, geos and dependencies). jmr@… said it already, i don't know why but, < 2.6 is a bad idea on snow leopard.

comment:8 in reply to:  4 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to ryandesign@…
Status: newassigned

Replying to klemens.mantzos@…:

ctypes builts an temp/own libffi while building. shouldnt it use the macport libffi instead? could this fix the problem?

I agree. The patch I've attached to #25148 fixes this problem using this suggestion.

comment:9 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

Committed in r69875.

Note: See TracTickets for help on using tickets.