I just installed the latest Ubuntu Desktop 21.10 and built Tcl.home/alteh/dev/Tcl-Tk/tcl8.6.12/unix -DPACKAGE_NAME=\"tk\" -DPACKAGE_TARNAME=\"tk\" -DPACKAGE_VERSION=\"8.6\" -DPACKAGE_STRING=\"tk\ 8.6\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_
But Tk is not building on Ubuntu from the unix directory.
alteh@alteh-VirtualBox:~/dev/Tcl-Tk/tk8.6.12/unix$ make
gcc -c -I/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../unix -I/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic -I/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../bitmaps -O2 -pipe -Wall -Wpointer-arith -fPIC -DBUILD_tk -I/home/alteh/dev/Tcl-Tk/tcl8.6.12/generic -I/
In file included from /home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tkPort.h:21,
from /home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tkInt.h:19,
from /home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tkStubLib.c:14:
/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tk.h:99:13: fatal error: X11/Xlib.h: No such file or directory
99 | # include <X11/Xlib.h>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1168: tkStubLib.o] Error 1 alteh@alteh-VirtualBox:~/dev/Tcl-Tk/tk8.6.12/unix$
Also, the built-in default Tck/Tk does not seem to be properly built and installed.
alteh@alteh-VirtualBox:~/dev/Tcl-Tk/tk8.6.12/unix$ wish
application-specific initialization failed: Can't find a usable tk.tcl in the following directories:
/usr/local/lib/tcl8.6/tk8.6 /usr/local/lib/tk8.6 /usr/lib/tk8.6 /usr/lib/tk8.6 /lib/tk8.6 /usr/library
This probably means that tk wasn't installed properly.
%
How can I get Tcl/Tk built and installed properly on Ubuntu please?
I just installed the latest Ubuntu Desktop 21.10 and built Tcl.
But Tk is not building on Ubuntu from the unix directory.
/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tk.h:99:13: fatal error: X11/Xlib.h: No such file or directory
99 | # include <X11/Xlib.h>
| ^~~~~~~~~~~~
compilation terminated.
Le 22/01/2022 à 23:37, Alwyn Teh a écrit :
I just installed the latest Ubuntu Desktop 21.10 and built Tcl.
But Tk is not building on Ubuntu from the unix directory.
/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tk.h:99:13: fatal error: X11/Xlib.h: No such file or directoryYou probably need to install the libx11-dev package.
99 | # include <X11/Xlib.h>
| ^~~~~~~~~~~~
compilation terminated.
Regards,
Francois
On Sunday, January 23, 2022 at 6:38:24 AM UTC-5, Francois Vogel wrote:
Le 22/01/2022 à 23:37, Alwyn Teh a écrit :
I just installed the latest Ubuntu Desktop 21.10 and built Tcl.
But Tk is not building on Ubuntu from the unix directory.
/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tk.h:99:13: fatal error: X11/Xlib.h: No such file or directoryYou probably need to install the libx11-dev package.
99 | # include <X11/Xlib.h>
| ^~~~~~~~~~~~
compilation terminated.
Regards,
Francois
Don't the tk sources come with their own ./xlib/X11/Xlib.h ?
Maybe it is a matter of making sure that directory is in one of those "-I" (<--uppercase i) include paths?
At Mon, 24 Jan 2022 08:43:18 -0800 (PST) gsal <[email protected]> wrote:
On Sunday, January 23, 2022 at 6:38:24 AM UTC-5, Francois Vogel wrote:
Le 22/01/2022 à 23:37, Alwyn Teh a écrit :
I just installed the latest Ubuntu Desktop 21.10 and built Tcl.
But Tk is not building on Ubuntu from the unix directory.
/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tk.h:99:13: fatal error: X11/Xlib.h: No such file or directoryYou probably need to install the libx11-dev package.
99 | # include <X11/Xlib.h>
| ^~~~~~~~~~~~
compilation terminated.
Regards,
Francois
Don't the tk sources come with their own ./xlib/X11/Xlib.h ?That is a "fake" xlib/X11/Xlib.h for MS-Windows and MacOSX. Tk is written in terms of XLib and under MS-Windows and MacOSX some of the XLib-isms are "faked" in terms of MS-Windows or MacOSX GUI features. Under actual UNIX or Linux, Tk uses the Xlib.h provided by X11. A typical Linux distro separates the X11 runtime (shared) libraries from the X11 development stuff (header file, link libraries, etc.). Commonly a normal Linux Desktop install just installs the runtime. It is necessary to install the -dev (-devel under RedHat-ish distros) packages if one plans on building tcl/tk from sources.
Maybe it is a matter of making sure that directory is in one of those "-I" (<--uppercase i) include paths?
The OP *could* have just installed tcl and tk from the distro:
sudo apt install tcl tk
But I guess he wanted to build from source...
--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services [email protected] -- Webhosting Services
Traceback (most recent call last):import tkinter
tkinter._test()
On Monday, 24 January 2022 at 17:07:12 UTC, Robert Heller wrote:installing from distro so I shouldn't have to). Nothing. I even tried manually copying the tk8.6 directory into lib and tcl8.6, no effect.
At Mon, 24 Jan 2022 08:43:18 -0800 (PST) gsal <[email protected]> wrote:
That is a "fake" xlib/X11/Xlib.h for MS-Windows and MacOSX. Tk is written in >> terms of XLib and under MS-Windows and MacOSX some of the XLib-isms are
On Sunday, January 23, 2022 at 6:38:24 AM UTC-5, Francois Vogel wrote:
Le 22/01/2022 à 23:37, Alwyn Teh a écrit :
I just installed the latest Ubuntu Desktop 21.10 and built Tcl.You probably need to install the libx11-dev package.
But Tk is not building on Ubuntu from the unix directory.
/home/alteh/dev/Tcl-Tk/tk8.6.12/unix/../generic/tk.h:99:13: fatal error: X11/Xlib.h: No such file or directory
99 | # include <X11/Xlib.h>
| ^~~~~~~~~~~~
compilation terminated.
Regards,
Francois
Don't the tk sources come with their own ./xlib/X11/Xlib.h ?
Maybe it is a matter of making sure that directory is in one of those "-I" (<--uppercase i) include paths?
"faked" in terms of MS-Windows or MacOSX GUI features. Under actual UNIX or >> Linux, Tk uses the Xlib.h provided by X11. A typical Linux distro separates >> the X11 runtime (shared) libraries from the X11 development stuff (header
file, link libraries, etc.). Commonly a normal Linux Desktop install just
installs the runtime. It is necessary to install the -dev (-devel under
RedHat-ish distros) packages if one plans on building tcl/tk from sources. >>
The OP *could* have just installed tcl and tk from the distro:
sudo apt install tcl tk
But I guess he wanted to build from source...
--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
[email protected] -- Webhosting Services
Hi I know this is an old post but I've been through every forum trying to fix this issue. I need tkinter for my ubuntu virtual machine, I've checked im in the correct python, installed all the packages including the one Robert suggested (though
Just:
lewie@lewie-virtual-machine:~/Downloads$ python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):import tkinter
tkinter._test()
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/tkinter/__init__.py", line 4586, in _test
root = Tk()
File "/usr/lib/python3.10/tkinter/__init__.py", line 2299, 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:
/usr/local/lib/tcl8.6/tk8.6 /usr/local/lib/tk8.6 /usr/lib/tk8.6 /usr/lib/tk8.6 /lib/tk8.6 /usr/library
This probably means that tk wasn't installed properly.
incidentally the /tk8.6/ dir only contains "pkgIndex.tcl"
in case that's what's wrong.
'/Users/chris/bin/anaconda3/lib/tcl8.6 /Users/chris/bin/anaconda3/lib'import tkinter
interp=tkinter.Tcl()
interp.eval("set auto_path")
'8.6.10'interp.eval("package require Tk")
'load /Users/chris/bin/anaconda3/lib/libtk8.6.dylib Tk'interp.eval("package ifneeded Tk 8.6.10")
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 152:53:57 |
| Calls: | 12,091 |
| Calls today: | 4 |
| Files: | 15,000 |
| Messages: | 6,517,662 |