#25221: "import Tkinter" fails in python26 @2.6.5_1 with 64-bit tk @8.5.8+quartz ---------------------------------+------------------------------------------ Reporter: jabronson@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 1.9.0 Keywords: | Port: python26 ---------------------------------+------------------------------------------ A few months ago I built 64-bit Macports tk +quartz (using the [attachment:tk-858-decarbon.patch:ticket:20799 fix] from #20799), after which I was able to use the Tkinter module of Macports python26 (then @2.6.4) to create native Aqua windows. I just tried "import Tkinter" for the first time in a while and now I get: {{{ Python 2.6.5 (r265:79063, Jun 12 2010, 12:43:44) [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import Tkinter Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6 /lib-tk/Tkinter.py", line 39, in <module> import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter }}}
As you can see, I've since upgraded to Python 2.6.5. I just tried building Macports Python 2.6.5 again and sure enough, I noticed this output: {{{ ... building '_tkinter' extension /usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DWITH_APPINIT=1 -I. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/./Include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/./Mac/Include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include -I. -IInclude -I./Include -I/opt/local/include -I/opt/local/include/ncurses -I/usr/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/Include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5 -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/Modules/_tkinter.c -o build/temp.macosx-10.6-x86_64-2.6/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/Modules/_tkinter.o /usr/bin/gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DWITH_APPINIT=1 -I. -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/./Include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/./Mac/Include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include -I. -IInclude -I./Include -I/opt/local/include -I/opt/local/include/ncurses -I/usr/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/Include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5 -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/Modules/tkappinit.c -o build/temp.macosx-10.6-x86_64-2.6/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/Modules/tkappinit.o /usr/bin/gcc-4.2 -L/opt/local/lib -arch x86_64 -bundle -undefined dynamic_lookup build/temp.macosx-10.6-x86_64-2.6/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/Modules/_tkinter.o build/temp.macosx-10.6-x86_64-2.6/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_python26/work/Python-2.6.5/Modules/tkappinit.o -L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib -L/opt/local/lib -L/usr/local/lib -ltk8.5 -ltcl8.5 -lX11 -o build/lib.macosx-10.6-x86_64-2.6/_tkinter.so ld: library not found for -lX11 collect2: ld returned 1 exit status ... Failed to build these modules: _tkinter ... }}} It looks like it's mistakenly passing "-lX11" when it's trying to build _tkinter.so. Am I correct in suspecting that since my tk is built with +quartz, libX11 should not be involved in building _tkinter? Is there a way to fix this? I'm running Macports 1.9.0 and OS X 10.6.3. Thanks! Josh -- Ticket URL: <http://trac.macports.org/ticket/25221> MacPorts <http://www.macports.org/> Ports system for Mac OS