New submission from Hongxu Jia:

To build python for embedded Linux systems,
The 32-bit python's multiprocessing.BoundedSemaphore could not work.

1. Prerequisite
- Build 32bit python on 64bit host, add '-m32' to gcc

- Cross compling on linux platform, not have `-pthread'
  In, ac_cv_pthread=no while cross compiling
  2001 AC_MSG_CHECKING(whether $CC accepts -pthread)
  2002 AC_CACHE_VAL(ac_cv_pthread,
  2003 [ac_save_cc="$CC"
  2004 CC="$CC -pthread"
  2018 ]])],[ac_cv_pthread=yes],[ac_cv_pthread=no],[ac_cv_pthread=no])

  — Macro: AC_RUN_IFELSE (input, [action-if-true], [action-if-false], 

2. Reproduce with simplifying the prerequisite

$ git clone; cd ./cpython

$ ac_cv_pthread=no CC="gcc -m32" ./configure

$ make -j 10

$ ./python -c "import multiprocessing; pool_sema = 
multiprocessing.BoundedSemaphore(value=1); pool_sema.acquire(); 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ValueError: semaphore or lock released too many times

And the issue also caused invoking put of 'multiprocessing.Queue' hung.
$ ./python -c "import multiprocessing; queue_instance = 
multiprocessing.Queue(); queue_instance.put(('install'))"

components: Library (Lib)
messages: 300052
nosy: hongxu
priority: normal
severity: normal
status: open
title: multiprocessing.BoundedSemaphore of 32-bit python could not work while 
cross compiling on linux platform
type: crash
versions: Python 2.7, Python 3.6, Python 3.7

Python tracker <>
Python-bugs-list mailing list

Reply via email to