nim-lang / nimble

Package manager for the Nim programming language.
https://nim-lang.github.io/nimble/index.html
Other
1.25k stars 191 forks source link

unhelpful error #615

Closed krux02 closed 4 years ago

krux02 commented 5 years ago

when I try to install my package, it fails. But the problem is that I can't find out where the problem comes from. Here is the output of the process:

$ nimble install fancygl
Downloading https://github.com/krux02/opengl-sandbox using git
  Verifying dependencies for fancygl@0.3.2
      Info: Dependency on AntTweakBar@>= 1.0.2 already satisfied
  Verifying dependencies for AntTweakBar@1.0.2
      Info: Dependency on sdl2_nim@>= 2.0.6.1 already satisfied
   Warning: Package 'sdl2_nim' has an incorrect structure. It should contain a single directory hierarchy for source files, named 'sdl2_nim', but file 'sdl_gfx_imagefilter.nim' is in a directory named 'sdl2' instead. This will be an error in the future.
      Hint: If 'sdl2' contains source files for building 'sdl2_nim', rename it to 'sdl2_nim'. Otherwise, prevent its installation by adding `skipDirs = @["sdl2"]` to the .nimble file.
  Verifying dependencies for sdl2_nim@2.0.8.0
      Info: Dependency on glm@>= 1.1.1 already satisfied
  Verifying dependencies for glm@1.1.1
      Info: Dependency on ast_pattern_matching@>= 1.0.0 already satisfied
  Verifying dependencies for ast_pattern_matching@1.0.0
 Installing fancygl@0.3.2
   Building fancygl/examples/hello_triangle using c backend
   Building fancygl/examples/forward_vertex_shader using c backend
   Building fancygl/examples/deferred_shading using c backend
   Building fancygl/examples/hello_shapes using c backend
   Building fancygl/examples/mandelbrot using c backend
   Building fancygl/examples/iqm_mesh_loading using c backend
   Building fancygl/examples/neuralnetwork using c backend
   Building fancygl/examples/noise_landscape using c backend
   Building fancygl/examples/particles using c backend
   Building fancygl/examples/particles_transform_feedback using c backend
   Building fancygl/examples/player_controls using c backend
   Building fancygl/examples/retro_tiling using c backend
   Building fancygl/examples/sandbox using c backend
   Building fancygl/examples/tetris using c backend
   Building fancygl/examples/waves using c backend
   Building fancygl/experiment/main using c backend
   Building fancygl/examples/console using c backend
../../../lib/pure/includes/oserr.nim(85) raiseOSError
Error: unhandled exception: No such file or directory [OSError]

The error message "Error: unhandled exception: No such file or directory [OSError]" isn't helpful at all, because it doesn't tell what file it can't find.

The line information ../../../lib/pure/includes/oserr.nim(85) is not helpful, because it just points to raiseOSError. This is not wher the problem came from.

Also it does not list the command that failed. So I can't rerun the commend and see if I can debug it somehow.

Last but not least it leaves a half way installed package in the file system that cannot be removed with nimble uninstall:

$ nimble uninstall fancygl
    Looking for fancygl (any version)
   Warning: No nimblemeta.json file found in /home/arne/.nimble/pkgs/fancygl-0.3.2
   Checking reverse dependencies
    Prompt: The following packages will be removed:
        ...   fancygl (0.3.2)
        ... Do you wish to continue? [y/N]
    Answer: y
../../../lib/pure/json.nim(873) parseFile
Error: unhandled exception: cannot read from file: /home/arne/.nimble/pkgs/fancygl-0.3.2/nimblemeta.json [IOError]

The information above was printed with a nimble in release mode:

bin/nim c -o:bin/nimble --noNimblePath --nilseqs:on -d:release dist/nimble/src/nimble.nim

To debug the problem further, I tried to build a debug mode with this command (same nimble source)

bin/nim c -o:bin/nimble --noNimblePath --nilseqs:on --debugger:native dist/nimble/src/nimble.nim

But on debug, nimble doesn't even get that far:

$ nimble install fancygl
Downloading https://github.com/krux02/opengl-sandbox using git
nimble.nim(1118)         nimble
nimble.nim(1056)         doAction
nimble.nim(481)          install
download.nim(256)        downloadPkg
packageparser.nim(410)   getPkgInfo
packageparser.nim(398)   getPkgInfoFromFile
packageparser.nim(349)   readPackageInfo
nimscriptsupport.nim(591) readPackageInfoFromNims
nimscriptsupport.nim(86) extractRequires
version.nim(218)         parseRequires
version.nim(193)         parseVersionRange
system.nim(3053)         sysFatal
Error: unhandled exception: index 29 not in 0 .. 28 [IndexError]
Traceback (most recent call last)
nimble.nim(1126)         nimble

Also while I try to find the problem with nimble install fancygl I run that command several times. The problem is that it downloads the entire project every time. This takes a lot of time and can be optimized.

krux02 commented 5 years ago

what logic is this: https://github.com/nim-lang/nimble/blob/3d6dc90cd4dfc12b8ae9d1958e84610cf21b34bb/src/nimblepkg/version.nim#L215

req = "nim >= 0.19.9 ", but with more whitespace that got stripped, thanks to github.

dom96 commented 5 years ago

The error message "Error: unhandled exception: No such file or directory [OSError]"

This is a bug. Any time Nimble crashes with a exception that isn't of type NimbleError there is a bug. Running Nimble with the --debug flag might be able to tell you what file it cannot find.

dom96 commented 5 years ago

More discussion: https://irclogs.nim-lang.org/23-02-2019.html#13:05:32

krux02 commented 5 years ago

@dom96 why do I need to pass a --debug flag to get crucial information as that?

dom96 commented 5 years ago

I'm not saying this is how it should be. I already acknowledged that this is a bug.

You use the --debug flag to... you know... debug things. I'm not expecting you to use it routinely.

dom96 commented 5 years ago

Unfortunately hello_triangle fails to compile for me so this doesn't get far enough:

/private/var/folders/qs/3mwpxj8s1td75h2bby7g18xw0000gn/T/nimble_79143/githubcom_krux02openglsandbox/glad/gl.nim(109, 39) Error: -1 can't be converted to uint64

I've tried to fix this error and managed to get quite far, but then got a C compile error and just gave up. Can you still repro this?

genotrance commented 4 years ago

fancygl@0.3.2 doesn't work due to the above error reported by @dom96 but fancygl@#head works fine. Seems like a Nim build issue and this goes back to Nimble not showing the output. The build error showed up with --debug. Closing this but there are other discussions about showing more output that are being debated.