nim-lang/langserver

Can't build with v1.6.6

Clonkk opened this issue · 10 comments

I've firs tried nimble install nimlangserver and it fails.

I then cloned this repo on the master branch and building (nimble build) the repo and it also fails.

/home/rcaillaud/Workspace/localws/langserver/suggestapi.nim(198, 103) template/generic instantiation of `async` from here
/home/rcaillaud/Workspace/localws/langserver/suggestapi.nim(200, 22) Error: type mismatch: got <register: bool, nonBlockingWrite: bool>
but expected one of:
proc createPipe(size = 65536; register = true): AsyncPipe
  first type mismatch at position: 2
  unknown named parameter: nonBlockingWrite

expression: createPipe(register = true, nonBlockingWrite = false)
       Tip: 235 messages have been suppressed, use --verbose to show them.
     Error: Build failed for package: nimlangserver
        ... Execution failed with exit code 1

Looking at the path list :

... Command: /home/rcaillaud/.nimble/bin/nim c --colors:on --noNimblePath -d:release -d:NimblePkgVersion=0.1.0
--path:'/home/rcaillaud/.nimble/pkgs/asynctools-#non-blocking' --path:'/home/rcaillaud/.nimble/pkgs/json_rpc-#notif-changes'
--path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/nimcrypto-0.5.4 --path:/home/rcaillaud/.nimble
/pkgs/stint-0.0.1 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/chronos-3.0.11 --path:/home
/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/bearssl-0.1.5 --path:/home/rcaillaud/.nimble/pkgs/httputils-0.3.0
--path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble
/pkgs/httputils-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/chronicles-0.10.2 --path:/home
/rcaillaud/.nimble/pkgs/testutils-0.4.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble
/pkgs/json_serialization-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/serialization-0.1.0 --path:/home/rcaillaud/.nimble
/pkgs/faststreams-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/testutils-0.4.0 --path:'/home
/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/chronos-3.0.11 --path:/home/rcaillaud/.nimble
/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/bearssl-0.1.5 --path:/home/rcaillaud/.nimble/pkgs/httputils-0.3.0 --path:/home
/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:'/home/rcaillaud/.nimble
/pkgs/unittest2-#head' --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home
/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:'/home/rcaillaud/.nimble/pkgs/news-#status' --path:/home/rcaillaud/.nimble/pkgs/websock-0.1.0
--path:/home/rcaillaud/.nimble/pkgs/chronos-3.0.11 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble
/pkgs/bearssl-0.1.5 --path:/home/rcaillaud/.nimble/pkgs/httputils-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:'/home
/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/httputils-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0
--path:/home/rcaillaud/.nimble/pkgs/chronicles-0.10.2 --path:/home/rcaillaud/.nimble/pkgs/testutils-0.4.0 --path:'/home/rcaillaud/.nimble
/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/json_serialization-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/serialization-0.1.0
--path:/home/rcaillaud/.nimble/pkgs/faststreams-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble
/pkgs/testutils-0.4.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/chronos-3.0.11
--path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/bearssl-0.1.5 --path:/home/rcaillaud/.nimble
/pkgs/httputils-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:'/home
/rcaillaud/.nimble/pkgs/unittest2-#head' --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble
/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud
/.nimble/pkgs/asynctest-0.3.1 --path:/home/rcaillaud/.nimble/pkgs/nimcrypto-0.5.4 --path:/home/rcaillaud/.nimble/pkgs/bearssl-0.1.5
--path:/home/rcaillaud/.nimble/pkgs/zlib-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble
/pkgs/asynctools-0.1.1
--path:/home/rcaillaud/.nimble/pkgs/faststreams-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0
--path:/home/rcaillaud/.nimble/pkgs/testutils-0.4.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble
/pkgs/chronos-3.0.11 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/bearssl-0.1.5 --path:/home
/rcaillaud/.nimble/pkgs/httputils-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head'
--path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/json_serialization-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/serialization-0.1.0
--path:/home/rcaillaud/.nimble/pkgs/faststreams-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/testutils-0.4.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/chronos-3.0.11 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/bearssl-0.1.5 --path:/home/rcaillaud/.nimble/pkgs/httputils-0.3.0
--path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/with-0.4.0 --path:/home/rcaillaud/.nimble/pkgs/itertools-0.4.0
--path:/home/rcaillaud/.nimble/pkgs/chronicles-0.10.2 --path:/home/rcaillaud/.nimble/pkgs/testutils-0.4.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/json_serialization-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/serialization-0.1.0
--path:/home/rcaillaud/.nimble/pkgs/faststreams-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/testutils-0.4.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:/home/rcaillaud/.nimble/pkgs/chronos-3.0.11
--path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/bearssl-0.1.5 --path:/home/rcaillaud/.nimble/pkgs/httputils-0.3.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head' --path:'/home/rcaillaud/.nimble/pkgs/unittest2-#head'
--path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --path:/home/rcaillaud/.nimble/pkgs/stew-0.1.0 --hints:off -o:/home/rcaillaud/Workspace/localws/langserver/nimlangserver /home/rcaillaud/Workspace/localws/langserver/nimlangserver.nim

This is caused because Nimble does not handle transitive dependencies and consider fork of a Nimble package as independent.
As you can see there is 2 asynctools package : the fork and the "nimble" one in the dependencies list and both are treated as separate.

The fork of asynctools need to be merged in the main nimble repository to be able to handle transitive dependencies AND/OR Nimble dependencies resolution should be fixed, specifically when using fork of nimble package.

You can work around this by modifying locally asynctools and using nimble develop but it shouldn't be considered as a practical solution because it would prevent the usage of asynctools as a nimble repo.

I will first try to get the PR in (as a side note I was unable to reproduce after choosenim 1.6.6 and removing .nimble/pkgs)

cheatfate/asynctools#40

I will first try to get the PR in (as a side note I was unable to reproduce after choosenim 1.6.6 and removing .nimble/pkgs)

Strange. Maybe you have a leftover of a config file or nimble develop ?

dom96 commented

It might be best to try the new Nimble lock files to resolve these kinds of issues. @Clonkk you might be able to work around by removing any installed asynctools packages you have right now before building this package.

you might be able to work around by removing any installed asynctools packages you have right now before building this package.

I did and still have the issue.

It might be best to try the new Nimble lock files

As long as nimble consider that requires asynctools (via dependencies) and requires https://github.com/yyoncho/asynctools#non-blocking are 2 different dependencies; you will have a problem as you will have 2 different asynctools package and there's no clear way of knowing which is imported when doing import asynctools.

Does nimble lock change this behavior ?

dom96 commented

Does nimble lock change this behavior ?

It does not. There were some changes to how dependencies are installed in latest Nimble as well but I can't say whether this would change the semantics of the situation you describe (as I don't know myself).

Indeed, it seems there isn't much we can do here other than hope that the two packages can both relax their package requirements, and lean more on the lock files to guarantee that https://github.com/yyoncho/asynctools#non-blocking is used.

Indeed, it seems there isn't much we can do here other than hope that the two packages can both relax their package requirements, and lean more on the lock files to guarantee that https://github.com/yyoncho/asynctools#non-blocking is used.

That's a dependency resolution issue. Which is unfortunately a recurring issue for nimble. I hope after IC and arc/orc stabilization, the situation can be improved

Relevant :

Most likely, on this particular case, it seems the issue comes from : https://github.com/yyoncho/nim-json-rpc/blob/notif-changes/json_rpc.nimble using "requires asynctools".

Note that solving this particular problem with local nimble develop puts in evidence another issue :

   Building nimlangserver/nimlangserver using c backend
/home/rcaillaud/Workspace/localws/langserver/nimlangserver.nim(563, 57) Error: type mismatch: got <File, allowAsyncOps: bool>
but expected one of:
proc fileOutput(f: File; pageSize = defaultPageSize): OutputStreamHandle
  first type mismatch at position: 2
  unknown named parameter: allowAsyncOps
1 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them

expression: fileOutput(stdout, allowAsyncOps = true)
       Tip: 236 messages have been suppressed, use --verbose to show them.

Which I assume is similar in nature

@Clonkk I pushed yyoncho/nim-json-rpc@3888526 so hopefully this will fix the issue.

I retried this morning; problem seems solved.