ActiveState Community

How is ActiveState Python built?

Posted by rowen on 2006-09-20 12:48

The "standard" universal MacPython distribution only finds MacOS X's built in Tcl/Tk; even if one has ActiveState Tcl/Tk installed first,the MacPython installer ignores it.

Clearly you've figured out a way around this when building ActiveState Python and I was hoping you might be willing to share the secret -- here, or by contacting the relevant MacPython developer(s). I'd like to make the standard MacPython play well with ActiveState Tcl/Tk. If I learn how to do it, I'll submit a patch.

I suppose it may be as simple as making sure ActiveState Tcl/Tk is installed before making the MacPython installer package, in which case...it'll be "interesting" trying to get the packagers to do this. But worth trying.

trentm | Thu, 2006-09-21 13:36

I don't think the ActivePython build is doing anything special other than, as you say, having ActiveTcl installed on the build machine. I'd have to dig deeper to know for sure.

However the _tkinter.so in ActivePython just depends on a Tcl installed to /Library/Frameworks/Tk.framework/Versions/8.4/Tk:

$ otool -L /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-dynload/_tkinter.so
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-dynload/_tkinter.so:
/Library/Frameworks/Tcl.framework/Versions/8.4/Tcl (compatibility version 8.4.0, current version 8.4.12)
/Library/Frameworks/Tk.framework/Versions/8.4/Tk (compatibility version 8.4.0, current version 8.4.12)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.4)

Ah, I am remembering now. Of course Apple's core Tcl/Tk is in /*System*/Library/Frameworks/...

The relevant part of python's main setup.py that builds _tkinter.so (detect_tkinter_darwin) seems to look in /System/Library/Frameworks/... before /Library/Frameworks/... and ActivePython's build is not changing that.

What does "otool -L" on MacPython's _tkinter.so reveal? Do the MacPython build steps for _tkinter differ from below?

Here is the relevant build step from ActivePython 2.4.3.11's build log (on macosx-x86):

---------------------------------------------------------
building '_tkinter' extension
gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fPIC -fno-common -dynamic -DWITH_APPINIT=1 -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders -I/System/Library/Frameworks/Tk.framework/Headers -I/System/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders -I/usr/X11R6/include -I. -I/Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/./Include -I/Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/./Mac/Include -I/Library/Frameworks/Python.framework/Versions/2.4/include -I/Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/Include -I/Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python -c /Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/Modules/_tkinter.c -o build/temp.darwin-8.5.1-i386-2.4/_tkinter.o -framework Tcl -framework Tk
In file included from /System/Library/Frameworks/Tk.framework/Headers/tk.h:96,
from /Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/Modules/_tkinter.c:67:
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:140: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:343: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:462: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:480: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:505: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:506: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:518: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:531: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:1065: warning: function declaration isn't a prototype
i686-apple-darwin8-gcc-4.0.1: -framework: linker input file unused because linking not done
i686-apple-darwin8-gcc-4.0.1: Tcl: linker input file unused because linking not done
i686-apple-darwin8-gcc-4.0.1: -framework: linker input file unused because linking not done
i686-apple-darwin8-gcc-4.0.1: Tk: linker input file unused because linking not done
gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fPIC -fno-common -dynamic -DWITH_APPINIT=1 -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders -I/System/Library/Frameworks/Tk.framework/Headers -I/System/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders -I/usr/X11R6/include -I. -I/Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/./Include -I/Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/./Mac/Include -I/Library/Frameworks/Python.framework/Versions/2.4/include -I/Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/Include -I/Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python -c /Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/Modules/tkappinit.c -o build/temp.darwin-8.5.1-i386-2.4/tkappinit.o -framework Tcl -framework Tk
In file included from /System/Library/Frameworks/Tk.framework/Headers/tk.h:96,
from /Users/trentm/as/ActivePython-devel/build/py2_4_3-macosx-x86/python/Modules/tkappinit.c:17:
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:140: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:343: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:462: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:480: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:505: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:506: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:518: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:531: warning: function declaration isn't a prototype
/System/Library/Frameworks/Tk.framework/Headers/X11/Xlib.h:1065: warning: function declaration isn't a prototype
i686-apple-darwin8-gcc-4.0.1: -framework: linker input file unused because linking not done
i686-apple-darwin8-gcc-4.0.1: Tcl: linker input file unused because linking not done
i686-apple-darwin8-gcc-4.0.1: -framework: linker input file unused because linking not done
i686-apple-darwin8-gcc-4.0.1: Tk: linker input file unused because linking not done
gcc -bundle -undefined dynamic_lookup build/temp.darwin-8.5.1-i386-2.4/_tkinter.o build/temp.darwin-8.5.1-i386-2.4/tkappinit.o -L/Library/Frameworks/Python.framework/Versions/2.4/lib -o build/lib.darwin-8.5.1-i386-2.4/_tkinter.so -framework Tcl -framework Tk
---------------------------------------------------------