Perl/Tk

Bruno Voisin bvoisin at icloud.com
Tue Jun 8 17:11:05 CEST 2021


Motivated by Siep Kroonenberg's remark in the "Texdoctk Maintainer" thread at <https://tug.org/pipermail/tex-live/2021-June/047049.html>

> Also, Perl/Tk is not readily available for MacOS or Windows.

I had a go at compiling Perl/Tk on macOS (Big Sur, 11.x). By this I mean using only the built-in Perl and XQuartz, not using a package management system like Homebrew, MacPorts or Fink.

Up to two or three versions of macOS ago, the straightforward "perl Makefile.PL && make && sudo make install" just worked. Now, no more.

The problem is the way Perl is installed in recent versions of macOS:

- Runtime Perl is at /System/Library/Perl (a non-writable location, protected by System Integrity Protection).

- Local additions go to /Library/Perl.

Neither location includes headers. These are installed with the optional developer tools, which come in two flavours:

- The command-line tools package installs Perl at

	/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl

- The full Xcode IDE installs Perl at

	/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl

Given that, here's how to compile Perl/Tk 804.036 from <https://metacpan.org/dist/Tk> with the full Xcode IDE installed. Useful tips came from

https://stackoverflow.com/questions/63403427/problem-installing-tk-module-perl-in-macos-catalina
https://stackoverflow.com/questions/52682304/fatal-error-extern-h-file-not-found-while-installing-perl-modules

First, once inside the Tk-804.036 directory, edit lines 3-5 of myConfig

	my $path = "$Config{'archlibexp'}/CORE/perl.h";
	die "Cannot find '$path' have you installed $^X?\n" unless (-r $path);
	print "$^X is installed in $Config{'archlibexp'} okay\n";

to reflect the actual location of the headers, here

	my $path = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE/perl.h";
	die "Cannot find '$path' have you installed $^X?\n" unless (-r $path);
	print "$^X is installed in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level okay\n";

Second, in Terminal, run

	export CPATH="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE"

After that, the usual

	perl Makefile.PL
	make
	sudo make install

just works.

There are probably better ways to proceed, constructing the location of the Perl headers with something like $(PERL_SYSROOT)$(PERL_INCDEP)$(DFSEP), but the above seems to work.

Attached are two screenshots of what tlmgr --gui and texdoctk look like on the Mac after that.

Bruno Voisin



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-live/attachments/20210608/76c20509/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlmgr-macos.png
Type: image/png
Size: 289800 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-live/attachments/20210608/76c20509/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: texdoctk-macos.png
Type: image/png
Size: 185342 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-live/attachments/20210608/76c20509/attachment-0003.png>


More information about the tex-live mailing list.