dom96 / choosenim

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

`choosenim update stable` fails, `nimble install choosenim` fails #177

Closed timotheecour closed 4 years ago

timotheecour commented 4 years ago

here on windows 10:

$ choosenim update stable
   Updating stable
Downloading Nim 1.0.6 from nim-lang.org
choosenim.nim(206)       choosenim
choosenim.nim(183)       performAction
choosenim.nim(153)       update
choosenim.nim(34)        installVersion
download.nim(250)        download
download.nim(244)        downloadImpl
download.nim(192)        downloadFile
download.nim(177)        downloadFileNim
httpclient.nim(1302)     downloadFile
httpclient.nim(985)      parseBody
httpclient.nim(920)      recvFull
httpclient.nim(892)      reportProgress
download.nim(173)        onProgressChanged
terminal.nim(800)        showBar
terminal.nim(425)        eraseLine
oserr.nim(110)           raiseOSError
Error: unhandled exception: The handle is invalid.
 [OSError]

also tried nimble install choosenim /cc @genotrance

$ nimble install choosenim
    Prompt: choosenim not found in any local packages.json, check internet for updated packages? [y/N]
y
    Answer: Downloading Official package list
    Success Package list downloaded.
Downloading https://github.com/dom96/choosenim using git
  Verifying dependencies for choosenim@0.5.1
 Installing nimble@#5bb795a
Downloading https://github.com/nim-lang/nimble using git
  Verifying dependencies for nimble@#5bb795a
 Installing nimble@#5bb795a
   Building nimble/nimble.exe using c backend
   Success: nimble installed successfully.
 Installing nimarchive@>= 0.3.4
Downloading https://github.com/genotrance/nimarchive using git
       Tip: 35 messages have been suppressed, use --verbose to show them.
     Error: Could not read package info file in C:\Users\timothee\AppData\Local\Temp\nimble_8804\githubcom_genotrancenimarchive_0.3.4\nimarchive.nimble;
        ...   Reading as ini file failed with:
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with:
        ...     C:\Users\timothee\AppData\Local\Temp\nimble_8804\githubcom_genotrancenimarchive_0.3.4\nimarchive_8804.nims(8, 15) template/generic instantiation from here
        ... C:\Users\timothee\AppData\Local\Temp\nimble_8804\githubcom_genotrancenimarchive_0.3.4\nimarchive_8804.nims(23, 18) Error: cannot open file: nimterop/docs
        ...     import nimterop/docs
        ...                    ^
        ... No stack traceback available
        ... To create a stacktrace, rerun compilation with ./koch temp e <file>
        ... printPkgInfo() failed.

also tried:

cd Nim

$ choosenim .
   Switched to Nim (C:\Users\timothee\git_clone\Nim)

$ bin/nimble install choosenim
Downloading https://github.com/dom96/choosenim using git
  Verifying dependencies for choosenim@0.5.1
      Info: Dependency on nimble@#5bb795a already satisfied
       Tip: 19 messages have been suppressed, use --verbose to show them.
     Error: Could not read package info file in C:\Users\timothee\.nimble\pkgs\nimble-#5bb795a\nimble.nimble;
        ...   Reading as ini file failed with:
        ...     Invalid section: .
        ...   Evaluating as NimScript file failed with:
        ...     C:\Users\timothee\git_clone\Nim\lib\pure\collections\tableimpl.nim(121, 23) Error: undeclared field: 'first' .

$ nimble -v nimble v0.11.0 compiled at 2020-02-13 03:02:44 git hash: 5bb795a364a431f897c3864186dbe1aa138c85b9

$ choosenim -v choosenim v0.3.2 (2018-02-27 20:19:49) [windows/i386]

$ nim -v Nim Compiler Version 1.1.1 [Windows: amd64] Compiled at 2020-02-12 Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 1e303100f8ca32e60b154bf997a9102f36eb23d0 active boot switches: -d:release

$ choosenim update self
   Updating choosenim
choosenim.nim(206)       choosenim
choosenim.nim(183)       performAction
choosenim.nim(132)       update
choosenim.nim(107)       updateSelf
download.nim(192)        downloadFile
download.nim(177)        downloadFileNim
httpclient.nim(1302)     downloadFile
httpclient.nim(976)      parseBody
httpclient.nim(952)      parseChunks
httpclient.nim(920)      recvFull
httpclient.nim(892)      reportProgress
download.nim(171)        onProgressChanged
terminal.nim(800)        showIndeterminateBar
terminal.nim(425)        eraseLine
oserr.nim(110)           raiseOSError
Error: unhandled exception: The handle is invalid.
 [OSError]
genotrance commented 4 years ago

Please retry with choosenim 0.5.1 which is the current release. The eraseLine issue is already fixed.

As for nimble install choosenim, looks like you have an old version of nimterop@#head installed.

timotheecour commented 4 years ago

downloading from https://github.com/dom96/choosenim/releases the zip, then unzipping, then running runme.bat did the trick, thanks.

will close this but just a question: does the dependency of choosenim on nimterop (and all the other dependencies this brings) make sense for a tool that's used for bootstrapping?

 nimble install nimterop
Downloading https://github.com/genotrance/nimterop using git
  Verifying dependencies for nimterop@0.4.4
 Installing regex@>= 0.13.0
Downloading https://github.com/nitely/nim-regex using git
  Verifying dependencies for regex@0.13.0
 Installing unicodedb@>= 0.7.2
Downloading https://github.com/nitely/nim-unicodedb using git
  Verifying dependencies for unicodedb@0.7.2
 Installing unicodedb@0.7.2
   Success: unicodedb installed successfully.
 Installing unicodeplus@>= 0.5.0
Downloading https://github.com/nitely/nim-unicodeplus using git
  Verifying dependencies for unicodeplus@0.5.1
      Info: Dependency on unicodedb@>= 0.7 already satisfied
  Verifying dependencies for unicodedb@0.7.2
 Installing unicodeplus@0.5.1
   Success: unicodeplus installed successfully.
 Installing regex@0.13.0
   Success: regex installed successfully.
 Installing cligen@>= 0.9.41
Downloading https://github.com/c-blake/cligen.git using git
  Verifying dependencies for cligen@0.9.42
 Installing cligen@0.9.42
   Success: cligen installed successfully.
 Installing nimterop@0.4.4
   Building nimterop/nimterop/toast.exe using c backend
   Success: nimterop installed successfully.
genotrance commented 4 years ago

does the dependency of choosenim on nimterop (and all the other dependencies this brings) make sense for a tool that's used for bootstrapping?

No reason why not - Nim creates standalone executables - joys of using Nim in the first place. Also, nimterop is a compile time dependency, similar to gcc and Nim, not runtime.

timotheecour commented 4 years ago

right but my concern was it causes a larger surface of breakage; in case any of those dependencies fail, it makes bootstrapping via choosenim fail. I guess we can live with this.

genotrance commented 4 years ago

What does the build process of choosenim have to do with bootstrapping Nim? No one has to build choosenim in order to bootstrap Nim. You just download a compiled binary.

timotheecour commented 4 years ago

What does the build process of choosenim have to do with bootstrapping Nim?

let me rephrase: you don't need choosenim to bootstrap nim, but if choosenim is to be the preferred way to install and manage past nim releases (which is a fundamental tool on which to build on top of), it should be relatively stable (ie, no frequent breakage when ecosystem changes); which correlates with having fewer dependencies.

You just download a compiled binary.

sure but that should ideally be something choosenim would handle well

genotrance commented 4 years ago

Fewer dependencies would certainly be preferable but we needed to get things done too. Choosenim needs to extract zip releases and 7z files for mingw on Windows, and xz files on posix. libarchive was the best way to do it.

I am looking into things like Conan.io and BinaryBuilder.org to see if we can avoid building libs altogether. Let's see if that makes things smoother. @kdheepak has already created https://github.com/kdheepak/binary-builder-downloader and is investigating conda and conan support so it does seem possible.

cc @jyapayne

dom96 commented 4 years ago

FWIW choosenim didn't need to use libarchive and did quite well before this dependency was introduced.

For someone that's developed choosenim, the fact that I can no longer compile it is a very bad sign. Since others are also having the same problems it may be time to go back to what we had I'm afraid.