[Pythonmac-SIG] Problems building 2.3.5 source on MacOS X Tiger
Bill Northcott
w.northcott at unsw.edu.au
Sun Jul 24 07:35:59 CEST 2005
I am trying to build Python 2.3.5 sources on MacOS X 10.4.2 using gcc-4.
My reason for doing this is to get a Tkinter linked against Tk X11
including BLT.
I ran into considerable problems with the main link which is
Makefile.pre.in:370-371 which reads
libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \
-framework System @LIBTOOL_CRUFT@
I have checked that this seems to be the same in the current cvs.
I had edited Modules/Setup after running configure to reflect the
locations of my Tcl, Tk X11 and BLT libraries and headers. The
compilation ran without problem although there are a very large
number of warnings.
My first attempt at the link failed because none of the Tcl/Tk/BLT
symbols were being found. Adding $(LOCALMODLIBS) to the link line
above solved this.
I was then left with a number of missing symbols relating to printf
functions such as _fprintf$LDBLStub. This seems to happen because
these functions in Tiger with gcc-4.0 are actually macros which
translate into symbols in the System stub library which is not
included on the link line. A little Googling revealed the underlying
cause as trying to use libtool to link the libraries. The right way
being to use the gcc compiler driver, which automatically includes
all the necessary system libraries.
I eventually succeeded with a command that looks like this:
$(CC) -o $(LDLIBRARY) -dynamiclib $(OTHER_LIBTOOL_OPT) -all_load
$(LIBRARY) $(LOCALMODLIBS) \
@LIBTOOL_CRUFT@
Apart from using the compiler driver the other changes are:
-dynamiclib the appropriate option for the driver
-all_load without this, ld just searches the libPythonXX.a for
unresolved symbols from previous objects of which their are none. -
all_load includes all objects in the static library into the link,
which is what is needed.
The reference to the System framework is no longer required because
the compiler driver looks after that.
This change enabled the make stage to complete. I am currently stuck
with one of the apps not building properly with 'make
frameworkinstall'. The framework appears to have built correctly.
Bill Northcott
More information about the Pythonmac-SIG
mailing list