all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* help with use of %current-target-system parameter and gexps
@ 2021-08-14 18:18 Thiago Jung Bauermann
  2021-08-15  6:02 ` Mathieu Othacehe
  0 siblings, 1 reply; 3+ messages in thread
From: Thiago Jung Bauermann @ 2021-08-14 18:18 UTC (permalink / raw)
  To: help-guix

Hello Guix,

I would like to ask for help with a couple of issues that I ran into while
trying to fix a build failure in ‘texlive-texmf’ in the core-updates-frozen
branch on powerpc64le-linux:

  fmtutil [ERROR]: not building luajittex due to missing engine: luajittex
  fmtutil [ERROR]: not building luajithbtex due to missing engine: luajithbtex

The problem is straightforward: LuaJIT isn’t supported on powerpc64le.
‘texlive-latex-base’ disables these engines accordingly:

    ;; LuaJIT is not ported to powerpc64le* yet.
    ,@(if (string-prefix? "powerpc64le"
                          (or (%current-target-system)
                              (%current-system)))
        '("luajittex" "luajithbtex" "mfluajit") '())

So all I have to do is disable these “*luajit*” engines in ‘texlive-texmf’
as well. Unfortunately copying the same ‘if’ expression like so:

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 70166941d554..8fc420039417 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -6821,9 +6821,17 @@ directly generate PDF documents instead of DVI.")
                      (share (string-append out "/share"))
                      (texmfroot (string-append share "/texmf-dist/web2c"))
                      (texmfcnf (string-append texmfroot "/texmf.cnf"))
+                     (fmtutilcnf (string-append texmfroot "/fmtutil.cnf"))
                      (texlive-bin (assoc-ref inputs "texlive-bin"))
                      (texbin (string-append texlive-bin "/bin"))
                      (tlpkg (string-append texlive-bin "/share/tlpkg")))
+                ;; LuaJIT is not ported to powerpc64le* yet.
+                (if (string-prefix? "powerpc64le"
+                                    (or (%current-target-system)
+                                        (%current-system)))
+                    (substitute* fmtutilcnf
+                      (((string-append "^(luajittex|luajithbtex|mfluajit)") m)
+                       (string-append "#! " m))))
                 ;; Register SHARE as TEXMFROOT in texmf.cnf.
                 (substitute* texmfcnf
                   (("TEXMFROOT = \\$SELFAUTOPARENT")
--8<---------------cut here---------------end--------------->8---

Results in an error:

--8<---------------cut here---------------start------------->8---
starting phase `texmf-config'
error: in phase 'texmf-config': uncaught exception:
unbound-variable #f "Unbound variable: ~S" (%current-target-system) #f
phase `texmf-config' failed after 0.0 seconds
Backtrace:
          14 (primitive-load "/gnu/store/49q7az0dglza46v2cz06iajc568?")
In guix/build/gnu-build-system.scm:
    904:2 13 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
In ice-9/boot-9.scm:
  1752:10 12 (with-exception-handler _ _ #:unwind? _ # _)
In srfi/srfi-1.scm:
    634:9 11 (for-each #<procedure 1067c0a0 at guix/build/gnu-build?> ?)
In ice-9/boot-9.scm:
  1752:10 10 (with-exception-handler _ _ #:unwind? _ # _)
In guix/build/gnu-build-system.scm:
   925:23  9 (_)
In ice-9/eval.scm:
    619:8  8 (_ #(#(#(#(#(#(#(#(#(#<directo?>) ?) ?) ?) ?) ?) ?) ?) ?))
   245:16  7 (_ #(#(#(#(#(#(#(#(#(#<directo?>) ?) ?) ?) ?) ?) ?) ?) ?))
    159:9  6 (_ #(#(#(#(#(#(#(#(#(#<directo?>) ?) ?) ?) ?) ?) ?) ?) ?))
   293:34  5 (_ #(#(#(#(#(#(#(#(#(#<directo?>) ?) ?) ?) ?) ?) ?) ?) ?))
   182:19  4 (proc #(#(#(#(#(#(#(#(#(#<dire?>) ?) ?) ?) ?) ?) ?) ?) ?))
   142:16  3 (compile-top-call #<directory (guile-user) 10240c80> # #)
In unknown file:
           2 (%resolve-variable (7 . %current-target-system) #<direc?>)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Unbound variable: %current-target-system
--8<---------------cut here---------------end--------------->8---

So this is my first question: why does that ‘if’ condition work in
‘texlive-latex-base’ but not in ‘texlive-texmf’? I can’t see a significant
difference between the two.

In any case, I thought I could solve this by using a gexp. I tried several
different variations, but none worked. I think this was my best shot:

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 70166941d554..1df5dbbd5f9e 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -51,6 +51,7 @@
   #:use-module (guix deprecation)
   #:use-module (guix git-download)
   #:use-module (guix svn-download)
+  #:use-module (guix gexp)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
@@ -6794,7 +6795,7 @@ directly generate PDF documents instead of DVI.")
       ("ruby" ,ruby)
       ("tcsh" ,tcsh)))
    (arguments
-    `(#:modules ((guix build gnu-build-system)
+    (list #:modules '((guix build gnu-build-system)
                  (guix build utils)
                  (srfi srfi-26))
 
@@ -6803,7 +6804,7 @@ directly generate PDF documents instead of DVI.")
       #:substitutable? #f
 
       #:phases
-        (modify-phases (map (cut assq <> %standard-phases)
+        #~(modify-phases (map (cut assq <> %standard-phases)
                             '(set-paths unpack patch-source-shebangs))
           (add-after 'unpack 'unset-environment-variables
             (lambda _
@@ -6821,9 +6822,16 @@ directly generate PDF documents instead of DVI.")
                      (share (string-append out "/share"))
                      (texmfroot (string-append share "/texmf-dist/web2c"))
                      (texmfcnf (string-append texmfroot "/texmf.cnf"))
+                     (fmtutilcnf (string-append texmfroot "/fmtutil.cnf"))
                      (texlive-bin (assoc-ref inputs "texlive-bin"))
                      (texbin (string-append texlive-bin "/bin"))
                      (tlpkg (string-append texlive-bin "/share/tlpkg")))
+                #~(let-system (system target)
+                    ;; LuaJIT is not ported to powerpc64le* yet.
+                    (if (string-prefix? "powerpc64le" (or target system))
+                        (substitute* fmtutilcnf
+                          (((string-append "^(luajittex|luajithbtex|mfluajit)") m)
+                           (string-append "#! " m)))))
                 ;; Register SHARE as TEXMFROOT in texmf.cnf.
                 (substitute* texmfcnf
                   (("TEXMFROOT = \\$SELFAUTOPARENT")
--8<---------------cut here---------------end--------------->8---

But it results in this error:

--8<---------------cut here---------------start------------->8---
starting phase `texmf-config'
error: in phase 'texmf-config': uncaught exception:
unbound-variable #f "Unbound variable: ~S" (gexp) #f
phase `texmf-config' failed after 0.0 seconds
Backtrace:
          11 (primitive-load "/gnu/store/dvqdh0afs7nn2b9ymxmvzy6nrlb?")
In guix/build/gnu-build-system.scm:
    904:2 10 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
In ice-9/boot-9.scm:
  1752:10  9 (with-exception-handler _ _ #:unwind? _ # _)
In srfi/srfi-1.scm:
    634:9  8 (for-each #<procedure 105f1160 at guix/build/gnu-build?> ?)
In ice-9/boot-9.scm:
  1752:10  7 (with-exception-handler _ _ #:unwind? _ # _)
In guix/build/gnu-build-system.scm:
   925:23  6 (_)
In ice-9/eval.scm:
    619:8  5 (_ #(#(#(#(#(#(#(#(#(#(#<di?>) ?) ?) ?) ?) ?) ?) ?) ?) ?))
   182:19  4 (proc #(#(#(#(#(#(#(#(#(#(#) # ?) ?) ?) ?) ?) ?) ?) ?) ?))
   142:16  3 (compile-top-call #<directory (guile-user) 10240c80> # #)
In unknown file:
           2 (%resolve-variable (7 . gexp) #<directory (guile-user) ?>)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Unbound variable: gexp
builder for `/gnu/store/mj1wim034hpnjzwicbgr6791bl1q3f99-texlive-texmf-20210325.drv' failed with exit code 1
build of /gnu/store/mj1wim034hpnjzwicbgr6791bl1q3f99-texlive-texmf-20210325.drv failed
--8<---------------cut here---------------end--------------->8---

So my second question is: can somebody see any way to make ‘texlive-mf’
disable the “*luajit*’ engines when building for powerpc64le?

-- 
Thanks,
Thiago





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: help with use of %current-target-system parameter and gexps
  2021-08-14 18:18 help with use of %current-target-system parameter and gexps Thiago Jung Bauermann
@ 2021-08-15  6:02 ` Mathieu Othacehe
  2021-08-16 19:30   ` Thiago Jung Bauermann
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Othacehe @ 2021-08-15  6:02 UTC (permalink / raw)
  To: Thiago Jung Bauermann; +Cc: help-guix


Hello Thiago,

> +                ;; LuaJIT is not ported to powerpc64le* yet.
> +                (if (string-prefix? "powerpc64le"
> +                                    (or (%current-target-system)
> +                                        (%current-system)))
> +                    (substitute* fmtutilcnf
> +                      (((string-append "^(luajittex|luajithbtex|mfluajit)") m)
> +                       (string-append "#! " m))))
>                  ;; Register SHARE as TEXMFROOT in texmf.cnf.
>                  (substitute* texmfcnf
>                    (("TEXMFROOT = \\$SELFAUTOPARENT")
>

The issue here is that the %current-target-system and %current-system
are not defined at build time. You need to force their evaluation by
using "unquote", this way:

--8<---------------cut here---------------start------------->8---
(arguments
 `(#:phases
   ...
   (if (string-prefix? "powerpc64le"
                      ,(or (%current-target-system)
                           (%current-system)))
      ...)))
--8<---------------cut here---------------end--------------->8---
>
> +                #~(let-system (system target)
> +                    ;; LuaJIT is not ported to powerpc64le* yet.

Here also you need to unquote this part, using "ungexp":

--8<---------------cut here---------------start------------->8---
   #$(let-system (system target)
      ...
--8<---------------cut here---------------end--------------->8---

Thanks,

Mathieu


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: help with use of %current-target-system parameter and gexps
  2021-08-15  6:02 ` Mathieu Othacehe
@ 2021-08-16 19:30   ` Thiago Jung Bauermann
  0 siblings, 0 replies; 3+ messages in thread
From: Thiago Jung Bauermann @ 2021-08-16 19:30 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: help-guix

Hello Mathieu,

Em domingo, 15 de agosto de 2021, às 03:02:42 -03, Mathieu Othacehe
escreveu:
> > +                ;; LuaJIT is not ported to powerpc64le* yet.
> > +                (if (string-prefix? "powerpc64le"
> > +                                    (or (%current-target-system)
> > +                                        (%current-system)))
> > +                    (substitute* fmtutilcnf
> > +                      (((string-append
> > "^(luajittex|luajithbtex|mfluajit)") m) +                      
> > (string-append "#! " m))))
> > 
> >                  ;; Register SHARE as TEXMFROOT in texmf.cnf.
> >                  (substitute* texmfcnf
> >                  
> >                    (("TEXMFROOT = \\$SELFAUTOPARENT")
> 
> The issue here is that the %current-target-system and %current-system
> are not defined at build time. You need to force their evaluation by
> using "unquote", this way:

Ah! I wasn’t aware of that trick. It indeed solved the problem. Thank you
very much for your help!

> --8<---------------cut here---------------start------------->8---
> (arguments
>  `(#:phases

‘texlive-texmf’  already has this quasiquote, so I only needed the unquote
below to make it work.

>    ...
>    (if (string-prefix? "powerpc64le"
>                       ,(or (%current-target-system)
>                            (%current-system)))
>       ...)))
> --8<---------------cut here---------------end--------------->8---
> 
> > +                #~(let-system (system target)
> > +                    ;; LuaJIT is not ported to powerpc64le* yet.
> 
> Here also you need to unquote this part, using "ungexp":
> 
> --8<---------------cut here---------------start------------->8---
>    #$(let-system (system target)
>       ...
> --8<---------------cut here---------------end--------------->8---

Not that it matters anymore, but just for completeness: unfortunately
I couldn’t make this one work. When I used “ungexp”, I got this error:

--8<---------------cut here---------------start------------->8---
[ 79%] GUILEC   gnu/packages/tex.go
gnu/packages/tex.scm:6832:24: warning: possibly unbound variable `substitute*'
gnu/packages/tex.scm:6832:24: warning: possibly unbound variable `fmtutilcnf'
gnu/packages/tex.scm:6833:27: warning: possibly unbound variable `m'
Compiling Scheme modules...
Compiling Scheme modules...
make[2]: Saindo do diretório '/home/debian/src/guix'

make[1]: Saindo do diretório '/home/debian/src/guix'

gnu/packages/tex.scm:6832:24: error: substitute*: unbound variable
hint: Did you forget `(use-modules (guix build utils))'?
--8<---------------cut here---------------end--------------->8---

I tried using this at the beginning of the gexp:

--8<---------------cut here---------------start------------->8---
            (with-imported-modules '((guix build utils))
              #~(begin
                  (use-modules ((guix build utils)))
                      ⋮
--8<---------------cut here---------------end--------------->8---

But it still resulted in the same error. But no problem, your “unquote”
solution worked.

-- 
Thanks,
Thiago




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-16 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-14 18:18 help with use of %current-target-system parameter and gexps Thiago Jung Bauermann
2021-08-15  6:02 ` Mathieu Othacehe
2021-08-16 19:30   ` Thiago Jung Bauermann

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.