Perl-LanguageServer icon indicating copy to clipboard operation
Perl-LanguageServer copied to clipboard

InstallingPerl::Language Server on Windows 10/WSL has issues

Open dseynhae opened this issue 4 years ago • 11 comments

When installing, at first I get an error:

$ cpanm Perl::LanguageServer
--> Working on Perl::LanguageServer
Fetching http://www.cpan.org/authors/id/G/GR/GRICHTER/Perl-LanguageServer-2.1.0.tar.gz ... OK
Configuring Perl-LanguageServer-v2.1.0 ... OK
Building and testing Perl-LanguageServer-v2.1.0 ... FAIL
! Installing Perl::LanguageServer failed. See /mnt/h/dseynhae/.cpanm/work/1597718673.12417/build.log for details. Retry
with --force to force install it.

Looking at the log file, there is a problem with testing:

cpanm (App::cpanminus) 1.7044 on perl 5.026001 built for x86_64-linux-gnu-thread-multi
Work directory is /mnt/h/dseynhae/.cpanm/work/1597718673.12417
You have make /usr/bin/make
You have LWP 6.31
You have /bin/tar: tar (GNU tar) 1.29
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
Searching Perl::LanguageServer () on cpanmetadb ...
--> Working on Perl::LanguageServer
Fetching http://www.cpan.org/authors/id/G/GR/GRICHTER/Perl-LanguageServer-2.1.0.tar.gz
-> OK
Unpacking Perl-LanguageServer-2.1.0.tar.gz
Entering Perl-LanguageServer-2.1.0
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.44)
Configuring Perl-LanguageServer-v2.1.0
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Perl::LanguageServer
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Scalar::Util 0 ... Yes (1.46_02)
Checking if you have Test::More 0 ... Yes (1.302174)
Checking if you have AnyEvent 0 ... Yes (7.17)
Checking if you have PadWalker 0 ... Yes (2.3)
Checking if you have AnyEvent::AIO 0 ... Yes (1.1)
Checking if you have Data::Dump 0 ... Yes (1.23)
Checking if you have Compiler::Lexer 0.23 ... Yes (0.23)
Checking if you have JSON 0 ... Yes (4.02)
Checking if you have Coro 0 ... Yes (6.55)
Checking if you have IO::AIO 0 ... Yes (4.72)
Checking if you have Class::Refresh 0 ... Yes (0.07)
Checking if you have Moose 0 ... Yes (2.2012)
Building and testing Perl-LanguageServer-v2.1.0
cp lib/Perl/LanguageServer/Workspace.pm blib/lib/Perl/LanguageServer/Workspace.pm
cp lib/Perl/LanguageServer/IO.pm blib/lib/Perl/LanguageServer/IO.pm
cp lib/Perl/LanguageServer/Methods/DebugAdapterInterface.pm blib/lib/Perl/LanguageServer/Methods/DebugAdapterInterface.pm
cp lib/Perl/LanguageServer/Methods/workspace.pm blib/lib/Perl/LanguageServer/Methods/workspace.pm
cp lib/Perl/LanguageServer/DevTool.pm blib/lib/Perl/LanguageServer/DevTool.pm
cp lib/Perl/LanguageServer/Methods/DebugAdapter.pm blib/lib/Perl/LanguageServer/Methods/DebugAdapter.pm
cp lib/Perl/LanguageServer/Req.pm blib/lib/Perl/LanguageServer/Req.pm
cp lib/Perl/LanguageServer/DebuggerProcess.pm blib/lib/Perl/LanguageServer/DebuggerProcess.pm
cp lib/Perl/LanguageServer/Parser.pm blib/lib/Perl/LanguageServer/Parser.pm
cp lib/Perl/LanguageServer/SyntaxChecker.pm blib/lib/Perl/LanguageServer/SyntaxChecker.pm
cp lib/Perl/LanguageServer/DebuggerInterface.pm blib/lib/Perl/LanguageServer/DebuggerInterface.pm
cp lib/Perl/LanguageServer.pm blib/lib/Perl/LanguageServer.pm
cp lib/Perl/LanguageServer/Methods.pm blib/lib/Perl/LanguageServer/Methods.pm
cp lib/Perl/LanguageServer/Methods/textDocument.pm blib/lib/Perl/LanguageServer/Methods/textDocument.pm
Manifying 2 pod documents
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
Bailout called.  Further testing stopped:  

#   Failed test 'use Perl::LanguageServer;'
#   at t/00-load.t line 10.
#     Tried to use 'Perl::LanguageServer'.
#     Error:  Can't locate MRO/Compat.pm in @INC (you may need to install the MRO::Compat module) (@INC contains: /mnt/h/dseynhae/.cpanm/work/1597718673.12417/Perl-LanguageServer-2.1.0/blib/lib /mnt/h/dseynhae/.cpanm/work/1597718673.12417/Perl-LanguageServer-2.1.0/blib/arch /mnt/h/dseynhae/perl5/lib/perl5/5.26.1/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/5.26.1/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/5.26.1 /mnt/h/dseynhae/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/5.26.1/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/5.26.1 /mnt/h/dseynhae/perl5/lib/perl5/5.26.0 /mnt/h/dseynhae/perl5/lib/perl5/5.26.0/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5 /mnt/h/dseynhae/perl5/lib/perl5/5.26.0/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/5.26.0 /mnt/h/dseynhae/perl5/lib/perl5/5.26.0/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/5.26.1/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/5.26.1 /mnt/h/dseynhae/perl5/lib/perl5/5.26.0 /mnt/h/dseynhae/perl5/lib/perl5/5.26.0/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /mnt/h/dseynhae/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Class/MOP.pm line 9.
# BEGIN failed--compilation aborted at /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Class/MOP.pm line 9.
# Compilation failed in require at /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Moose/Exporter.pm line 8.
# BEGIN failed--compilation aborted at /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Moose/Exporter.pm line 8.
# Compilation failed in require at /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Moose.pm line 15.
# BEGIN failed--compilation aborted at /usr/local/lib/x86_64-linux-gnu/perl/5.26.1/Moose.pm line 15.
# Compilation failed in require at /mnt/h/dseynhae/.cpanm/work/1597718673.12417/Perl-LanguageServer-2.1.0/blib/lib/Perl/LanguageServer.pm line 6.
# BEGIN failed--compilation aborted at /mnt/h/dseynhae/.cpanm/work/1597718673.12417/Perl-LanguageServer-2.1.0/blib/lib/Perl/LanguageServer.pm line 6.
# Compilation failed in require at t/00-load.t line 10.
# BEGIN failed--compilation aborted at t/00-load.t line 10.
Use of uninitialized value $Perl::LanguageServer::VERSION in concatenation (.) or string at t/00-load.t line 13.
# Testing Perl::LanguageServer , Perl 5.026001, /usr/bin/perl
# Looks like you failed 1 test of 1.
FAILED--Further testing stopped.
Makefile:884: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 1
-> FAIL Installing Perl::LanguageServer failed. See /mnt/h/dseynhae/.cpanm/work/1597718673.12417/build.log for details. Retry with --force to force install it.

I can actually install "Successfully", by skipping the testing:

cpanm -n Perl::LanguageServer

However, when using the Perl Extension in VS Code, the first few attempts will fail for not finding modules:

Can't locate MRO/Compat.pm in @INC (you may need to install the MRO::Compat module)

The Perl::LanguageServer starts working as expected, AFTER installing:

cpanm MRO::Compat
cpanm Devel::GlobalDestruction
cpanm Sub::Exporter

But if that is the case, shouldn't those modules be listed as dependencies for Perl::LanguageServer?

dseynhae avatar Aug 18 '20 02:08 dseynhae

I just noticed the note in VS Code extension that "this" isn't supported on Windows. Since the Outline/Code Completion/... seems to work just fine, I assume that "this" is the debugger?

Indeed, when I launch the debugger, I get:

LS: apply_all_roles (Moose::Meta::Class::__ANON__::SERIAL::2=HASH(0x7fffcbcfa798), Perl::LanguageServer::Methods::textDocument, Perl/LanguageServer/Methods/textDocument.pm)
state_dir = /mnt/h/dseynhae/_PERL/corelist/.vscode/perl-lang
initial parsing done, loaded  files, parsed 1 files, 1 files
LS: ERROR: Unknow perlmethod _rpcnot_setTraceNotification at /mnt/h/dseynhae/perl5/lib/perl5/Perl/LanguageServer.pm line 217.

dseynhae avatar Aug 18 '20 03:08 dseynhae

The missing modules are not required by the LanguageServer itself. So it's any module that the LanguageServer require that has incorrect dependencies that needs to be fixed.

Basicly LanguageServers run on Windows, but because of issues with Perl and reading stdin in a non blocking way and capturing the output of perl -c in a non blocking way, you might get high CPU load and sometimes the LanguageServer seems to get stuck and will continue after you have made same changes. Because of this basic issues I gave up after spending a lot of time trying to get it working on windows.

richterger avatar Aug 29 '20 20:08 richterger

Thanks, I'll try to figure out which module has the missing dependencies...

dseynhae avatar Aug 30 '20 22:08 dseynhae

@beltaurus : I haven't played with this module, but give it a try on WSL 2 on Windows, since that's using a virtualized Linux kernel (rather than translating Linux syscalls to Windows syscalls).

As far as I know, trying to get event-driven (non-blocking) code to work on Linux and Windows is a nightmare.

minusdavid avatar Aug 30 '20 23:08 minusdavid

I picked this up where I left off, updating and upgrading my Ubuntu 18.04 LTS WSL distro, and all my the Perl related CPAN modules in my local::lib (Perl::LanguageServer, Perl::Critic, Perl::Tidy,...). I still have to manually take care of

cpanm --reinstall MRO::Compat
cpanm --reinstall Devel::GlobalDestruction
cpanm --reinstall Sub::Exporter

...UNLESS I execute the Perl::LanguageServer installation with the --notest option!

I made sure I had the latest version of VS Code, and I uninstalled the Perl Debug extension (I don't want any interference with my debugging sessions). Then I uninstalled and reinstalled the Perl extension.

As long as I don't use multiple workspaces (I'm working in a single folder), I seem to get "decent" behavior from the "Perl::LanguageServer". My only problem noted so far, is that the debugger output appends a "\n" to my print statements (and the point of my print statements is that there shouldn't be one, until I specify it...

All in all, I'm back to a useable experience, but I think for other users, we should document:

  1. Install with --notest (or be prepared to add missing modules, depending on your distro).
  2. Make sure you don't have interference for the Perl debugging sessions.
  3. There might be issues with print output.

dseynhae avatar Sep 29 '20 12:09 dseynhae

@beltaurus I have also a similar problem to install LanguageServer on Win 10.

Can you please check my issue #52 maybe?

ramogundogdu avatar Oct 01 '20 08:10 ramogundogdu

I just noticed the note in VS Code extension that "this" isn't supported on Windows. Since the Outline/Code Completion/... seems to work just fine, I assume that "this" is the debugger?

Indeed, when I launch the debugger, I get:

LS: apply_all_roles (Moose::Meta::Class::__ANON__::SERIAL::2=HASH(0x7fffcbcfa798), Perl::LanguageServer::Methods::textDocument, Perl/LanguageServer/Methods/textDocument.pm)
state_dir = /mnt/h/dseynhae/_PERL/corelist/.vscode/perl-lang
initial parsing done, loaded  files, parsed 1 files, 1 files
LS: ERROR: Unknow perlmethod _rpcnot_setTraceNotification at /mnt/h/dseynhae/perl5/lib/perl5/Perl/LanguageServer.pm line 217.

I am seeing this same error on Linux, yet i have the three mentioned missing modules installed already. Anyone know how to fix it?

djzort avatar Jan 06 '21 06:01 djzort

One of the LanguageServer dependency IO::AIO installation is failing on Win10 with multiple error similar to the following.

AIO.xs: In function 'XS_IO__AIO_pidfd_send_signal': AIO.xs:2678:2: error: unknown type name 'siginfo_t'; did you mean 'eio_ino_t'? siginfo_t si = { 0 }; ^~~~~~~~~

Can someone help?

iamitka avatar Apr 19 '21 16:04 iamitka

One of the LanguageServer dependency IO::AIO installation is failing on Win10 with multiple error similar to the following.

On Windows 10 WSL2, Ubuntu-20.04.

sudo cpanm Perl::LanguageServer failed on IO:AIO. perl Makefile.PL failed with error /usr/bin/ld: cannot find -lperl.

The following command fixed the issue and Perl-LanguageServer extension works great.

sudo ln -s /usr/lib/x86_64-linux-gnu/libperl.so.5.30 /usr/lib/x86_64-linux-gnu/libperl.so

I hope this helps.

hirooih avatar Apr 30 '21 08:04 hirooih

One of the LanguageServer dependency IO::AIO installation is failing on Win10 with multiple error similar to the following.

On Windows 10 WSL2, Ubuntu-20.04.

sudo cpanm Perl::LanguageServer failed on IO:AIO. perl Makefile.PL failed with error /usr/bin/ld: cannot find -lperl.

The following command fixed the issue and Perl-LanguageServer extension works great.

sudo ln -s /usr/lib/x86_64-linux-gnu/libperl.so.5.30 /usr/lib/x86_64-linux-gnu/libperl.so

I hope this helps.

for windows, what is solution to fix issue for IO::AIO?

sarath143 avatar May 10 '21 15:05 sarath143

One of the LanguageServer dependency IO::AIO installation is failing on Win10 with multiple error similar to the following.

On Windows 10 WSL2, Ubuntu-20.04. sudo cpanm Perl::LanguageServer failed on IO:AIO. perl Makefile.PL failed with error /usr/bin/ld: cannot find -lperl. The following command fixed the issue and Perl-LanguageServer extension works great. sudo ln -s /usr/lib/x86_64-linux-gnu/libperl.so.5.30 /usr/lib/x86_64-linux-gnu/libperl.so I hope this helps.

for windows, what is solution to fix issue for IO::AIO?

Following worked for me on Windows 10 WSL2 U20.04 LTS

sudo apt install libanyevent-perl libio-aio-perl Then cpanm Perl::LanguageServer worked without any errors. And the language server works like a charm.

nkobsr avatar May 12 '21 14:05 nkobsr

I just installed Perl::LanguageServer 2.4.0 without any issues on WSL1 (Ubuntu 20.04).

Trying to install it on Ubuntu 18.04 fails, but that is because I don't have a recent enough g++ compiler on that system... The default version 7.5 doesn't understand the -V option required by the Perl Module build instructions... And for some reason, the Perl build instructions ignore my update-alternatives. Since we're just a few months away from Ubuntu 18.04 deprecation, I'm not going to worry about it.

And I consider the initial problem I flagged fixed...

dseynhae avatar Dec 14 '22 23:12 dseynhae