[issue7102] Problems building pyhton from source on Snow Leopard (Mac OS X 10.6)
Fredrik Hedman
report at bugs.python.org
Sun Oct 11 13:16:07 CEST 2009
New submission from Fredrik Hedman <fredrik.hedman at me.com>:
-*- mode: outline -*-
* Problems building pyhton from source on Snow Leopard (Mac OS X 10.6)
1 error and 39 warnings and a quick fix.
** Building python from source with --enable-framework
I have a fresh install of Snow Leopard and the accompanying Xcode 3.2;
see below for platform details. I'm trying to build python from
Python-3.1.1.tar.bz2. The build
$ export MACOSX_DEPLOYMENT_TARGET=10.6
$ ./configure --enable-framework
$ make
fails with the following error:
gcc -framework CoreFoundation Python.framework/Versions/3.1/Python -
o python \
Modules/python.o \
Python.framework/Versions/3.1/Python -ldl
ld: warning: in Python.framework/Versions/3.1/Python, file is not of
required architecture
ld: warning: in Python.framework/Versions/3.1/Python, file is not of
required architecture
Undefined symbols:
"_PyMem_Malloc", referenced from:
_main in python.o
_main in python.o
_main in python.o
_main in python.o
"_Py_Main", referenced from:
_main in python.o
_main in python.o
"_PyMem_Free", referenced from:
_main in python.o
_main in python.o
_main in python.o
_main in python.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [python] Error 1
** Error analysis and quick fix
The symbols above that are not defined are all defined in the library
built
before the error occurs: libpython3.1.a. For some reason configure
does not include this library when linking.
Looking at the generated Makefile and the rule BUILDPYTHON one sees
that BLDLIBRARY seems to be not set properly. If I tweak the Makefile
and set
BLDLIBRARY= -L. $(LIBRARY)
then relaunching make works just fine. The failed rule above
completes just fine and make completes without error.
** 39 warnings and "file is not of required architecture"?
The results are not flawless since there are some complaints:
Python build finished, but the necessary bits to build these modules
were not found:
ossaudiodev spwd
To find the necessary bits, look in setup.py in detect_modules() for
the module's name.
Failed to build these modules:
_curses _curses_panel
I choose to ignore these missing bits along with the other 39 warnings
generated during the build. Most seem to be about quality of code.
The most worrying is the one about
ld: warning: in Python.framework/Versions/3.1/Python, file is not of
required architecture
which I do not really understand at this point, being quite new to
Cocoa and frameworks.
** Testing
make test reports:
test_zlib
310 tests OK.
1 test failed:
test_telnetlib
24 tests skipped:
test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp
test_codecmaps_kr test_codecmaps_tw test_curses test_epoll
test_largefile test_nis test_normalization test_ossaudiodev
test_pep277 test_smtpnet test_socketserver test_startfile
test_timeout test_tk test_ttk_guionly test_urllib2net
test_urllibnet test_winreg test_winsound test_xmlrpc_net
test_zipfile64
Those skips are all expected on darwin.
So the quick fix should be acceptable.
* A more permanent fix? Needs verification
In file configure.in change (line 674)
BLDLIBRARY=''
to
BLDLIBRARY='-L. -lpython$(VERSION)'
Then generate a new configure script with
autoreconf
./configure MACOSX_DEPLOYMENT_TARGET=10.6 --enable-framework
make && make test
This seems to work fine, but must to be verified by someone with more
Cocoa and Framework knowledge since it sort of goes against the comments
that precede the changed line in configure.in.
* Platform
$ uname -a
Darwin beech.local 10.0.0 Darwin Kernel Version 10.0.0: Fri Jul 31
22:47:34 PDT 2009; root:xnu-1456.1.25~1/RELEASE_I386 i386
$ xcode-select -version
xcode-select version 895.
----------
assignee: ronaldoussoren
components: Installation, Macintosh
messages: 93851
nosy: FredrikHedman, ronaldoussoren
severity: normal
status: open
title: Problems building pyhton from source on Snow Leopard (Mac OS X 10.6)
type: compile error
versions: Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7102>
_______________________________________
More information about the Python-bugs-list
mailing list