nim-lang / langserver

The Nim language server implementation (based on nimsuggest)
204 stars 31 forks source link

Error: could not load: libpcre.so(.3|.1|) #207

Closed Alogani closed 1 month ago

Alogani commented 5 months ago

Hello,

The nimlangserver crash with the following error, altough pcre is installed on my distribution. I'm trying to use the last version of https://github.com/nim-lang/vscode-nim

[Error - 12:59:32] Server process exited with code 1.
[Error - 12:59:32] Client Nim Language Server: connection to server is erroring.
Cannot call write after a stream was destroyed
[Error - 12:59:32] Server initialization failed.
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 12:59:32] Nim Language Server client: couldn't create connection to server.
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Info  - 12:59:32] Connection to server got closed. Server will restart.
true
could not load: libpcre.so(.3|.1|)
(compile with -d:nimDebugDlOpen for more information)
[Error - 12:59:32] Client Nim Language Server: connection to server is erroring.
write EPIPE
Shutting down server.
[Error - 12:59:32] Client Nim Language Server: connection to server is erroring.
write EPIPE
[Error - 12:59:32] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: starting
    at LanguageClient.shutdown (/home/Alogani/.var/app/com.vscodium.codium/data/codium/extensions/nimlang.nimlang-0.9.0/node_modules/vscode-languageclient/lib/common/client.js:964:19)
    at LanguageClient.stop (/home/Alogani/.var/app/com.vscodium.codium/data/codium/extensions/nimlang.nimlang-0.9.0/node_modules/vscode-languageclient/lib/common/client.js:935:21)
    at LanguageClient.stop (/home/Alogani/.var/app/com.vscodium.codium/data/codium/extensions/nimlang.nimlang-0.9.0/node_modules/vscode-languageclient/lib/node/main.js:150:22)
    at LanguageClient.handleConnectionError (/home/Alogani/.var/app/com.vscodium.codium/data/codium/extensions/nimlang.nimlang-0.9.0/node_modules/vscode-languageclient/lib/common/client.js:1196:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Error - 12:59:32] Server initialization failed.
  Message: write EPIPE
  Code: -32099 
[Error - 12:59:32] Nim Language Server client: couldn't create connection to server.
  Message: write EPIPE
  Code: -32099 
[Error - 12:59:32] Restarting server failed
  Message: write EPIPE
  Code: -32099 
[Info  - 12:59:32] Connection to server got closed. Server will restart.
true
could not load: libpcre.so(.3|.1|)
(compile with -d:nimDebugDlOpen for more information)
[Error - 12:59:32] Server process exited with code 1.
[Error - 12:59:32] Server process exited with code 1.
[Error - 12:59:32] Client Nim Language Server: connection to server is erroring.
Cannot call write after a stream was destroyed
[Error - 12:59:32] Server initialization failed.
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 12:59:32] Nim Language Server client: couldn't create connection to server.
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 12:59:32] Restarting server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Info  - 12:59:32] Connection to server got closed. Server will restart.
true
could not load: libpcre.so(.3|.1|)
(compile with -d:nimDebugDlOpen for more information)
[Error - 12:59:32] Client Nim Language Server: connection to server is erroring.
write EPIPE
Shutting down server.
[Error - 12:59:32] Client Nim Language Server: connection to server is erroring.
write EPIPE
[Error - 12:59:32] Stopping server failed
Error: Client is not running and can't be stopped. It's current state is: starting
    at LanguageClient.shutdown (/home/Alogani/.var/app/com.vscodium.codium/data/codium/extensions/nimlang.nimlang-0.9.0/node_modules/vscode-languageclient/lib/common/client.js:964:19)
    at LanguageClient.stop (/home/Alogani/.var/app/com.vscodium.codium/data/codium/extensions/nimlang.nimlang-0.9.0/node_modules/vscode-languageclient/lib/common/client.js:935:21)
    at LanguageClient.stop (/home/Alogani/.var/app/com.vscodium.codium/data/codium/extensions/nimlang.nimlang-0.9.0/node_modules/vscode-languageclient/lib/node/main.js:150:22)
    at LanguageClient.handleConnectionError (/home/Alogani/.var/app/com.vscodium.codium/data/codium/extensions/nimlang.nimlang-0.9.0/node_modules/vscode-languageclient/lib/common/client.js:1196:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Error - 12:59:32] Server initialization failed.
  Message: write EPIPE
  Code: -32099 
[Error - 12:59:32] Nim Language Server client: couldn't create connection to server.
  Message: write EPIPE
  Code: -32099 
[Error - 12:59:32] Restarting server failed
  Message: write EPIPE
  Code: -32099 
[Info  - 12:59:32] Connection to server got closed. Server will restart.
true
could not load: libpcre.so(.3|.1|)
(compile with -d:nimDebugDlOpen for more information)
[Error - 12:59:32] Server process exited with code 1.
[Error - 12:59:32] Server process exited with code 1.
[Error - 12:59:32] Client Nim Language Server: connection to server is erroring.
Cannot call write after a stream was destroyed
[Error - 12:59:32] Server initialization failed.
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 12:59:32] Nim Language Server client: couldn't create connection to server.
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 12:59:32] Restarting server failed
  Message: Cannot call write after a stream was destroyed
  Code: -32099 
[Error - 12:59:32] The Nim Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
could not load: libpcre.so(.3|.1|)
(compile with -d:nimDebugDlOpen for more information)

Installed

root@fedora:~# dnf list installed "pcre*"
Paquets installés
pcre.x86_64                                                                                                           8.45-1.fc40.6                                                                                                    @fedora
pcre-cpp.x86_64                                                                                                       8.45-1.fc40.6                                                                                                    @fedora
pcre-devel.x86_64                                                                                                     8.45-1.fc40.6                                                                                                    @fedora
pcre-static.x86_64                                                                                                    8.45-1.fc40.6                                                                                                    @fedora
pcre-utf16.x86_64                                                                                                     8.45-1.fc40.6                                                                                                    @fedora
pcre-utf32.x86_64                                                                                                     8.45-1.fc40.6                                                                                                    @fedora
pcre2.i686                                                                                                            10.42-2.fc40.2                                                                                                   @fedora
pcre2.x86_64                                                                                                          10.42-2.fc40.2                                                                                                   @fedora
pcre2-devel.x86_64                                                                                                    10.42-2.fc40.2                                                                                                   @fedora
pcre2-syntax.noarch                                                                                                   10.42-2.fc40.2                                                                                                   @fedora
pcre2-utf16.x86_64                                                                                                    10.42-2.fc40.2                                                                                                   @fedora
pcre2-utf32.x86_64                                                                                                    10.42-2.fc40.2                                                                                                   @fedora

Fedora version

Linux fedora 6.8.11-300.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 27 14:53:33 UTC 2024 x86_64 GNU/Linux

Nimserver version

nimlangserver -v
1.2.0

Pcre location

ldconfig -p | grep pcre
    libpcre32.so.0 (libc6,x86-64) => /lib64/libpcre32.so.0
    libpcre32.so (libc6,x86-64) => /lib64/libpcre32.so
    libpcre16.so.0 (libc6,x86-64) => /lib64/libpcre16.so.0
    libpcre16.so (libc6,x86-64) => /lib64/libpcre16.so
    libpcre2-32.so.0 (libc6,x86-64) => /lib64/libpcre2-32.so.0
    libpcre2-32.so (libc6,x86-64) => /lib64/libpcre2-32.so
    libpcre2-16.so.0 (libc6,x86-64) => /lib64/libpcre2-16.so.0
    libpcre2-16.so (libc6,x86-64) => /lib64/libpcre2-16.so
    libpcre2-8.so.0 (libc6,x86-64) => /lib64/libpcre2-8.so.0
    libpcre2-8.so.0 (libc6) => /lib/libpcre2-8.so.0
    libpcre2-8.so (libc6,x86-64) => /lib64/libpcre2-8.so
    libpcre2-posix.so.3 (libc6,x86-64) => /lib64/libpcre2-posix.so.3
    libpcre2-posix.so.3 (libc6) => /lib/libpcre2-posix.so.3
    libpcre2-posix.so (libc6,x86-64) => /lib64/libpcre2-posix.so
    libpcreposix.so.0 (libc6,x86-64) => /lib64/libpcreposix.so.0
    libpcreposix.so (libc6,x86-64) => /lib64/libpcreposix.so
    libpcrecpp.so.0 (libc6,x86-64) => /lib64/libpcrecpp.so.0
    libpcrecpp.so (libc6,x86-64) => /lib64/libpcrecpp.so
    libpcre.so.1 (libc6,x86-64) => /lib64/libpcre.so.1
    libpcre.so (libc6,x86-64) => /lib64/libpcre.so

Small test

import pcre

echo version()

Output :

8.45 2021-06-15
melMass commented 5 months ago

AFAIK PCRE is bundled with nim releases, this is the bin folder on windows for instance:

image

I had a similar error that I solved by adding nim's bin folder to PATH

Alogani commented 5 months ago

Hello,

In linux, pcre is not is not shipped with nim :

ls -l /home/Alogani/.nimble/bin/
total 5220
-rwxr-xr-x. 1 Alogani Alogani 1835456  6 janv. 09:17 choosenim
-rwxr--r--. 1 Alogani Alogani  496280  6 janv. 09:17 nim
-rwxr--r--. 1 Alogani Alogani  496280  6 févr. 18:03 nimble
-rwxr--r--. 1 Alogani Alogani  496280  6 janv. 09:17 nim-gdb
-rwxr--r--. 1 Alogani Alogani  496280  6 janv. 09:17 nimgrep
lrwxrwxrwx. 1 Alogani Alogani      83  7 juin  12:37 nimlangserver -> ../pkgs2/nimlangserver-1.2.0-95de85fae4485dcd850ada31e200d15671a00c4a/nimlangserver
-rwxr--r--. 1 Alogani Alogani  496280  6 janv. 09:17 nimpretty
-rwxr--r--. 1 Alogani Alogani  496280  6 janv. 09:17 nimsuggest
lrwxrwxrwx. 1 Alogani Alogani      69  7 juin  07:40 ntu -> ../pkgs2/testutils-0.5.0-756d0757c4dd06a068f9d38c7f238576ba5ee897/ntu
-rwxr--r--. 1 Alogani Alogani  496280  6 janv. 09:17 testament

I tried copying libpcre.so.1 into the bin folder of .nimble/bin, but still the error continue.

jmgomez commented 1 month ago

Fixed by https://github.com/nim-lang/langserver/pull/259