From: Jim I. <ji...@ap...> - 2001-10-17 05:08:47
|
Tony, On Tuesday, October 16, 2001, at 08:20 PM, Tony Lownds wrote: > Hi Jim, > > I'm trying to link Python's Tk interface with the new Tk/Aqua stuff. > > I can get everything to compile and link, but I don't like how I have > to do it. I'm hoping you have some suggestions. > > This is how the compile step looks when it works: > > cc -g -O3 -Wall -Wstrict-prototypes -no-cpp-precomp -fno-common > -dynamic > -I. -I../Include -DHAVE_CONFIG_H -DWITH_APPINIT > -I/Library/Frameworks/Tcl.framework/Headers/ > -I/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders/ > -I/Library/Frameworks/Tk.framework/Headers/ > -I/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders/ > -c ../Modules/_tkinter.c -o Modules/_tkinter.o > > The -I that reaches into the framework seems necessary because when I > use a -framework option on the compile step the compiler can't find > tclPlatDefs.h, included from tcl.h. Apparently the files in > PrivateHeaders aren't being found. > > Also, to compile against the frameworks I have to change the > _tkinter.c sources to #include <Tcl/tcl.h> and <Tk/tk.h>, which is OK > but not ideal - do you know of any magic compiler options to avoid that? > The official way to do framework include and linking is to use: -framework Tcl -framework Tk and then use <Tcl/Tcl.h>, etc... The problem is that we are going to have to use the framework notation for ALL the headers. So for instance tcl.h just does: #include <tclDecls.h> which has to be: #include <Tcl/tclDecls.h> etc... As I said in the announcement, I haven't really had ANY time to play with the details of getting the framework version of Tk to be useful for building extensions, of which TkInter is an extreme form. For now, I have been using the source tree instead. For instance, I need to figure out some good way of stuffing the framework style includes into the headers, maybe as I copy them over into the framework? Anyway, I just haven't thought about this yet. For now, you could also cheese out and just include from the source tree for now. I bet once you get it built your troubles will only be beginning, since the Mac OS X event loop and the Mac event loop and the Unix event loops are all totally different... Jack Jensen and I have discussed this a little bit, but we haven't reached any firm conclusions yet. > Finally, tk.h requires X11/{X,Xlib}.h, which is not included in the > snapshot. That also isn't being found when I compile with -framework > Tcl and -framework Tk. > Oops, I will copy them over in the next snapshot, till then, you can just copy them into the framework by hand from the sources. > FYI, here is the linking command: > > cc -Wl,-F. -Wl,-flat_namespace,-U,_environ -bundle -framework Python > Modules/_tkinter.o Modules/tkappinit.o > -framework Tcl -framework Tk -o Modules/_tkinter.so > Jim _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- Jim Ingham ji...@ap... Developer Tools - gdb |