Title: Failed to build _multiprocessing on Mac OS X
Type: compile error Stage:
Components: macOS Versions: Python 2.7
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: asksol, dev66, jnoller, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2011-02-26 16:53 by dev66, last changed 2011-02-26 21:45 by dev66. This issue is now closed.

Messages (2)
msg129573 - (view) Author: dave (dev66) Date: 2011-02-26 16:52
hi community,

i cannot import multiprocessing since it fails(?) during build.
could someone point out a solution for me?

thanks a lot in advance.

$ python
Python 2.7.1 (r271:86832, Feb 26 2011, 17:19:29) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import threading
>>> import multiprocessing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tools/python/lib/python2.7/multiprocessing/", line 83, in <module>
    import _multiprocessing
ImportError: No module named _multiprocessing

This is what i did to compile python 2.7:

export ARCHFLAGS="-arch i386"
export CXXFLAGS="-arch i386"
export CFLAGS="-arch i386"
export FFLAGS="-arch i386"
export LDFLAGS="-Wall -undefined dynamic_lookup -arch i386"

checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... darwin
checking machine type as reported by uname -m... i386
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for --with-cxx-main=<compiler>... no
checking for g++... g++
config.status: pyconfig.h is unchanged
creating Modules/Setup
creating Modules/Setup.local
creating Makefile

make -j 4
/private/var/tmp/Python-2.7.1/Modules/_multiprocessing/semaphore.c: In function 'semlock_acquire':
/private/var/tmp/Python-2.7.1/Modules/_multiprocessing/semaphore.c:314: warning: implicit declaration of function 'sem_timedwait'
*** WARNING: renaming "_multiprocessing" since importing it failed: dlopen(build/lib.macosx-10.6-i386-2.7/, 2): Symbol not found: _sem_timedwait
  Referenced from: /private/var/tmp/Python-2.7.1/build/lib.macosx-10.6-i386-2.7/
  Expected in: flat namespace
 in /private/var/tmp/Python-2.7.1/build/lib.macosx-10.6-i386-2.7/
ranlib libpython2.7.a
gcc -Wall -undefined dynamic_lookup -arch i386 -u _PyMac_Error -o python.exe \
                        Modules/python.o \
                        libpython2.7.a -ldl  -framework CoreFoundation     
building dbm using ndbm

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             gdbm               linuxaudiodev   
ossaudiodev        sunaudiodev                        
To find the necessary bits, look in in detect_modules() for the module's name.

Failed to build these modules:
_multiprocessing   spwd
msg129601 - (view) Author: dave (dev66) Date: 2011-02-26 21:45
seems the multiprocessing issue was produced by the dynamic_lookup 
parameter in the LDFLAGS...
after removing this, "import multiprocessing" works...


> export LDFLAGS="-Wall -undefined dynamic_lookup -arch i386"
Date User Action Args
2011-02-26 21:45:33dev66setstatus: open -> closed

messages: + msg129601
resolution: works for me
nosy: ronaldoussoren, ned.deily, jnoller, asksol, dev66
2011-02-26 16:54:30pitrousetnosy: + ned.deily
2011-02-26 16:54:07pitrousetassignee: ronaldoussoren ->

nosy: + asksol, jnoller
2011-02-26 16:53:00dev66create