Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#56825 closed defect (fixed)

p5-tcl-tk: Your Tcl installation fails to find Tk package

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: chrstphrchvz (Christopher Chavez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: p5-tcl-tk

Description

https://build.macports.org/builders/ports-10.6_x86_64_legacy-builder/builds/70522/steps/install-port/logs/stdio

Your Tcl installation (/opt/local/bin/tclsh) fails to find Tk package.
One of possible reasons is missing file 'pkgIndex.tcl' in ..../tk8.4/
directory; Please check if you can feed 'package require Tk' to tclsh

Change History (4)

comment:1 Changed 6 years ago by chrstphrchvz (Christopher Chavez)

I was actually expecting this error, because a similar one occurred when I was making the p5-tcl-ptk port. Somehow I was able to install p5-tcl-tk yesterday without error; now after uninstalling and cleaning, I get this error.

I don't know what exactly is causing the error. There's a test in Makefile.PL that checks for Tcl/Tk and certain Tk extensions by running tclsh with a script test-for-tk.tcl, but for some reason, Perl never gets any output from tclsh when run from MacPorts, whereas I can run Makefile.PL manually and it will work.

The workaround I ended up using for p5-tcl-ptk was removing the test with a patch to Makefile.PL, and instead trusting MacPorts to properly install Tcl/Tk and tklib (cf. https://github.com/macports/macports-ports/pull/2036). I will probably apply the same workaround here if I can't figure out why there's no output from tclsh to Perl when MacPorts runs Makefile.PL.

Last edited 6 years ago by chrstphrchvz (Christopher Chavez) (previous) (diff)

comment:2 Changed 6 years ago by chrstphrchvz (Christopher Chavez)

In f8d4b689135afb8a290c927bcc6e9a2160154b6b/macports-ports (master):

p5-tcl-tk: remove test-for-tk in Makefile.PL

uses same workaround as p5-tcl-ptk
cf. #56825

remove extra trailing newlines

comment:3 in reply to:  1 ; Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

Replying to chrstphrchvz:

I don't know what exactly is causing the error. There's a test in Makefile.PL that checks for Tcl/Tk and certain Tk extensions by running tclsh with a script test-for-tk.tcl, but for some reason, Perl never gets any output from tclsh when run from MacPorts, whereas I can run Makefile.PL manually and it will work.

MacPorts runs as the macports user. This user does not have permission to access the X server, which is apparently what test-for-tk.tcl does by attempting to include the Tk package:

$ sudo -u macports /opt/local/bin/tclsh
% package require Tk
couldn't connect to display "/private/tmp/com.apple.launchd.CYqUDJ8ts9/org.macports:0"
%

comment:4 in reply to:  3 Changed 6 years ago by chrstphrchvz (Christopher Chavez)

Replying to ryandesign:

MacPorts runs as the macports user. This user does not have permission to access the X server, which is apparently what test-for-tk.tcl does by attempting to include the Tk package:

That explains why this test won't work if the tk +x11 variant is active, but if the tk +quartz variant is used instead, the same sudo -u macports /opt/local/bin/tclsh command works, so I don't think the fact the macports user is used explains the whole story. Even sudo -u macports perl -e "print qx(/opt/local/bin/tclsh test-for-tk.tcl)" seems to work as long as the tk +quartz variant is active.

Note: See TracTickets for help on using tickets.