unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <bauermann@kolabnow.com>
To: help-guix@gnu.org
Subject: help with use of %current-target-system parameter and gexps
Date: Sat, 14 Aug 2021 15:18:01 -0300	[thread overview]
Message-ID: <2108194.9MkYMPdv0c@popigai> (raw)

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





             reply	other threads:[~2021-08-14 18:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-14 18:18 Thiago Jung Bauermann [this message]
2021-08-15  6:02 ` help with use of %current-target-system parameter and gexps Mathieu Othacehe
2021-08-16 19:30   ` Thiago Jung Bauermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2108194.9MkYMPdv0c@popigai \
    --to=bauermann@kolabnow.com \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).