Issue31817
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017-10-19 10:07 by jpc2350, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (14) | |||
---|---|---|---|
msg304612 - (view) | Author: Josh Cullum (jpc2350) | Date: 2017-10-19 10:07 | |
Hi Guys, I'm trying to build Python 3.6.1 and 3.6.3, with both, .configure / make / make install work correctly as they should, however, trying to import _tkinter doesn't work. Going back to the compilation, I get the following error in the make log: *** WARNING: renaming "_tkinter" since importing it failed: build/lib.linux-x86_64-3.6/_tkinter.cpython-36m-x86_64-linux-gnu.so: undefined symbol: Tcl_GetCharLength Following modules built successfully but were removed because they could not be imported: _tkinter Any Idea's on how to fix the undefined symbol error? This happens with both Tcl/Tk 8.6.6 and 8.6.7. The following is the configure options: --prefix=/tools/apps/python/3.6.1 --with-tcltk-includes='-I/tools/apps/Tcl/8.6.7/include -I/tools/apps/Tk/8.6.7/include' --with-tcltk-libs='-L/tools/apps/Tcl/8.6.7/lib -L/tools/apps/Tk/8.6.7/lib' --enable-optimizations --enable-shared |
|||
msg304675 - (view) | Author: Ned Deily (ned.deily) * ![]() |
Date: 2017-10-20 19:57 | |
You may need to set LD_LIBRARY_PATH env variable to point to your Tcl and Tk libraries or, better, add an rpath entry to LDFLAGS. |
|||
msg304676 - (view) | Author: Josh Cullum (jpc2350) | Date: 2017-10-20 20:06 | |
Hi Ned, LD_LIBRARY_PATH has been set with the lib paths for both, like I said the module itself builds, I’ll add the module build logs later but the module try’s to get loaded before the tests which unfortunately gives the error undefined symbol: Tcl_GetCharLength On Fri, 20 Oct 2017 at 20:57, Ned Deily <report@bugs.python.org> wrote: > > Ned Deily <nad@python.org> added the comment: > > You may need to set LD_LIBRARY_PATH env variable to point to your Tcl and > Tk libraries or, better, add an rpath entry to LDFLAGS. > > ---------- > nosy: +ned.deily > > _______________________________________ > Python tracker <report@bugs.python.org> > <https://bugs.python.org/issue31817> > _______________________________________ > |
|||
msg304788 - (view) | Author: Josh Cullum (jpc2350) | Date: 2017-10-23 09:32 | |
Hi Ned, Please see the make logs for _tkinter below: building '_tkinter' extension gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -fprofile-generate -DWITH_APPINIT=1 -I./Include -I. -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/tools/src/Python-3.6.3/Include -I/tools/src/Python-3.6.3 -c /tools/src/Python-3.6.3/Modules/_tkinter.c -o build/temp.linux-x86_64-3.6/tools/src/Python-3.6.3/Modules/_tkinter.o -I/tools/apps/tcl/8.6.7/include -I/tools/apps/tk/8.6.7/include gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -fprofile-generate -DWITH_APPINIT=1 -I./Include -I. -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/tools/src/Python-3.6.3/Include -I/tools/src/Python-3.6.3 -c /tools/src/Python-3.6.3/Modules/tkappinit.c -o build/temp.linux-x86_64-3.6/tools/src/Python-3.6.3/Modules/tkappinit.o -I/tools/apps/tcl/8.6.7/include -I/tools/apps/tk/8.6.7/include gcc -pthread -shared -fprofile-generate -fprofile-generate build/temp.linux-x86_64-3.6/tools/src/Python-3.6.3/Modules/_tkinter.o build/temp.linux-x86_64-3.6/tools/src/Python-3.6.3/Modules/tkappinit.o -L. -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lpython3.6m -o build/lib.linux-x86_64-3.6/_tkinter.cpython-36m-x86_64-linux-gnu.so -L/tools/apps/tcl/8.6.7/lib -L/tools/apps/tk/8.6.7/lib |
|||
msg305431 - (view) | Author: Josh Cullum (jpc2350) | Date: 2017-11-02 15:45 | |
LD_LIBRARY_PATH includes /tools/apps/tk/8.6.7/lib/:/tools/apps/tcl/8.6.7/lib/ and several other library paths that are required. Why would I be getting an undefined symbol error on this module? _tkinter.cpython-36m-x86_64-linux-gnu.so: undefined symbol: Tcl_GetCharLength I've even tried added g++ as an option, but Python fails to be against this: issue23644 I'm stuck now, and this is causing real problems for some pipelines that I'm trying to get running. |
|||
msg305472 - (view) | Author: Ned Deily (ned.deily) * ![]() |
Date: 2017-11-03 12:23 | |
Josh, sorry I don't have any further ideas off the top of my head and I likely won't have time for several weeks to try to reproduce this myself. Have you tried renaming the _tkinter extension back, doing a "make install", and seeing whether it imports properly from the installed python? |
|||
msg306272 - (view) | Author: Josh Cullum (jpc2350) | Date: 2017-11-15 15:22 | |
Hi Ned, Tried that but unfortunately it didn't work. It still produces an error within the make install function which then re-removes the module - it does however create a folder called tkinter. |
|||
msg307118 - (view) | Author: Josh Cullum (jpc2350) | Date: 2017-11-28 11:11 | |
Hi Ned, I've built a new machine, tried the build again using Tk and Tcl shared libraries, built Python-3.6.3 and it's still not worked. The Python/3.6.3-foss-2017b/lib/python3.6/tkinter folder gets created and populated with several files, but when you try and import tkinter in python, it fails to import with: >>> import tkinter Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/tools/apps/Python/3.6.3-foss-2017b/lib/python3.6/tkinter/__init__.py", line 36, in <module> import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter' Running __init__.py from the tkinter folder produces this output: Traceback (most recent call last): File "__init__.py", line 36, in <module> import _tkinter # If this fails your Python may not be configured for Tk ModuleNotFoundError: No module named '_tkinter' I'm guessing something is failing to build correctly but it's not being logged. Both Tk and Tcl versions 8.6.6 and 8.6.7 are available and working on the system. |
|||
msg314638 - (view) | Author: Artur Yarmolin (6598335) | Date: 2018-03-29 08:46 | |
Python 3.6.4 tcl8.6.5+dfsg-2 tk8.6.5-1 The problem: *** WARNING: renaming "_tkinter" since importing it failed: build/lib.linux-x86_64-3.6/_tkinter.cpython-36m-x86_64-linux-gnu.so: undefined symbol: Tcl_GetCharLength still remains! |
|||
msg316385 - (view) | Author: (dplusplus) | Date: 2018-05-11 03:27 | |
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: 0x0000000000000001 (NEEDED) Shared library: [libpython3.6m.so.1.0] 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (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. |
|||
msg319861 - (view) | Author: (dplusplus) | Date: 2018-06-18 05:13 | |
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 <module> 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. |
|||
msg370284 - (view) | Author: zhang (zhang) | Date: 2020-05-29 09:54 | |
Josh,Did you solve this problem?I met the same error when install python. *** WARNING: renaming "_tkinter" since importing it failed: build/lib.linux-x86_64-3.6/_tkinter.cpython-36m-x86_64-linux-gnu.so: undefined symbol: Tcl_GetCharLength |
|||
msg370289 - (view) | Author: Ned Deily (ned.deily) * ![]() |
Date: 2020-05-29 10:17 | |
@zhang, Did you try the solution given by dplusplus in the previous message (msg319861)? |
|||
msg411150 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2022-01-21 17:09 | |
3.6 is no longer maintained. Is this a problem on current versions or can be close this? |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:53 | admin | set | github: 75998 |
2022-01-30 16:51:17 | iritkatriel | set | status: pending -> closed stage: resolved |
2022-01-21 17:09:22 | iritkatriel | set | status: open -> pending nosy: + iritkatriel messages: + msg411150 resolution: out of date |
2020-05-29 10:26:45 | ned.deily | link | issue25247 superseder |
2020-05-29 10:24:15 | ned.deily | link | issue40812 superseder |
2020-05-29 10:17:37 | ned.deily | set | messages: + msg370289 |
2020-05-29 09:54:47 | zhang | set | nosy:
+ zhang messages: + msg370284 |
2018-06-18 05:13:46 | dplusplus | set | messages: + msg319861 |
2018-05-11 03:27:10 | dplusplus | set | nosy:
+ dplusplus, - 6598335 messages: + msg316385 |
2018-03-29 08:46:52 | 6598335 | set | nosy:
+ 6598335 messages: + msg314638 |
2017-11-28 11:11:08 | jpc2350 | set | messages: + msg307118 |
2017-11-15 15:22:36 | jpc2350 | set | messages: + msg306272 |
2017-11-03 12:23:02 | ned.deily | set | messages: + msg305472 |
2017-11-02 15:45:58 | jpc2350 | set | messages: + msg305431 |
2017-10-23 09:32:53 | jpc2350 | set | messages: + msg304788 |
2017-10-20 20:06:45 | jpc2350 | set | messages: + msg304676 |
2017-10-20 19:57:18 | ned.deily | set | nosy:
+ ned.deily messages: + msg304675 |
2017-10-19 10:07:54 | jpc2350 | create |