Bug 149167 - lang/python26 fails to build _ctypes on Sheevaplug (ARM)
Summary: lang/python26 fails to build _ctypes on Sheevaplug (ARM)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Kubilay Kocak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-01 05:10 UTC by Allison Reid
Modified: 2013-12-21 10:40 UTC (History)
0 users

See Also:


Attachments
python26-arm.patch.txt (398 bytes, text/plain; charset=US-ASCII)
2010-08-01 06:56 UTC, okeeblow
no flags Details
python-with-ports-libffi.diff (434 bytes, patch)
2013-10-24 01:10 UTC, koobs
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Allison Reid 2010-08-01 05:10:05 UTC
I built Python 2.6.5 using the ports tree supplied with 8.1-RELEASE. _ctypes fails during the build, but it then installs without error. Packaging fails, and deinstall mentions the missing file.




Here's the relevant except from the build:
[]
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
building '_ctypes' extension
cc -fPIC -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -I. -I/usr/ports/lang/python26/work/Python-2.6.5/./Include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi/include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi -I/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src -I. -IInclude -I./../Include -I/usr/local/include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static/Include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static -c /usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/_ctypes.c -o build/temp.freebsd-8.1-RELEASE-arm-2.6/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/_ctypes.o
cc -fPIC -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -I. -I/usr/ports/lang/python26/work/Python-2.6.5/./Include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi/include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi -I/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src -I. -IInclude -I./../Include -I/usr/local/include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static/Include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static -c /usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/callbacks.c -o build/temp.freebsd-8.1-RELEASE-arm-2.6/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/callbacks.o
cc -fPIC -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -I. -I/usr/ports/lang/python26/work/Python-2.6.5/./Include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi/include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi -I/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src -I. -IInclude -I./../Include -I/usr/local/include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static/Include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static -c /usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/callproc.c -o build/temp.freebsd-8.1-RELEASE-arm-2.6/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/callproc.o
cc -fPIC -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -I. -I/usr/ports/lang/python26/work/Python-2.6.5/./Include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi/include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi -I/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src -I. -IInclude -I./../Include -I/usr/local/include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static/Include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static -c /usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/stgdict.c -o build/temp.freebsd-8.1-RELEASE-arm-2.6/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/stgdict.o
cc -fPIC -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -I. -I/usr/ports/lang/python26/work/Python-2.6.5/./Include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi/include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi -I/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src -I. -IInclude -I./../Include -I/usr/local/include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static/Include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static -c /usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/cfield.c -o build/temp.freebsd-8.1-RELEASE-arm-2.6/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/cfield.o
cc -fPIC -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -I. -I/usr/ports/lang/python26/work/Python-2.6.5/./Include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi/include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi -I/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src -I. -IInclude -I./../Include -I/usr/local/include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static/Include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static -c /usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/malloc_closure.c -o build/temp.freebsd-8.1-RELEASE-arm-2.6/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/malloc_closure.o
cc -fPIC -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -I. -I/usr/ports/lang/python26/work/Python-2.6.5/./Include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi/include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi -I/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src -I. -IInclude -I./../Include -I/usr/local/include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static/Include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static -c /usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src/prep_cif.c -o build/temp.freebsd-8.1-RELEASE-arm-2.6/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src/prep_cif.o
cc -fPIC -fno-strict-aliasing -DNDEBUG -O -pipe -D__wchar_t=wchar_t -DTHREAD_STACK_SIZE=0x20000 -I. -I/usr/ports/lang/python26/work/Python-2.6.5/./Include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi/include -Ibuild/temp.freebsd-8.1-RELEASE-arm-2.6/libffi -I/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src -I. -IInclude -I./../Include -I/usr/local/include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static/Include -I/usr/ports/lang/python26/work/Python-2.6.5/portbld.static -c /usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src/arm/sysv.S -o build/temp.freebsd-8.1-RELEASE-arm-2.6/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src/arm/sysv.o
/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src/arm/sysv.S: Assembler messages:
/usr/ports/lang/python26/work/Python-2.6.5/Modules/_ctypes/libffi/src/arm/sysv.S:246: Error: unknown pseudo-op: `.pad'

Failed to find the necessary bits to build these modules:
_bsddb             _sqlite3           _tkinter
gdbm               linuxaudiodev      spwd
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_ctypes

Creating directory /usr/local/lib/python2.6/lib-tk
Creating directory /usr/local/lib/python2.6/site-packages
[]



The failure to package:
pochan# make package
===>  Building package for python26-2.6.5
Creating package /usr/ports/lang/python26/python26-2.6.5.tbz
Registering depends:.
Creating bzip'd tar ball in '/usr/ports/lang/python26/python26-2.6.5.tbz'
tar: lib/python2.6/lib-dynload/_ctypes.so: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
pkg_create: make_dist: tar command failed with code 256
*** Error code 1

Stop in /usr/ports/lang/python26.
*** Error code 1

Stop in /usr/ports/lang/python26.
pochan#

Fix: 

Here is a post from the cygwin list relating to the same error in libffi that says commenting the offending line may let it build successfully: http://cygwin.ru/ml/libffi-discuss/2008/msg00127.html
How-To-Repeat: make in lang/python26.
Comment 1 Edwin Groothuis freebsd_committer 2010-08-01 05:10:27 UTC
Responsible Changed
From-To: freebsd-ports-bugs->python

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2010-08-02 13:27:52 UTC
Responsible Changed
From-To: python->freebsd-python

Canonicalize assignment.
Comment 3 Mattia Rossi 2011-12-12 22:48:10 UTC
Ok, I'll submit my problem here as a follow-up as well, maybe someone 
gets around to fix it. I have no clue on how Python build s modules and 
how the whole build system is handled, so I most likely have no chance 
to find out how to fix it.

Python 2.7.2 builds on the Dreamplug (evolved Sheevaplug) including 
ctypes, but upon importing the module, it crashes.
I tried to see if the patch did some magic to make it work, but that was 
just a shot in the dark.. and no it doesn't help.

Environment:

FreeBSD dreamplug 9.0-RC1 FreeBSD 9.0-RC1 #35 r226624M: Wed Oct 26 
12:06:18 EST 2011     
root@freebsd82fresh:/usr/obj/arm.arm/usr/devel/sys/DREAMPLUG  arm

dreamplug# python
Python 2.7.2 (default, Dec  1 2011, 22:46:25)
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd9
Type "help", "copyright", "credits" or "license" for more information.
 >>> import ctypes
Abort (core dumped)

(gdb) bt
#0  0x2020dd10 in thr_kill () from /lib/libc.so.7
#1  0x201a8314 in pthread_sigmask () from /lib/libthr.so.3
#2  0x201a8964 in raise () from /lib/libthr.so.3
#3  0x202aba6c in abort () from /lib/libc.so.7
#4  0x203a5680 in __clear_cache () from 
/usr/local/lib/python2.7/lib-dynload/_ctypes.so
#5  0x203a5680 in __clear_cache () from 
/usr/local/lib/python2.7/lib-dynload/_ctypes.so

Mat
Comment 4 werner 2013-02-18 12:44:39 UTC
Follow up for Beaglebone (ARM) with Python-2.7.3, I can report the same 
as the follow up poster with the Sheevaplug:

Python builds from ports, but crashes when importing ctypes with the 
same stacktrace.

Environment:
 > uname -a
FreeBSD beagie 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r246901M: Sun Feb 17 
10:49:03 CET 2013 
root@xtools:/usr/home/wthie/proj/freebsd-beaglebone/work/obj/arm.armv6/usr/local/src/sys/BEAGLEBONE 
  arm

 > gdb python
(gdb) run
Starting program: /usr/local/bin/python
[New LWP 100043]
[New Thread 20803080 (LWP 100043/python2.7)]
Python 2.7.3 (default, Feb 18 2013, 07:57:21)
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd10
Type "help", "copyright", "credits" or "license" for more information.
 >>> import ctypes

Program received signal SIGABRT, Aborted.
[Switching to Thread 20803080 (LWP 100043/python2.7)]
0x202b4900 in thr_kill () from /lib/libc.so.7
(gdb) bt
#0  0x202b4900 in thr_kill () from /lib/libc.so.7
#1  0x20242ff4 in sigaction () from /lib/libthr.so.3
#2  0x20243734 in raise () from /lib/libthr.so.3
#3  0x2036fc98 in abort () from /lib/libc.so.7
#4  0x20cb774c in compilerrt_abort_impl () from 
/usr/local/lib/python2.7/lib-dynload/_ctypes.so
#5  0x20cb774c in compilerrt_abort_impl () from 
/usr/local/lib/python2.7/lib-dynload/_ctypes.so

Werner
Comment 5 werner 2013-02-24 14:35:28 UTC
Follow up for Beaglebone (ARM) with Python-2.7.3

Python27 on FreeBSD 10.0-CURRENT #0 r246947M builds ok from ports, but 
aborts and dumps core when importing ctypes.

I debugged this so far that I was able to identify the offending line, 
being a quite questionable fix in ctypes/__init__.py:279 in function 
_reset_cache()

If this line is commented out, ctypes just loads fine and twisted being 
dependent on ctypes is unfolding its power with an impressively clean 
bill when twisted tests are run.

Werner
Comment 6 koobs 2013-10-24 01:10:52 UTC
Nicole & Werner,

Python updated their bundled version of libffi to 3.0.13 on 13 Mar 2013:

http://hg.python.org/cpython/rev/b10ec5083a53

1) Can you both please confirm whether the issue still exists in the
latest version of lang/python27 (2.7.5) or not.

2) If you *can* reproduce it in the above case, can you both also try
applying the attached patch & rebuilding lang/python27, which will build
ctypes against devel/libffi from ports, rather than the bundled version.

This will help determine what the current state is and point us in the
right direction to where a permanent fix is to be applied. Maintaining a
local patch is a short term fix and ultimately needs to be resolved at
Python or libffi upstream.

Thank you both for your report and follow-ups

Koobs
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2013-10-24 01:11:31 UTC
State Changed
From-To: open->feedback
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2013-12-05 14:43:44 UTC
Responsible Changed
From-To: freebsd-python->koobs

I'll take it.
Comment 9 koobs 2013-12-05 15:16:16 UTC
Patches have been prepared for python27, python32 and python33 which
will land shortly

A PR has also been submitted which is necessary to address the issue in
lang/python31: ports/184517, as it uses the devel/libffi port
unconditionally [2].

I haven't yet decided whether to patch python26 or switch it to
devel/libffi.

[1] https://svnweb.freebsd.org/ports?view=revision&revision=335370

Apologies for the delay in getting this resolved for you all.
Comment 10 dfilter service freebsd_committer 2013-12-08 06:22:16 UTC
Author: koobs
Date: Sun Dec  8 06:22:07 2013
New Revision: 335867
URL: http://svnweb.freebsd.org/changeset/ports/335867

Log:
  All Python ports: Address abort() for ctypes import on FreeBSD/ARM
  
  The current FreeBSD/ARM __clear_cache() implementation does nothing #if
  __i386__ || __x86_64__ #else abort();
  
  cognet@ advises this is an issue for anything !Apple that is using the
  libcompiler_rt provided by Clang on ARM, and requires upstreaming.
  
  This is the root cause of abort() on import for the ctypes module in
  Python, as they bundle libffi. [1]
  
  This change patches the bundled libffi library in all Python ports, even
  though it is a NOOP for the ports that use devel/libffi. These ports,
  currently python31, will get the fix via ports/184517
  
  A huge shout out to cognet@ who helped diagnose the issue and created
  the patch to address it. Thank you!
  
  PR:		ports/149167 [1]
  PR:		ports/184517
  Submitted by:	cognet [3]
  Reviewed by:	cognet, eadler, milki, ak

Added:
  head/lang/python26/files/patch-Modules___ctypes__libffi__src__arm__ffi.c   (contents, props changed)
  head/lang/python27/files/patch-Modules___ctypes__libffi__src__arm__ffi.c   (contents, props changed)
  head/lang/python31/files/patch-Modules___ctypes__libffi__src__arm__ffi.c   (contents, props changed)
  head/lang/python32/files/patch-Modules___ctypes__libffi__src__arm__ffi.c   (contents, props changed)
  head/lang/python33/files/patch-Modules___ctypes__libffi__src__arm__ffi.c   (contents, props changed)

Added: head/lang/python26/files/patch-Modules___ctypes__libffi__src__arm__ffi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/python26/files/patch-Modules___ctypes__libffi__src__arm__ffi.c	Sun Dec  8 06:22:07 2013	(r335867)
@@ -0,0 +1,36 @@
+# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue
+# for anything !apple that is using the libcompiler_rt provided by clang on arm
+# PR: ports/149167 ports/184517
+# Patch by: cognet@ (to be upstreamed @ LLVM)
+
+--- ./Modules/_ctypes/libffi/src/arm/ffi.c.orig	2013-12-06 00:45:21.870941788 +1100
++++ ./Modules/_ctypes/libffi/src/arm/ffi.c	2013-12-06 00:46:42.804848626 +1100
+@@ -29,6 +29,11 @@
+ 
+ #include <stdlib.h>
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#endif
++
+ /* ffi_prep_args is called by the assembly routine once stack space
+    has been allocated for the function's arguments */
+ 
+@@ -273,6 +278,16 @@
+ 
+ /* How to make a trampoline.  */
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#define __clear_cache(start, end) do { \
++               struct arm_sync_icache_args ua;                 \
++                                                               \
++               ua.addr = (uintptr_t)(start);                   \
++               ua.len = (char *)(end) - (char *)start;         \
++               sysarch(ARM_SYNC_ICACHE, &ua);                  \
++       } while (0);
++#endif
++
+ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX)				\
+ ({ unsigned char *__tramp = (unsigned char*)(TRAMP);			\
+    unsigned int  __fun = (unsigned int)(FUN);				\

Added: head/lang/python27/files/patch-Modules___ctypes__libffi__src__arm__ffi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/python27/files/patch-Modules___ctypes__libffi__src__arm__ffi.c	Sun Dec  8 06:22:07 2013	(r335867)
@@ -0,0 +1,36 @@
+# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue
+# for anything !apple that is using the libcompiler_rt provided by clang on arm
+# PR: ports/149167 ports/184517
+# Patch by: cognet@ (to be upstreamed @ LLVM)
+
+--- ./Modules/_ctypes/libffi/src/arm/ffi.c.orig	2013-11-10 18:36:41.000000000 +1100
++++ ./Modules/_ctypes/libffi/src/arm/ffi.c	2013-12-03 18:05:51.461078888 +1100
+@@ -33,6 +33,11 @@
+ 
+ #include <stdlib.h>
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#endif
++
+ /* Forward declares. */
+ static int vfp_type_p (ffi_type *);
+ static void layout_vfp_args (ffi_cif *);
+@@ -582,6 +587,16 @@
+ 
+ #else
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#define __clear_cache(start, end) do { \
++		struct arm_sync_icache_args ua; 		\
++								\
++		ua.addr = (uintptr_t)(start);			\
++		ua.len = (char *)(end) - (char *)start;		\
++		sysarch(ARM_SYNC_ICACHE, &ua);			\
++	} while (0);
++#endif
++
+ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX)				\
+ ({ unsigned char *__tramp = (unsigned char*)(TRAMP);			\
+    unsigned int  __fun = (unsigned int)(FUN);				\

Added: head/lang/python31/files/patch-Modules___ctypes__libffi__src__arm__ffi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/python31/files/patch-Modules___ctypes__libffi__src__arm__ffi.c	Sun Dec  8 06:22:07 2013	(r335867)
@@ -0,0 +1,36 @@
+# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue
+# for anything !apple that is using the libcompiler_rt provided by clang on arm
+# PR: ports/149167 ports/184517
+# Patch by: cognet@ (to be upstreamed @ LLVM)
+
+--- ./Modules/_ctypes/libffi/src/arm/ffi.c.orig	2013-12-08 15:55:58.351993767 +1100
++++ ./Modules/_ctypes/libffi/src/arm/ffi.c	2013-12-08 15:57:40.531068291 +1100
+@@ -29,6 +29,11 @@
+ 
+ #include <stdlib.h>
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#endif
++
+ /* ffi_prep_args is called by the assembly routine once stack space
+    has been allocated for the function's arguments */
+ 
+@@ -273,6 +278,16 @@
+ 
+ /* How to make a trampoline.  */
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#define __clear_cache(start, end) do { \
++                struct arm_sync_icache_args ua;                 \
++                                                                \
++                ua.addr = (uintptr_t)(start);                   \
++                ua.len = (char *)(end) - (char *)start;         \
++                sysarch(ARM_SYNC_ICACHE, &ua);                  \
++        } while (0);
++#endif
++
+ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX)				\
+ ({ unsigned char *__tramp = (unsigned char*)(TRAMP);			\
+    unsigned int  __fun = (unsigned int)(FUN);				\

Added: head/lang/python32/files/patch-Modules___ctypes__libffi__src__arm__ffi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/python32/files/patch-Modules___ctypes__libffi__src__arm__ffi.c	Sun Dec  8 06:22:07 2013	(r335867)
@@ -0,0 +1,36 @@
+# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue
+# for anything !apple that is using the libcompiler_rt provided by clang on arm
+# PR: ports/149167 ports/184517
+# Patch by: cognet@ (to be upstreamed @ LLVM)
+
+--- ./Modules/_ctypes/libffi/src/arm/ffi.c.orig	2013-05-16 02:33:52.000000000 +1000
++++ ./Modules/_ctypes/libffi/src/arm/ffi.c	2013-12-03 19:19:36.700951785 +1100
+@@ -33,6 +33,11 @@
+ 
+ #include <stdlib.h>
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#endif
++
+ /* Forward declares. */
+ static int vfp_type_p (ffi_type *);
+ static void layout_vfp_args (ffi_cif *);
+@@ -582,6 +587,16 @@
+ 
+ #else
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#define __clear_cache(start, end) do { \
++		struct arm_sync_icache_args ua; 		\
++								\
++		ua.addr = (uintptr_t)(start);			\
++		ua.len = (char *)(end) - (char *)start;		\
++		sysarch(ARM_SYNC_ICACHE, &ua);			\
++	} while (0);
++#endif
++
+ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX)				\
+ ({ unsigned char *__tramp = (unsigned char*)(TRAMP);			\
+    unsigned int  __fun = (unsigned int)(FUN);				\

Added: head/lang/python33/files/patch-Modules___ctypes__libffi__src__arm__ffi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/python33/files/patch-Modules___ctypes__libffi__src__arm__ffi.c	Sun Dec  8 06:22:07 2013	(r335867)
@@ -0,0 +1,36 @@
+# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue
+# for anything !apple that is using the libcompiler_rt provided by clang on arm
+# PR: ports/149167 ports/184517
+# Patch by: cognet@ (to be upstreamed @ LLVM)
+
+--- ./Modules/_ctypes/libffi/src/arm/ffi.c.orig	2013-11-17 18:22:57.000000000 +1100
++++ ./Modules/_ctypes/libffi/src/arm/ffi.c	2013-12-03 19:23:24.521993369 +1100
+@@ -33,6 +33,11 @@
+ 
+ #include <stdlib.h>
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#endif
++
+ /* Forward declares. */
+ static int vfp_type_p (ffi_type *);
+ static void layout_vfp_args (ffi_cif *);
+@@ -582,6 +587,16 @@
+ 
+ #else
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#define __clear_cache(start, end) do { \
++		struct arm_sync_icache_args ua; 		\
++								\
++		ua.addr = (uintptr_t)(start);			\
++		ua.len = (char *)(end) - (char *)start;		\
++		sysarch(ARM_SYNC_ICACHE, &ua);			\
++	} while (0);
++#endif
++
+ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX)				\
+ ({ unsigned char *__tramp = (unsigned char*)(TRAMP);			\
+    unsigned int  __fun = (unsigned int)(FUN);				\
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 11 dfilter service freebsd_committer 2013-12-08 09:03:09 UTC
Author: koobs
Date: Sun Dec  8 09:03:01 2013
New Revision: 335872
URL: http://svnweb.freebsd.org/changeset/ports/335872

Log:
  Bump PORTREVISION for all Python ports to pickup the recent ARM patch
  
  PR:		ports/149167

Modified:
  head/lang/python26/Makefile
  head/lang/python27/Makefile
  head/lang/python31/Makefile
  head/lang/python32/Makefile
  head/lang/python33/Makefile

Modified: head/lang/python26/Makefile
==============================================================================
--- head/lang/python26/Makefile	Sun Dec  8 08:57:34 2013	(r335871)
+++ head/lang/python26/Makefile	Sun Dec  8 09:03:01 2013	(r335872)
@@ -3,7 +3,7 @@
 
 PORTNAME=		python26
 PORTVERSION=		2.6.9
-PORTREVISION=		1
+PORTREVISION=		2
 CATEGORIES=		lang python ipv6
 MASTER_SITES=		PYTHON
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}

Modified: head/lang/python27/Makefile
==============================================================================
--- head/lang/python27/Makefile	Sun Dec  8 08:57:34 2013	(r335871)
+++ head/lang/python27/Makefile	Sun Dec  8 09:03:01 2013	(r335872)
@@ -3,6 +3,7 @@
 
 PORTNAME=	python27
 PORTVERSION=	2.7.6
+PORTREVISION=	1
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	PYTHON
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}

Modified: head/lang/python31/Makefile
==============================================================================
--- head/lang/python31/Makefile	Sun Dec  8 08:57:34 2013	(r335871)
+++ head/lang/python31/Makefile	Sun Dec  8 09:03:01 2013	(r335872)
@@ -2,7 +2,7 @@
 
 PORTNAME=		python31
 PORTVERSION=		3.1.5
-PORTREVISION=		7
+PORTREVISION=		8
 CATEGORIES=		lang python ipv6
 MASTER_SITES=		PYTHON
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}

Modified: head/lang/python32/Makefile
==============================================================================
--- head/lang/python32/Makefile	Sun Dec  8 08:57:34 2013	(r335871)
+++ head/lang/python32/Makefile	Sun Dec  8 09:03:01 2013	(r335872)
@@ -2,7 +2,7 @@
 
 PORTNAME=		python32
 PORTVERSION=		3.2.5
-PORTREVISION=		5
+PORTREVISION=		6
 CATEGORIES=		lang python ipv6
 MASTER_SITES=		PYTHON
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}

Modified: head/lang/python33/Makefile
==============================================================================
--- head/lang/python33/Makefile	Sun Dec  8 08:57:34 2013	(r335871)
+++ head/lang/python33/Makefile	Sun Dec  8 09:03:01 2013	(r335872)
@@ -2,6 +2,7 @@
 
 PORTNAME=		python33
 PORTVERSION=		3.3.3
+PORTREVISION=		1
 CATEGORIES=		lang python ipv6
 MASTER_SITES=		PYTHON
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 12 dfilter service freebsd_committer 2013-12-21 05:22:13 UTC
Author: koobs
Date: Sat Dec 21 05:22:05 2013
New Revision: 337118
URL: http://svnweb.freebsd.org/changeset/ports/337118

Log:
  devel/libffi: Fix abort() on ARM related to __clear_cache()
  
  The current FreeBSD/ARM __clear_cache() implementation does nothing #if
  __i386__ || __x86_64__ #else abort();
  
  cognet@ advises this is an issue for anything !Apple that is using the
  libcompiler_rt provided by Clang on ARM, and requires upstreaming.
  
  Additionally, two Python ports (python26 and python31) use devel/libffi for
  unrelated reasons, so this addresses the related PR for those ports too [2].
  
  - Enable STAGE support
  - Remove MAN* entries and update pkg-plist accordingly
  - Add LICENSE
  - Sort USE/USES section
  - Use install-strip as the INSTALL_TARGET
  
  PR:		ports/149167
  PR:		ports/184517 [2]
  Approved by:	maintainer timeout (2 weeks)

Added:
  head/devel/libffi/files/
  head/devel/libffi/files/patch-src__arm__ffi.c   (contents, props changed)
Modified:
  head/devel/libffi/Makefile   (contents, props changed)
  head/devel/libffi/pkg-plist   (contents, props changed)

Modified: head/devel/libffi/Makefile
==============================================================================
--- head/devel/libffi/Makefile	Sat Dec 21 04:39:52 2013	(r337117)
+++ head/devel/libffi/Makefile	Sat Dec 21 05:22:05 2013	(r337118)
@@ -3,6 +3,7 @@
 
 PORTNAME=	libffi
 PORTVERSION=	3.0.13
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	SOURCEWARE
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -10,32 +11,32 @@ MASTER_SITE_SUBDIR=	${PORTNAME}
 MAINTAINER=	zeising@FreeBSD.org
 COMMENT=	Foreign Function Interface
 
+LICENSE=	MIT
+
 TEST_DEPENDS=	runtest:${PORTSDIR}/misc/dejagnu
 
+USES=		pathfix pkgconfig
+USE_LDCONFIG=	yes
+GNU_CONFIGURE=	yes
+
 OPTIONS_DEFINE=	TESTS
 TESTS_DESC=	Include tools for test suite
 
-NO_STAGE=	yes
 .include <bsd.port.options.mk>
 
 .if ${PORT_OPTIONS:MTESTS}
 BUILD_DEPENDS:=	${TEST_DEPENDS}
 .endif
 
-GNU_CONFIGURE=	yes
-USE_LDCONFIG=	yes
-USES=	pathfix pkgconfig
-PLIST_SUB=	PORTVERSION=${PORTVERSION}
-
+INSTALL_TARGET=	install-strip
 INFO=		libffi
-
-MAN3=		ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
+PLIST_SUB=	PORTVERSION=${PORTVERSION}
 
 post-install:
 	@${LN} -sf ../lib/libffi-${PORTVERSION}/include/ffi.h \
-	    ${PREFIX}/include/
+	    ${STAGEDIR}${PREFIX}/include/
 	@${LN} -sf ../lib/libffi-${PORTVERSION}/include/ffitarget.h \
-	    ${PREFIX}/include/
+	    ${STAGEDIR}${PREFIX}/include/
 
 regression-test: build
 	@cd ${WRKSRC} && ${MAKE} check

Added: head/devel/libffi/files/patch-src__arm__ffi.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/libffi/files/patch-src__arm__ffi.c	Sat Dec 21 05:22:05 2013	(r337118)
@@ -0,0 +1,36 @@
+# Description: Fix abort() on ARM related to __clear_cache(). This is an issue
+# for anything !apple that is using the libcompiler_rt provided by clang on ARM
+# PR: ports/149167 ports/184517
+# Patch by: cognet@ (to be upstreamed @ LLVM)
+
+--- ./src/arm/ffi.c.orig	2013-03-16 22:19:39.000000000 +1100
++++ ./src/arm/ffi.c	2013-12-03 19:30:58.440924300 +1100
+@@ -33,6 +33,11 @@
+ 
+ #include <stdlib.h>
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#endif
++
+ /* Forward declares. */
+ static int vfp_type_p (ffi_type *);
+ static void layout_vfp_args (ffi_cif *);
+@@ -582,6 +587,16 @@
+ 
+ #else
+ 
++#if defined(__FreeBSD__) && defined(__arm__)
++#define __clear_cache(start, end) do { \
++		struct arm_sync_icache_args ua; 		\
++								\
++		ua.addr = (uintptr_t)(start);			\
++		ua.len = (char *)(end) - (char *)start;		\
++		sysarch(ARM_SYNC_ICACHE, &ua);			\
++	} while (0);
++#endif
++
+ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX)				\
+ ({ unsigned char *__tramp = (unsigned char*)(TRAMP);			\
+    unsigned int  __fun = (unsigned int)(FUN);				\

Modified: head/devel/libffi/pkg-plist
==============================================================================
--- head/devel/libffi/pkg-plist	Sat Dec 21 04:39:52 2013	(r337117)
+++ head/devel/libffi/pkg-plist	Sat Dec 21 05:22:05 2013	(r337118)
@@ -7,5 +7,9 @@ lib/libffi.la
 lib/libffi.so
 lib/libffi.so.6
 libdata/pkgconfig/libffi.pc
+man/man3/ffi.3.gz
+man/man3/ffi_call.3.gz
+man/man3/ffi_prep_cif.3.gz
+man/man3/ffi_prep_cif_var.3.gz
 @dirrm lib/libffi-%%PORTVERSION%%/include
 @dirrm lib/libffi-%%PORTVERSION%%
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 13 Kubilay Kocak freebsd_committer freebsd_triage 2013-12-21 06:05:28 UTC
State Changed
From-To: feedback->closed

Last commit resolves for python26 and python31 ports that use 
devel/libffi. Closing this PR!
Comment 14 dfilter service freebsd_committer 2013-12-21 10:35:49 UTC
Author: mat
Date: Sat Dec 21 10:35:40 2013
New Revision: 337136
URL: http://svnweb.freebsd.org/changeset/ports/337136

Log:
  MFH: r337118
  
  devel/libffi: Fix abort() on ARM related to __clear_cache()
  
  The current FreeBSD/ARM __clear_cache() implementation does nothing #if
  __i386__ || __x86_64__ #else abort();
  
  cognet@ advises this is an issue for anything !Apple that is using the
  libcompiler_rt provided by Clang on ARM, and requires upstreaming.
  
  Additionally, two Python ports (python26 and python31) use devel/libffi for
  unrelated reasons, so this addresses the related PR for those ports too [2].
  
  - Enable STAGE support
  - Remove MAN* entries and update pkg-plist accordingly
  - Add LICENSE
  - Sort USE/USES section
  - Use install-strip as the INSTALL_TARGET
  
  PR:		ports/149167
  PR:		ports/184517 [2]
  Approved by:	maintainer timeout (2 weeks)
  Approved by:	portmgr (implicit)

Added:
  branches/2014Q1/devel/libffi/files/
     - copied from r337118, head/devel/libffi/files/
Modified:
  branches/2014Q1/devel/libffi/Makefile   (contents, props changed)
  branches/2014Q1/devel/libffi/pkg-plist   (contents, props changed)
Directory Properties:
  branches/2014Q1/   (props changed)

Modified: branches/2014Q1/devel/libffi/Makefile
==============================================================================
--- branches/2014Q1/devel/libffi/Makefile	Sat Dec 21 10:34:16 2013	(r337135)
+++ branches/2014Q1/devel/libffi/Makefile	Sat Dec 21 10:35:40 2013	(r337136)
@@ -3,6 +3,7 @@
 
 PORTNAME=	libffi
 PORTVERSION=	3.0.13
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	SOURCEWARE
 MASTER_SITE_SUBDIR=	${PORTNAME}
@@ -10,32 +11,32 @@ MASTER_SITE_SUBDIR=	${PORTNAME}
 MAINTAINER=	zeising@FreeBSD.org
 COMMENT=	Foreign Function Interface
 
+LICENSE=	MIT
+
 TEST_DEPENDS=	runtest:${PORTSDIR}/misc/dejagnu
 
+USES=		pathfix pkgconfig
+USE_LDCONFIG=	yes
+GNU_CONFIGURE=	yes
+
 OPTIONS_DEFINE=	TESTS
 TESTS_DESC=	Include tools for test suite
 
-NO_STAGE=	yes
 .include <bsd.port.options.mk>
 
 .if ${PORT_OPTIONS:MTESTS}
 BUILD_DEPENDS:=	${TEST_DEPENDS}
 .endif
 
-GNU_CONFIGURE=	yes
-USE_LDCONFIG=	yes
-USES=	pathfix pkgconfig
-PLIST_SUB=	PORTVERSION=${PORTVERSION}
-
+INSTALL_TARGET=	install-strip
 INFO=		libffi
-
-MAN3=		ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
+PLIST_SUB=	PORTVERSION=${PORTVERSION}
 
 post-install:
 	@${LN} -sf ../lib/libffi-${PORTVERSION}/include/ffi.h \
-	    ${PREFIX}/include/
+	    ${STAGEDIR}${PREFIX}/include/
 	@${LN} -sf ../lib/libffi-${PORTVERSION}/include/ffitarget.h \
-	    ${PREFIX}/include/
+	    ${STAGEDIR}${PREFIX}/include/
 
 regression-test: build
 	@cd ${WRKSRC} && ${MAKE} check

Modified: branches/2014Q1/devel/libffi/pkg-plist
==============================================================================
--- branches/2014Q1/devel/libffi/pkg-plist	Sat Dec 21 10:34:16 2013	(r337135)
+++ branches/2014Q1/devel/libffi/pkg-plist	Sat Dec 21 10:35:40 2013	(r337136)
@@ -7,5 +7,9 @@ lib/libffi.la
 lib/libffi.so
 lib/libffi.so.6
 libdata/pkgconfig/libffi.pc
+man/man3/ffi.3.gz
+man/man3/ffi_call.3.gz
+man/man3/ffi_prep_cif.3.gz
+man/man3/ffi_prep_cif_var.3.gz
 @dirrm lib/libffi-%%PORTVERSION%%/include
 @dirrm lib/libffi-%%PORTVERSION%%
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"