New submission from Hongxu Jia: To build python for embedded Linux systems, (http://www.yoctoproject.org/docs/2.3.1/yocto-project-qs/yocto-project-qs.html) 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 configure.ac, 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" 2005 AC_RUN_IFELSE([AC_LANG_SOURCE([[ [snip] 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 https://github.com/python/cpython.git; 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'))" ---------- 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 <rep...@bugs.python.org> <http://bugs.python.org/issue31171> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com