Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 22, default Perl, library setup #1291

Closed
owenBeresford opened this issue Jan 29, 2024 · 12 comments
Closed

Ubuntu 22, default Perl, library setup #1291

owenBeresford opened this issue Jan 29, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@owenBeresford
Copy link

owenBeresford commented Jan 29, 2024

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

  • Guiguts version: project main branch in github
  •               git commit 6e8071338554ae394daa937c662bc286148d0933
    
  • OS and version: ubuntu "14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2"
  • Perl version: perl 5, version 34, subversion 0 (v5.34.0)
  • Perl distribution: ubuntu default

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?

@owenBeresford owenBeresford added the bug Something isn't working label Jan 29, 2024
@cpeel cpeel self-assigned this Jan 29, 2024
@cpeel
Copy link
Member

cpeel commented Jan 29, 2024

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
Copy link
Author

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

@owenBeresford
Copy link
Author

owenBeresford commented Jan 29, 2024

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
Copy link
Member

cpeel commented Jan 29, 2024

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
Copy link
Author

owenBeresford commented Jan 30, 2024

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
Copy link
Author

The first machine I used, has gcc 11 installed

@cpeel
Copy link
Member

cpeel commented Jan 30, 2024

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
Copy link
Member

cpeel commented Jan 30, 2024

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

@owenBeresford
Copy link
Author

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

@cpeel
Copy link
Member

cpeel commented Jan 30, 2024

Thanks for that update. I've done more testing within an Ubuntu docker container and have updated the docs in #1292 -- feedback welcome!

@owenBeresford
Copy link
Author

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
Copy link
Member

cpeel commented Jan 30, 2024

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants