Issue 1447587: Mac Framework build fails on intel (original) (raw)
hardware: intel duo imac 20" os x: 10.4.6
steps:
./configure
--enable-framework=/Library/Frameworks/Python.framework
--enable-shared
make
...
c++ -u _PyMac_Error
Python.framework/Versions/2.4/Python -o python.exe
Modules/python.o
-ldl
/usr/bin/ld: warning
Python.framework/Versions/2.4/Python cputype (18,
architecture ppc) does not match cputype (7) for
specified -arch flag: i386 (file not loaded)
/usr/bin/ld: Undefined symbols:
_PyMac_Error
_Py_Main
collect2: ld returned 1 exit status
make: *** [python.exe] Error 1
analysis:
The arch flag for the Python shared library in the framework is incorrect.
file shows Python.framework/Versions/2.4/Python to be a PPC binary.
scroll up in terminal to find link statement for Python:
libtool -o Python.framework/Versions/2.4/Python
-dynamic libpython2.4.a
-lSystem -lSystemStubs -arch_only ppc
-install_name
/Library/Frameworks/Python.framework/Python.framework/Versions/2.4/Python
-compatibility_version 2.4 -current_version 2.4
The '-arch_only ppc' flag is the problem.
workaround:
After running configure, open makefile and so a s/arch_only ppc/arch_only i386/g
what needs to be fixed:
Around line 10218 in configure:
Darwin/[01234567].) LIBTOOL_CRUFT="-framework
System -lcc_dynamic -arch_only ppc"
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name (PYTHONFRAMEWORKINSTALLDIR)/Versions/(PYTHONFRAMEWORKINSTALLDIR)/Versions/(PYTHONFRAMEWORKINSTALLDIR)/Versions/(VERSION)/$(PYTHONFRAMEWORK)'
LIBTOOL_CRUFT=$LIBTOOL_CRUFT'
-compatibility_version $(VERSION) -current_version
$(VERSION)';;
Darwin/)
gcc_version=gcc -v 2>&1 | grep version | cut -d\ -f3
if test ${gcc_version} '<' 4.0
then
LIBTOOL_CRUFT="-lcc_dynamic"
else
LIBTOOL_CRUFT=""
fi