DistributedProofreaders / guiguts

Perl/Tk text editor designed for editing and formatting public domain material for inclusion at Project Gutenberg
GNU General Public License v2.0
9 stars 10 forks source link

Ubuntu 22, default Perl, library setup #1291

Closed owenBeresford closed 9 months ago

owenBeresford commented 9 months ago

As ever with OSS, thanks for your work.

Describe the bug I think this is a DOCS bug. I haven't done any Perl development on this machine, but it is a dev machine. The Perl setup will be factory defaults. perl -v This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux-gnu-thread-multi (with 60 registered patches, see perl -V for more detail)

I was following "other install" notes in the github README.md.

Three small issues, but probably config derived a) the first install script bails perl src/install_cpan_modules.pl \n Failed trying to install File::HomeDir << no technical detail

b) File::HomeDir installs without effort via a cpan shell. So I manually try cpan install Tk which crashed out, as below The current configuration of allow_installing_outdated_dists is 'ask/no', but for this option we would need 'CPAN::DistnameInfo' installed. Please install 'CPAN::DistnameInfo' as soon as possible. As long as we are not equipped with 'CPAN::DistnameInfo' this option does not take effect Running make test for ASB/Tk-ToolBar-0.12.tar.gz PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/pod.t ... skipped: Test::Pod 1.14 required for testing POD t/test.t .. Can't locate Tk/Frame.pm in @INC (you may need to install the Tk::Frame module) (@INC contains: ~/.cpan/build/Tk-ToolBar-0.12-0/blib/lib ~/.cpan/build/Tk-ToolBar-0.12-0/blib/arch ~/perl5/lib/perl5/5.34.0/x86_64-linux-gnu-thread-multi ~/perl5/lib/perl5/5.34.0/x86_64-linux-gnu-thread-multi ~/perl5/lib/perl5/5.34.0 ~/perl5/lib/perl5/x86_64-linux-gnu-thread-multi ~/perl5/lib/perl5/5.34.0/x86_64-linux-gnu-thread-multi ~/perl5/lib/perl5/5.34.0 ~/perl5/lib/perl5/x86_64-linux-gnu-thread-multi ~/perl5/lib/perl5 ~/perl5/lib/perl5/5.34.0/x86_64-linux-gnu-thread-multi ~/perl5/lib/perl5/5.34.0 ~/perl5/lib/perl5/x86_64-linux-gnu-thread-multi ~/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.34.0 /usr/local/share/perl/5.34.0 /usr/lib/x86_64-linux-gnu/perl5/5.34 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.34 /usr/share/perl/5.34 /usr/local/lib/site_perl .) at ~/.cpan/build/Tk-ToolBar-0.12-0/blib/lib/Tk/ToolBar.pm line 5. BEGIN failed--compilation aborted at ~/.cpan/build/Tk-ToolBar-0.12-0/blib/lib/Tk/ToolBar.pm line 5. Compilation failed in require at t/test.t line 10. BEGIN failed--compilation aborted at t/test.t line 10. t/test.t .. Dubious, test returned 2 (wstat 512, 0x200) Failed 1/1 subtests (I edited the text to hide my userdir location)

c) So I sudo apt install perl-tk , then the pathing doesn't work with guiguts

The source includes a list of dir, with "/usr/lib/x86_64-linux-gnu/perl/5.34/" My local install, adding Perl via aptput Tk in "/usr/lib/x86_64-linux-gnu/perl5/5.34/" Maybe this final point shouldn't be copied, but I made @INC include that directory version.

To Reproduce Please repeat steps above.

As soon as I have all the libraries installed, and patched the @INC the editor works fine.

Expected behaviour Either cpan to work via your script, or cpan to work via the cpan subshell. I am raising this on this project, as I do not know target version numbers in cpan, In other languages, I would try again with blah@latest version lock

Environment

Screenshots I included relevant console output in fault desc above, as text

Additional context UID = EUID = 1000, but this shouldn't make any difference.

cat test.pl use warnings; use Tk; print( "Tk version ", Tk->VERSION, "\n"); outputs Tk version 804.035

Is this version acceptable to the editor?

cpeel commented 9 months ago

Thanks for reporting this. Let me get a Ubuntu docker image spun up later today / tomorrow and I'll figure out what's wrong and update the docs / scripts.

owenBeresford commented 9 months ago

Apologies to github user @inc, but he must get spam on every Perl issue

owenBeresford commented 9 months ago

possibly the best fix:: is add some optional installs before the TK install so the TK installer thinks it has more options?

I set the cpan to the "local" option, which I needed to set at the start of the install process

cpeel commented 9 months ago

Here's what I've found so far. I have some questions about how we should approach the docs and then will open a PR.

src/install_cpan_modules.pl requires cpanm not cpan (the former is much friendlier for scripted installs IMHO). The script should be updated to fail with a clear message when that's not found.

If you install perl-tk you have to comment out installing the "Tk" package or it tries to downloaded a more recent version than what's in the Ubuntu package.

If we want to build Perk::Tk we need the libx11-dev package (and gcc obvs).

So that boils down to:

# Building latest Perl::Tk from source with current install_cpan_modules.pl:
apt install cpanminus libx11-dev gcc
perl src/install_cpan_modules.pl

or

# Using Ubuntu perl-tk package
apt install cpanminus gcc perl-tk
# Manually remove "Tk" package in install_cpan_modules.pl
perl src/install_cpan_modules.pl

Note that gcc is required for Text::LevenshteinXS even if we use the perl-tk package.

So as a Linux GG user, would you prefer to be using the latest Perk::Tk or the Ubuntu version? That will influence how I update the docs (although I will mention the other path).

owenBeresford commented 9 months ago

I ran this on a second machine, again not used for Perl I setup cpan again, but also upgraded cpan first

EDITED TEXT

User steps which work on machine 2: setup cpan , via cpan, choose local mode $ cpan install cpan try install script, fails same as last time $ perl src/install_cpan_modules.pl try below steps without root, they all error about man pages, so repeat as root $ sudo cpan install Roman LWP::UserAgent Image::Size File::Which Text::LevenshteinXS $ sudo cpan install Tk $ sudo cpan install Tk::ToolBar $ sudo cpan install File::HomeDir $ perl src/guiguts.pl works, but direct invocation doesn't due to line-endings, so $ vim -c "set ff=unix | wq" src/guiguts.pl added launcher bash script to /usr/bin so can be launched more easily

owenBeresford commented 9 months ago

The first machine I used, has gcc 11 installed

cpeel commented 9 months ago

I ran this on a second machine, again not used for Perl

Can you provide more details on what you did the second time? I'm unclear what you're doing with cpan as none of our instructions use it directly. When I tested this earlier on a docker image I didn't do anything at with cpan, just cpanm. I was running everything as root in the docker container -- which isn't great, admittedly. IIRC there's a way to install perl packages in a user-space that I should look into.

Also thing saying "works best if installed as root"

What thing specifically reported this?

cpeel commented 9 months ago

Ah yes, local::lib. I'll play with this and present some instructions for installing as non-root too.

owenBeresford commented 9 months ago

Detail added to previous comment, with notes in better english.

cpeel commented 9 months ago

Thanks for that update. I've done more testing within an Ubuntu docker container and have updated the docs in https://github.com/DistributedProofreaders/guiguts/pull/1292 -- feedback welcome!

owenBeresford commented 9 months ago

Your solution is better annotated than this issue. I would follow it in future.
I have never programmed with Tk, so have no opinion on the version, aside from "stable pls".

cpeel commented 9 months ago

@owenBeresford, sounds good. Really appreciate you raising the issue and finding a workable solution. Feels like we're in a much better place to help Linux users in the future!