diff mbox

[12/12] libffi and python: need threads support

Message ID 1410537011-29662-13-git-send-email-jezz@sysmic.org
State Accepted
Headers show

Commit Message

Jérôme Pouiller Sept. 12, 2014, 3:50 p.m. UTC
libffi depends on pthreads.

Python depends on libffi (it can provide a builtin libffi, but also depends on
pthreads). Thus this patch also disable Python support if toolchain is compiled
w/o treads support.

Fixes http://sysmic.org/~jezz/results/204099dd:

../src/closures.c:119:21: fatal error: pthread.h: No such file or directory

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
---
 package/libffi/Config.in | 4 ++++
 package/python/Config.in | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Peter Korsgaard Sept. 13, 2014, 7:39 a.m. UTC | #1
>>>>> "Jérôme" == Jérôme Pouiller <jezz@sysmic.org> writes:

 > libffi depends on pthreads.
 > Python depends on libffi (it can provide a builtin libffi, but also depends on
 > pthreads). Thus this patch also disable Python support if toolchain is compiled
 > w/o treads support.

 > Fixes http://sysmic.org/~jezz/results/204099dd:

 > ../src/closures.c:119:21: fatal error: pthread.h: No such file or directory

 > Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
 > ---
 >  package/libffi/Config.in | 4 ++++
 >  package/python/Config.in | 4 +++-

python is not the only user of libffi. From a quick look, they all
depends on threads except for python3, so I've made the same change to
python3.

 >  2 files changed, 7 insertions(+), 1 deletion(-)

 > diff --git a/package/libffi/Config.in b/package/libffi/Config.in
 > index 7211f8f..6edf570 100644
 > --- a/package/libffi/Config.in
 > +++ b/package/libffi/Config.in
 > @@ -1,5 +1,6 @@
 >  config BR2_PACKAGE_LIBFFI
 >  	bool "libffi"
 > +	depends on BR2_TOOLCHAIN_HAS_THREADS
 >  	help
 >  	  The libffi library provides a portable, high level
 >  	  programming interface to various calling conventions. This
 > @@ -7,3 +8,6 @@ config BR2_PACKAGE_LIBFFI
 >  	  interface description at run-time.
 
 >  	  http://sourceware.org/libffi/
 > +
 > +comment "libffi needs a toolchain w/ threads"
 > +	depends on !BR2_TOOLCHAIN_HAS_THREADS
 > diff --git a/package/python/Config.in b/package/python/Config.in
 > index a0c78c6..85438a4 100644
 > --- a/package/python/Config.in
 > +++ b/package/python/Config.in
 > @@ -3,15 +3,17 @@ config BR2_PACKAGE_PYTHON
 >  	depends on BR2_USE_WCHAR
 >  	# uses fork()
 >  	depends on BR2_USE_MMU
 > +	depends on BR2_TOOLCHAIN_HAS_THREADS # libffi
 >  	select BR2_PACKAGE_LIBFFI
 >  	help
 >  	  The python language interpreter.
 
 >  	  http://www.python.org/
 
 > -comment "python needs a toolchain w/ wchar"
 > +comment "python needs a toolchain w/ wchar and threads"
 >  	depends on BR2_USE_MMU
 >  	depends on !BR2_USE_WCHAR
 > +	depends on !BR2_TOOLCHAIN_HAS_THREADS

That's wrong. Seperate 'depends on' gets ANDed together, E.G. they all
have to be true, whereas we want to display the line whenever
mmu and either !wchar OR !threads, so it should be

depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS.

Committed with that fixed, thanks.
Thomas Petazzoni Sept. 13, 2014, 7:57 a.m. UTC | #2
Dear Jérôme Pouiller,

On Fri, 12 Sep 2014 17:50:11 +0200, Jérôme Pouiller wrote:
> libffi depends on pthreads.
> 
> Python depends on libffi (it can provide a builtin libffi, but also depends on
> pthreads). Thus this patch also disable Python support if toolchain is compiled
> w/o treads support.
> 
> Fixes http://sysmic.org/~jezz/results/204099dd:
> 
> ../src/closures.c:119:21: fatal error: pthread.h: No such file or directory

This seems weird. We have a no threads toolchain in our autobuilders
and it was never detected, even though I'm pretty sure libffi was built
a number of times. Do you have the configuration that exhibits the
problem?

Thanks,

Thomas
Jérôme Pouiller Sept. 14, 2014, 6:42 a.m. UTC | #3
On Saturday 13 September 2014 09:57:12 Thomas Petazzoni wrote:
> Dear Jérôme Pouiller,
> 
> On Fri, 12 Sep 2014 17:50:11 +0200, Jérôme Pouiller wrote:
> > libffi depends on pthreads.
> > 
> > Python depends on libffi (it can provide a builtin libffi, but also
> > depends on pthreads). Thus this patch also disable Python support if
> > toolchain is compiled w/o treads support.
> > 
> > Fixes http://sysmic.org/~jezz/results/204099dd:
> > 
> > ../src/closures.c:119:21: fatal error: pthread.h: No such file or
> > directory
> 
> This seems weird. We have a no threads toolchain in our autobuilders
> and it was never detected, even though I'm pretty sure libffi was built
> a number of times. Do you have the configuration that exhibits the
> problem?

I can reproduce problem using:

BR2_powerpc=y
BR2_powerpc_440=y
BR2_TOOLCHAIN_BUILDROOT_LARGEFILE=y
BR2_TOOLCHAIN_BUILDROOT_INET_IPV6=y
BR2_TOOLCHAIN_BUILDROOT_INET_RPC=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PTHREADS_NONE=y
BR2_BINUTILS_VERSION_2_24=y
BR2_GCC_VERSION_4_9_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_LIBFFI=y

In add, I found this patch :
  http://lists.busybox.net/pipermail/buildroot/2012-November/061976.html

It is seems is had never been applied and it should solve this issue.
diff mbox

Patch

diff --git a/package/libffi/Config.in b/package/libffi/Config.in
index 7211f8f..6edf570 100644
--- a/package/libffi/Config.in
+++ b/package/libffi/Config.in
@@ -1,5 +1,6 @@ 
 config BR2_PACKAGE_LIBFFI
 	bool "libffi"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
 	help
 	  The libffi library provides a portable, high level
 	  programming interface to various calling conventions. This
@@ -7,3 +8,6 @@  config BR2_PACKAGE_LIBFFI
 	  interface description at run-time.
 
 	  http://sourceware.org/libffi/
+
+comment "libffi needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
diff --git a/package/python/Config.in b/package/python/Config.in
index a0c78c6..85438a4 100644
--- a/package/python/Config.in
+++ b/package/python/Config.in
@@ -3,15 +3,17 @@  config BR2_PACKAGE_PYTHON
 	depends on BR2_USE_WCHAR
 	# uses fork()
 	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libffi
 	select BR2_PACKAGE_LIBFFI
 	help
 	  The python language interpreter.
 
 	  http://www.python.org/
 
-comment "python needs a toolchain w/ wchar"
+comment "python needs a toolchain w/ wchar and threads"
 	depends on BR2_USE_MMU
 	depends on !BR2_USE_WCHAR
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
 
 if BR2_PACKAGE_PYTHON