Author hongxu
Recipients hongxu
Date 2017-08-10.07:21:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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], [action-if-cross-compiling])

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(); pool_sema.release()"
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'))"
Date User Action Args
2017-08-10 07:21:56hongxusetrecipients: + hongxu
2017-08-10 07:21:56hongxusetmessageid: <>
2017-08-10 07:21:56hongxulinkissue31171 messages
2017-08-10 07:21:56hongxucreate