[issue31817] Compilation Error with Python 3.6.1/3.6.3 with Tkinter

2018-05-10 Thread dplusplus

dplusplus  added the comment:

I am trying to build Python 3.6.5 from source, with Tcl 8.6.8 and Tk 8.6.8, and 
I get the same issue (Building on Ubuntu 18.04, tried with GCC 7.3 and 8.1 with 
same results). 
Run 'readelf -d` on 
'build/lib.linux-x86_64-3.6/_tkinter.cpython-36m-x86_64-linux-gnu_failed.so' 
and I get three NEEDED entries:


 0x0001 (NEEDED) Shared library: [libpython3.6m.so.1.0]
 0x0001 (NEEDED) Shared library: [libpthread.so.0]
 0x0001 (NEEDED) Shared library: [libc.so.6]


Tcl and Tk libraries are not listed as needed shared libraries, which explains 
why settings runpaths (which I tried by setting CFLAGS) does not seem to work.
I'm comparing this to the ELF entries in Ubuntu's Python 3.6.5 tkinter module 
'/usr/lib/python3.6/lib-dynload/_tkinter.cpython-36m-x86_64-linux-gnu.so', 
which does have NEEDED entries for tcl8.6.so and tk8.6.so.

--
nosy: +dplusplus -6598335

___
Python tracker 
<https://bugs.python.org/issue31817>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31817] Compilation Error with Python 3.6.1/3.6.3 with Tkinter

2018-06-17 Thread dplusplus


dplusplus  added the comment:

Revisited this recently and found a fix. This problem seems to appear only if 
Tcl and/or Tk is installed in a non-standard folder.

In the ./configure call, include `-ltcl8.6 -ltk8.6` (for Tcl/Tk 8.6.x) in the 
--with-tcltk-libs specification, so the command looks like `./configure 
--with-tcltk-libs='-L/path/to/tcl/lib/location -L/path/to/tk/lib/location 
-ltcl8.6 -ltk8.6'`. Since the Tcl and Tk shared libraries are in non-standard 
locations, set LD_LIBRARY or append '-Wl,-rpath,/path/to/tcl/lib/location 
-Wl,-rpath,/path/to/tk/lib/location' to --with-tcltk-libs. Run make and the 
tkinter import failure is no longer there.


`import tkinter` runs fine, but an error appears when running the simple hello 
world script at https://docs.python.org/3.6/library/tkinter.html:

Traceback (most recent call last):
  File "/opt/tk_sample.py", line 22, in 
root = tk.Tk()
  File "/opt/Python-3.6.5/Lib/tkinter/__init__.py", line 2020, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, 
wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable tk.tcl in the following directories:
/opt/tk/lib /opt/tcl/lib/tcl8.6/tk8.6 /opt/tcl/lib/tk8.6 
/opt/Python-3.6.5/lib/tk8.6 /opt/Python-3.6.5/lib/tk8.6 /opt/lib/tk8.6 
/opt/Python-3.6.5/library

`tk.tcl` is in /opt/tk/lib/tk8.6; looking at the directories listed in the 
error message _tkinter is expecting Tcl and Tk to be installed in the same 
folder (To be fair, Tk warns about this in its configure script).
This is fixed by setting the environment variable TK_LIBRARY to the folder 
where tk.tcl is. I do not consider this a complete solution though, since 
TK_LIBRARY needs to be set to run anything that uses tkinter.

--

___
Python tracker 
<https://bugs.python.org/issue31817>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com