Subject: Re: bug#46580: vim-full fails to build

From: zimoun <[email-masked]>
Date: Fri, 05 Mar 2021 19:30:46 +0100

Hi,

On mar., 16 févr. 2021 at 23:49, Alex <[email-masked]> wrote:

> I encountered issue recently with upgrading and (later) clean install of vim-full.

Indeed, the package is broken.  The commit
988ac06ce8cf9b1760094e0e2ff23960355d07eb introduces the fix:

       ;; Fix test_signals.vim. https://github.com/vim/vim/issues/7402
       #:make-flags (list "CFLAGS=-D_REENTRANT")

which breaks “#:make-flags '("LDFLAGS=-lexpat")” in vim-full.  More
specifically, the package vim-full contains duplicate #:make-flags in
its argument.  For instance,

--8<---------------cut here---------------start------------->8---
$ guix repl
GNU Guile 3.0.5
Copyright (C) 1995-2021 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guix-user)> ,use(gnu packages vim)
scheme@(guix-user)> ,pp (package-arguments vim-full)
$1 = (#:configure-flags
 (list (string-append
         "--with-lua-prefix="
         (assoc-ref %build-inputs "lua"))
       "--with-features=huge"
       "--enable-python3interp=yes"
       "--enable-perlinterp=yes"
       "--enable-rubyinterp=yes"
       "--enable-tclinterp=yes"
       "--enable-luainterp=yes"
       "--enable-cscope"
       "--enable-sniff"
       "--enable-multibyte"
       "--enable-xim"
       "--disable-selinux"
       "--enable-gui")
 #:make-flags
 '("LDFLAGS=-lexpat")
 #:test-target
 "test"
 #:parallel-tests?
 #f
 #:make-flags
 (list "CFLAGS=-D_REENTRANT")
 #:phases
 (modify-phases
   (modify-phases
[...]
--8<---------------cut here---------------end--------------->8---

Attached a fix.  Well, at least the package vim-full now builds.  Since
I am not a Vim user, could you confirm that with patch, the vim-full
package is functional?  If yes, I will submit the patch to guix-patches.

However, I am not sure to understand how all the machinery works.  For
instance, I do not understand why:

           ((#:make-flags flags)
            `("LDFLAGS=-lexpat"))

raises the backtrace:

--8<---------------cut here---------------start------------->8---
Backtrace:
In ice-9/eval.scm:
   191:35 19 (_ #f)
   214:21 18 (_ #f)
   217:50 17 (lp (#<procedure 7fffee821940 at ice-9/eval.scm:282:?> ?))
   217:50 16 (lp (#<procedure 7fffee821920 at ice-9/eval.scm:282:?> ?))
   217:50 15 (lp (#<procedure 7fffee821900 at ice-9/eval.scm:282:?> ?))
   217:50 14 (lp (#<procedure 7fffee8218e0 at ice-9/eval.scm:282:?> ?))
   217:50 13 (lp (#<procedure 7fffee821880 at ice-9/eval.scm:649:?> ?))
   217:50 12 (lp (#<procedure 7fffee821860 at ice-9/eval.scm:282:?> ?))
   217:50 11 (lp (#<procedure 7fffee821800 at ice-9/eval.scm:649:?> ?))
   217:50 10 (lp (#<procedure 7fffee8217e0 at ice-9/eval.scm:282:?> ?))
   217:50  9 (lp (#<procedure 7fffee8217c0 at ice-9/eval.scm:282:?> ?))
   217:50  8 (lp (#<procedure 7fffee8217a0 at ice-9/eval.scm:282:?> ?))
   217:50  7 (lp (#<procedure 7fffee821540 at ice-9/eval.scm:649:?> ?))
   217:50  6 (lp (#<procedure 7fffee821520 at ice-9/eval.scm:282:?> ?))
   217:50  5 (lp (#<procedure 7fffee821500 at ice-9/eval.scm:282:?> ?))
   217:50  4 (lp (#<procedure 7fffee8214e0 at ice-9/eval.scm:282:?> ?))
   217:50  3 (lp (#<procedure 7fffee81c300 at ice-9/eval.scm:212:?> ?))
   217:50  2 (lp (#<procedure 7fffee821180 at ice-9/eval.scm:282:?> ?))
   217:33  1 (lp (#<procedure 7fffee821140 at ice-9/eval.scm:187:?> ?))
Exception thrown while printing backtrace:
In procedure frame-local-ref: Argument 2 out of range: 1

ice-9/eval.scm:217:33: In procedure lp:
Wrong type to apply: "LDFLAGS=-lexpat"
--8<---------------cut here---------------end--------------->8---

Explanations welcome. :-)

Cheers,
simon

diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
index 372d470e09..a638f05908 100644
--- a/gnu/packages/vim.scm
+++ b/gnu/packages/vim.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2019 Julien Lepiller <[email-masked]>
 ;;; Copyright © 2019, 2020 Jakub Kądziołka <[email-masked]>
 ;;; Copyright © 2020 Jack Hill <[email-masked]>
+;;; Copyright © 2021 Simon Tournier <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -216,11 +217,14 @@ with the editor vim.")))
              "--enable-xim"
              "--disable-selinux"
              "--enable-gui")
-       ;; This flag fixes the following error:
-       ;; .../libpython3.7m.a(pyexpat.o): undefined reference to symbol 'XML_FreeContentModel'
-       ;; .../libexpat.so.1: error adding symbols: DSO missing from command line
-       #:make-flags '("LDFLAGS=-lexpat")
        ,@(substitute-keyword-arguments (package-arguments vim)
+           ;; This flag fixes the following error:
+           ;; .../libpython3.7m.a(pyexpat.o): undefined reference to symbol 'XML_FreeContentModel'
+           ;; .../libexpat.so.1: error adding symbols: DSO missing from command line
+           ((#:make-flags flags)
+            `(append
+              '("LDFLAGS=-lexpat")
+              (delete "CFLAGS=-D_REENTRANT" ,flags))) ; Fix <https://bug.gnu.org/46580>.
            ((#:phases phases)
             `(modify-phases ,phases
                (add-before 'check 'start-xserver