dom96 / choosenim

Tool for easily installing and managing multiple versions of the Nim programming language.
BSD 3-Clause "New" or "Revised" License
682 stars 65 forks source link

"choosenim update stable" silently exits on Windows #210

Closed akavel closed 2 years ago

akavel commented 4 years ago

Running choosenim update stable prints only Updating stable and immediately quits 😢

C:\prog\bookwin>choosenim show
  Selected: 1.2.0
   Channel: devel
      Path: C:\Users\Mateusz\.choosenim\toolchains\nim-1.2.0

  Versions:
            #devel
          * 1.2.0

C:\prog\bookwin>choosenim update stable
   Updating stable

C:\prog\bookwin>echo %errorlevel%
-1073741819

C:\prog\bookwin>choosenim show
  Selected: 1.2.0
   Channel: devel
      Path: C:\Users\Mateusz\.choosenim\toolchains\nim-1.2.0

  Versions:
            #devel
          * 1.2.0

C:\prog\bookwin>choosenim --version
choosenim v0.6.0 (2020-03-06 18:45:17) [windows/amd64]

C:\prog\bookwin>choosenim --debug update stable
      Info: No client ID found in 'C:\Users\Mateusz\.choosenim\analytics', not sending analytics.
      Info: No client ID found in 'C:\Users\Mateusz\.choosenim\analytics', not sending analytics.
   Updating stable
       Http Requesting http://nim-lang.org/channels/stable

C:\prog\bookwin>curl -i http://nim-lang.org/channels/stable
HTTP/1.1 301 Moved Permanently
Date: Thu, 23 Jul 2020 18:11:28 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Thu, 23 Jul 2020 19:11:28 GMT
Location: https://nim-lang.org/channels/stable
cf-request-id: 041e7895620000f2ac01961200000001
Server: cloudflare
CF-RAY: 5b775d356d9ff2ac-WAW

C:\prog\bookwin>curl -i https://nim-lang.org/channels/stable
HTTP/1.1 200 OK
Date: Thu, 23 Jul 2020 18:11:21 GMT
Content-Type: application/octet-stream
Content-Length: 6
Connection: keep-alive
Set-Cookie: __cfduid=d39374cdd2db21b1bc231e0a6b6617d4a1595527881; expires=Sat, 22-Aug-20 18:11:21 GMT; path=/; domain=.nim-lang.org; HttpOnly; SameSite=Lax
Last-Modified: Fri, 26 Jun 2020 18:15:16 GMT
ETag: "5ef63b34-6"
Accept-Ranges: bytes
CF-Cache-Status: DYNAMIC
cf-request-id: 041e787b230000f2acfb1e7200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5b775d0b6e83f2ac-WAW

1.2.4

C:\prog\bookwin>date /t
23/07/2020
dom96 commented 4 years ago

Fun, can you gdb it?

akavel commented 4 years ago

Initial quick run with gdb below, what I could squeeze today morning. I don't know gdb well and how to use it with Nim, but I'll still try to find time to build choosenim repo with --debugger:native, I assume that can give some more info.

If you could give me some suggestions on what commands I should use to find out the position & more info about the crash, would be very helpful and make it possible for me to easier & sooner find a window of time to do that.

C:\dnload\nim-etc\choosenim-0.4.0_windows_i386\choosenim>gdb --args choosenim update stable
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 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.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from choosenim...done.
(gdb) run
Starting program: C:\dnload\nim-etc\choosenim-0.4.0_windows_i386\choosenim\choosenim.exe update stable
[New Thread 11844.0x1798]
warning: `C:\windows\SYSTEM32\ntdll.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: `C:\windows\System32\wow64.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: `C:\windows\System32\wow64win.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
warning: `C:\windows\System32\wow64cpu.dll': Shared library architecture i386:x86-64 is not compatible with target architecture i386.
[New Thread 11844.0x1c40]
[New Thread 11844.0x12a4]
[New Thread 11844.0x688]
   Updating stable
gdb: unknown target exception 0xc0000008 at 0x6a29feba

Thread 1 received signal ?, Unknown signal.
0x0009d978 in ?? ()
(gdb)

For now, quick googling seems to suggest 0xc0000008 means "An invalid handle was specified".

akavel commented 4 years ago

When trying nimble build in choosenim's repo, for v0.6.0, I'm getting a Windows dialog reporting an error in toast.exe, localized text translating more or less to "cannot find object libgcc_s_seh-1.dll" :/

        ... # Including library C:\Users\Mateusz\.choosenim\toolchains\mingw64\x86_64-w64-mingw32\lib\libiconv.a
        ... # Overriding stat dev_t mode_t
        ... # Overriding BY_HANDLE_FILE_INFORMATION
        ... # Importing "C:\Users\Mateusz\nimcache\nimterop\nimarchive\libarchive\LibArchive\include\archive.h, C:\Users\Mateusz\nimcache\nimterop\nimarchive\libarchive\LibArchive\include\archive_entry.h"
        ... stack trace: (most recent call last)
        ... C:\Users\Mateusz\.nimble\pkgs\nimterop-0.6.8\nimterop\cimport.nim(632, 23) cImport
        ... C:\Users\Mateusz\.nimble\pkgs\nimterop-0.6.8\nimterop\cimport.nim(138, 11) getToast
        ... C:\Users\Mateusz\.choosenim\toolchains\nim-1.2.0\lib\system\assertions.nim(29, 26) failedAssertImpl
        ... C:\Users\Mateusz\.choosenim\toolchains\nim-1.2.0\lib\system\assertions.nim(22, 11) raiseAssert
        ... C:\Users\Mateusz\.choosenim\toolchains\nim-1.2.0\lib\system\fatal.nim(49, 5) sysFatal
        ... C:\Users\Mateusz\.nimble\pkgs\nimarchive-0.5.2\nimarchive\archive.nim(61, 10) template/generic instantiation of `cImport` from here
        ... C:\Users\Mateusz\.choosenim\toolchains\nim-1.2.0\lib\system\fatal.nim(49, 5) Error: unhandled exception: C:\Users\Mateusz\.nimble\pkgs\nimterop-0.6.8\nimterop\cimport.nim(138, 16) `false`
        ...  [AssertionError]
dom96 commented 4 years ago

@genotrance can you help out here?

genotrance commented 4 years ago

I fixed nimterop by setting -static - that way, the binary won't need the DLLs in path. However, we need to figure this out for choosenim as well.

dom96 commented 2 years ago

Give this another try. Choosenim is no longer statically linked on Windows.