Building Python with non-standard tcl/tk support

  • Thread starter Steven D'Aprano
  • Start date
S

Steven D'Aprano

I'm trying to re-build Python 3.2 with support for TCL/TK 8.5, but when I
run "make" I get this message:

Failed to build these modules:
_tkinter

and after installing 3.2 I still have this:
'8.4'


What do I need to do to have Python 3.2 use tcl/tk 8.5?


I have installed tcl/tk 8.5.11 from source, and the binaries are here:

/usr/local/lib/libtcl8.5.so
/usr/local/lib/libtk8.5.so


In the Python 3.2 source, I do the usual:

../configure
make
sudo make altinstall


(altinstall to avoid nuking the system Python)
 
W

Westley Martínez

I'm trying to re-build Python 3.2 with support for TCL/TK 8.5, but when I
run "make" I get this message:

Failed to build these modules:
_tkinter

and after installing 3.2 I still have this:

'8.4'


What do I need to do to have Python 3.2 use tcl/tk 8.5?


I have installed tcl/tk 8.5.11 from source, and the binaries are here:

/usr/local/lib/libtcl8.5.so
/usr/local/lib/libtk8.5.so


In the Python 3.2 source, I do the usual:

./configure
make
sudo make altinstall


(altinstall to avoid nuking the system Python)

That's all you should have to do, but on my system the Tk libraries are
in /usr/lib not /usr/local/lib. So try doing ./configure
--prefix=/usr/local or try setting LDFLAGS to "-L/usr/local/lib".
 
S

Steven D'Aprano

That's all you should have to do, but on my system the Tk libraries are
in /usr/lib not /usr/local/lib. So try doing ./configure
--prefix=/usr/local or try setting LDFLAGS to "-L/usr/local/lib".

Thanks, but that doesn't work. "make" still says it failed to build
_tkinter, and after "make altinstall" it still picks up tck/tkl 8.4.


Okay, now I'm making progress... if I remove the previously existing
_tkinter in lib-dynload, and re-run "make", I get something new:

building '_tkinter' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -DWITH_APPINIT=1 -I/usr/X11/include -IInclude -I. -I./
Include -I/usr/local/include -I/tmp/Python-3.2.2 -c /tmp/Python-3.2.2/
Modules/_tkinter.c -o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
_tkinter.o
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -DWITH_APPINIT=1 -I/usr/X11/include -IInclude -I. -I./
Include -I/usr/local/include -I/tmp/Python-3.2.2 -c /tmp/Python-3.2.2/
Modules/tkappinit.c -o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
tkappinit.o
gcc -pthread -shared build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
_tkinter.o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/tkappinit.o
-L/usr/X11/lib -L/usr/local/lib -ltk8.5 -ltcl8.5 -lX11 -o build/lib.linux-
i686-3.2/_tkinter.cpython-32m.so
*** WARNING: renaming "_tkinter" since importing it failed: libtk8.5.so:
cannot open shared object file: No such file or directory

Failed to build these modules:
_tkinter
 
W

Westley Martínez

Okay, now I'm making progress... if I remove the previously existing
_tkinter in lib-dynload, and re-run "make", I get something new:

building '_tkinter' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -DWITH_APPINIT=1 -I/usr/X11/include -IInclude -I. -I./
Include -I/usr/local/include -I/tmp/Python-3.2.2 -c /tmp/Python-3.2.2/
Modules/_tkinter.c -o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
_tkinter.o
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
Wstrict-prototypes -DWITH_APPINIT=1 -I/usr/X11/include -IInclude -I. -I./
Include -I/usr/local/include -I/tmp/Python-3.2.2 -c /tmp/Python-3.2.2/
Modules/tkappinit.c -o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
tkappinit.o
gcc -pthread -shared build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/
_tkinter.o build/temp.linux-i686-3.2/tmp/Python-3.2.2/Modules/tkappinit.o
-L/usr/X11/lib -L/usr/local/lib -ltk8.5 -ltcl8.5 -lX11 -o build/lib.linux-
i686-3.2/_tkinter.cpython-32m.so
*** WARNING: renaming "_tkinter" since importing it failed: libtk8.5.so:
cannot open shared object file: No such file or directory

Failed to build these modules:
_tkinter

Verify that libtk8.5.so exists in /usr/local/lib and verify you have
read permission.

You could try to write a Tk C program (or find one) and try building
that with cc -L/usr/X11/lib -L/usr/local/lib -ltk8.5 -ltcl8.5 -lX11 .
If that works then your Tk libraries are installed properly and
something is wonky with your Python build.
 
S

Steven D'Aprano

Verify that libtk8.5.so exists in /usr/local/lib and verify you have
read permission.

[steve@ando ~]$ ls -l /usr/local/lib/*tk*.so
-r-xr-xr-x 1 root root 1233986 Mar 4 04:01 /usr/local/lib/libtk8.5.so
[steve@ando ~]$ ls -l /usr/local/lib/*tcl*.so
-r-xr-xr-x 1 root root 1133948 Mar 4 03:55 /usr/local/lib/libtcl8.5.so
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top