Subject: | Cannot run Tk program, no X11 connection |
A trivial Tk program does not run with PAR on my system (FreeBSD 6.2,
recent X server, perl 5.8.8). The script is the following:
#!/usr/bin/perl -w
use Tk;
$top = new MainWindow;
MainLoop;
__END__
I package the script with
pp -o tk tk.pl
Running "tk" gives the following error:
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
couldn't connect to display ":0.0" at Tk/MainWindow.pm line 55.
MainWindow->new() at script/tk.pl line 3
Exitcode 255
tk.pl runs OK. If I run both through truss, then I see that tk.pl loads
the ~/.Xauthority file while the packaged tk skips this section.
This is the trace of the "good" one:
connect(4,{ AF_UNIX "/tmp/.X11-unix/X0" },19) = 0 (0x0)
__sysctl(0x7fffffffd868,0x2,0x7fffffffd8a0,0x7fffffffd860,0x0,0x0) = 0 (0x0)
fcntl(4,F_SETFD,FD_CLOEXEC) = 0 (0x0)
access("/home/e/eserte/.Xauthority",4) = 0 (0x0)
open("/home/e/eserte/.Xauthority",O_RDONLY,0666) = 5 (0x5)
fstat(5,{mode=-rw------- ,inode=16638851,size=757,blksize=4096}) = 0 (0x0)
read(5,"\^A\0\0\^Qbiokovo.herceg.de\0\^B"...,4096) = 757 (0x2f5)
read(5,0x53b000,4096) = 0 (0x0)
close(5) = 0 (0x0)
break(0x8c2000) = 0 (0x0)
mmap(0x0,12288,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,4294967295,0x7fff000000
00) = 34365214720 (0x800539000)
munmap(0x80052f000,4096) = 0 (0x0)
writev(0x4,0x7fffffffdb50,0x4) = 48 (0x30)
fcntl(4,F_GETFL,) = 2 (0x2)
fcntl(4,F_SETFL,O_NONBLOCK|0x2) = 0 (0x0)
And this is the trace of the "bad" one:
connect(6,{ AF_UNIX "/tmp/.X11-unix/X0" },19) = 0 (0x0)
__sysctl(0x7fffffffd218,0x2,0x7fffffffd250,0x7fffffffd210,0x0,0x0) = 0 (0x0)
fcntl(6,F_SETFD,FD_CLOEXEC) = 0 (0x0)
writev(0x6,0x7fffffffd500,0x1) = 12 (0xc)
fcntl(6,F_GETFL,) = 2 (0x2)
fcntl(6,F_SETFL,O_NONBLOCK|0x2) = 0 (0x0)
Regards,
Slaven