zqqw / pakku

Pacman wrapper with AUR support
GNU General Public License v3.0
39 stars 3 forks source link

nim-git build error 2021-5-2 #12

Closed zqqw closed 3 years ago

zqqw commented 3 years ago
CC: tools.nim
Hint: Release build [BuildMode]
NIM: src/pakku
/pakku/src/common.nim(231, 40) template/generic instantiation of `toHashSet` from here
/usr/lib/nim/pure/collections/sets.nim(241, 33) template/generic instantiation of `incl` from here
/usr/lib/nim/pure/collections/setimpl.nim(49, 21) template/generic instantiation of `rawGet` from here
/usr/lib/nim/pure/collections/hashcommon.nim(74, 14) template/generic instantiation of `genHashImpl` from here
/usr/lib/nim/pure/collections/hashcommon.nim(64, 12) template/generic instantiation of `hash` from here
/usr/lib/nim/pure/hashes.nim(548, 30) template/generic instantiation of `hash` from here
/pakku/src/utils.nim(70, 6) Error: type mismatch: got <Option[package.VersionConstraint], proc (x: float): Hash{.inline, noSideEffect, gcsafe, locks: 0.} | proc (x: pointer): Hash{.inline, noSideEffect, gcsafe, locks: 0.} | proc (x: ptr T): Hash{.inline.} | proc (x: T: Ordinal or enum): Hash{.inline.} | proc (x: ref T): Hash{.inline.} | proc (x: openArray[A]): Hash | proc (x: set[A]): Hash | proc (x: string): Hash{.noSideEffect, gcsafe, locks: <unknown>.} | proc (x: cstring): Hash{.noSideEffect, gcsafe, locks: <unknown>.} | proc (sBuf: string, sPos: int, ePos: int): Hash{.noSideEffect, gcsafe, locks: <unknown>.} | proc (x: T: tuple or object or proc): Hash{.inline.} | proc (aBuf: openArray[A], sPos: int, ePos: int): Hash>
but expected one of: 
proc map[T, R](self: Option[T]; callback: proc (input: T): R): Option[R]
  first type mismatch at position: 2
  required type for callback: proc (input: T): R{.closure.}
  but expression 'hash' is of type: None
proc map[T](self: Option[T]; callback: proc (input: T))
  first type mismatch at position: 2
  required type for callback: proc (input: T){.closure.}
  but expression 'hash' is of type: None
2 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them

expression: map(x[2], hash)
make: *** [Makefile:120: src/pakku] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

You need to modify the nim-git PKGBUILD to build it at present to get this error.

zqqw commented 3 years ago
diff --git a/Makefile b/Makefile
index 04ce4cb..045c3e8 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,9 @@ NIM_OPTIONS = \
        --hint'[Conf]':off \
        --hint'[Processing]':off \
        --hint'[Link]':off \
-       --hint'[SuccessX]':off
+       --hint'[SuccessX]':off \
+       -d:nimEnableHashRef
+

https://github.com/nim-lang/Nim/blob/devel/changelog.md

Doesn't build with nim-git though, so that doesn't fix this.

zqqw commented 3 years ago

The error was introduced in nim-lang with this commit: https://github.com/nim-lang/Nim/commit/d32ab61e61a9c8875cda926fb76e12dc8e8b9a23

zqqw commented 3 years ago

I think it's the addition of the inline pragma in that patch that causes the build failure, editing /usr/lib/nim/pure/hashes.nim seems to reveal so far.

#proc hash*[T: tuple | object | proc](x: T): Hash {.inline.} =
proc hash*[T: tuple | object | proc](x: T): Hash =
zqqw commented 3 years ago

Fixed in Nim: https://github.com/nim-lang/Nim/commit/0a4858dc59b1464d4057822d60e888fa4403223e (Although that fix may be further revised later)