zqqw / pakku

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

segfault with 1.6.8 #27

Closed shirleyquirk closed 1 year ago

shirleyquirk commented 1 year ago

maybe it's just me, but tried to install pakku on a fresh archlinux and it didnt compile with nim 1.6.8 (installed using choosenim)

zqqw commented 1 year ago

Yes, same here, but then I turned on some more debug output from Nim by setting --verbosity:2 in the Makefile (as shown in the diff at the bottom of the code section below) instead of the default 1, and it built successfully - an unexpected result. Looks like a possible Nim bug from this preliminary investigation?:

$ makepkg -ef
==> Making package: pakku-git 1:0.16.r13.g7410349-1 (Wed 28 Sep 2022 07:14:14 PM BST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting pkgver()...
==> Updated version: pakku-git 1:0.16.r14.gd3a0402-1
==> Removing existing $pkgdir/ directory...
==> Starting build()...
GEN: completion/bash
GEN: completion/zsh
NIM: lib/tools
NIM: src/pakku
GEN: doc/pakku.8.in
GEN: doc/pakku.conf.5.in
GEN: doc/pakku.8
GEN: doc/pakku.conf.5
CC: ../../../../../../../../../opt/nim/lib/std/private/digitsutils.nim
CC: ../../../../../../../../../opt/nim/lib/system/assertions.nim
CC: ../../../../../../../../../opt/nim/lib/system/dollars.nim
CC: ../../../../../../../../../opt/nim/lib/system/io.nim
CC: ../../../../../../../../../opt/nim/lib/system.nim
CC: ../../../../../../../../../opt/nim/lib/pure/parseutils.nim
CC: ../../../../../../../../../opt/nim/lib/pure/strutils.nim
CC: ../../../../../../../../../opt/nim/lib/pure/pathnorm.nim
CC: ../../../../../../../../../opt/nim/lib/posix/posix.nim
CC: ../../../../../../../../../opt/nim/lib/pure/times.nim
CC: ../../../../../../../../../opt/nim/lib/pure/os.nim
CC: ../../../../../../../../../opt/nim/lib/pure/strtabs.nim
CC: ../../../../../../../../../opt/nim/lib/pure/streams.nim
CC: ../../../../../../../../../opt/nim/lib/pure/osproc.nim
CC: bisect.nim
CC: ../../../../../../../../../opt/nim/lib/pure/collections/sequtils.nim
CC: install.nim
CC: tools.nim
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
make: *** [Makefile:120: src/pakku] Segmentation fault
make: *** Waiting for unfinished jobs....
==> ERROR: A failure occurred in build().
    Aborting...

$ git diff
diff --git a/Makefile b/Makefile
index bae3b09..d529975 100644
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,7 @@ NIM_OPTIMIZE = size
 NIM_CACHE_DIR = nimcache

 NIM_OPTIONS = \
+       --verbosity:2 \
        --putenv:'PROG_VERSION'="${RVERSION}" \
        --putenv:'PROG_COPYRIGHT'="${COPYRIGHT}" \
        --putenv:'PROG_PKGLIBDIR'="${PKGLIBDIR}" \
zqqw commented 1 year ago

If I enable core dumps then Nim leaves a core dump in the pakku/ top level dir of the pakku source, so it is Nim that segfaults, not some other part of the build process. Issue opened on the Nim GitHub repo here: https://github.com/nim-lang/Nim/issues/20450

zqqw commented 1 year ago

Just built the latest nim-git at the commit below, it compiled the latest pakku-git cleanly and the resulting package seems to work from a couple of quick tests. Last time I tried a few days back Nim was segfaulting again, but future Nim looks good now! commit d3eb1383d12d6dc20774b082b4085990bbc518dc Author: ringabout 43030857+ringabout@users.noreply.github.com Date: Wed Nov 23 14:20:35 2022 +0800 (1.6.10, latest binary Nim segfaults, if any users want to build Pakku with a binary Nim then use an older version for now.)

omentic commented 1 year ago

closing for #31