Subject: bug#49218: texlive-latex-base fails to build: "missing engine: luajithbtex"

From: Chris Marusich <[email-masked]>
Date: Thu, 24 Jun 2021 22:36:26 -0700

Hi,

On powerpc64le-linux, using Guix commit
45dd2b4505095d24e253bd62d74474cad135cf3b (the current tip of
core-updates), texlive-latex-base fails to build because the engine
"luajithbtex" is missing:

--8<---------------cut here---------------start------------->8---
Transcript written on pdflatex-dev.log.
fmtutil [INFO]: log file copied to: /tmp/guix-build-texlive-latex-base-54632.drv-0/source/web2c/pdftex/pdflatex-dev.log
fmtutil [INFO]: /tmp/guix-build-texlive-latex-base-54632.drv-0/source/web2c/pdftex/pdflatex-dev.fmt installed.
fmtutil [ERROR]: not building luajithbtex due to missing engine: luajithbtex
fmtutil [INFO]: disabled formats: 40
fmtutil [INFO]: successfully rebuilt formats: 19
fmtutil [INFO]: failed to build: 1 (luajithbtex/luajithbtex)
fmtutil [INFO]: total formats: 60
fmtutil [INFO]: exiting with status 1
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "fmtutil-sys" arguments: ("--all" "--fmtdir=web2c" "--cnffile=web2c/fmtutil.cnf") exit-status: 1 term-signal: #f stop-signal: #f>
phase `build' failed after 55.3 seconds
command "fmtutil-sys" "--all" "--fmtdir=web2c" "--cnffile=web2c/fmtutil.cnf" failed with status 1
builder for `/gnu/store/n3j2vrlm1vb7hy8wf0afy7qv8yd4dcqb-texlive-latex-base-54632.drv' failed with exit code 1
build of /gnu/store/n3j2vrlm1vb7hy8wf0afy7qv8yd4dcqb-texlive-latex-base-54632.drv failed
--8<---------------cut here---------------end--------------->8---

Previously, we have disabled luajittex because "LuaJIT is not ported to
powerpc64le* yet":

--8<---------------cut here---------------start------------->8---
commit 1a0f4013d33535ed9b8518cfb3ac502f48132fd8
Author: Leo Le Bouter <[email-masked]>
Date:   Mon Feb 8 04:47:03 2021 +0100

    gnu: texlive-latex-base: Fix compilation on powerpc64le*.
    
    * gnu/packages/tex.scm (texlive-latex-base)[arguments]: LuaJIT is not ported to
    powerpc64le* yet. Update replacement 'build phase to add "luajittex" within the
    "disabled-formats" list on powerpc64le*.
    
    Signed-off-by: Chris Marusich <[email-masked]>

commit e9938dc8f0e081e4407a96502a04ea63f07e5a8c
Author: Leo Le Bouter <[email-masked]>
Date:   Mon Feb 8 03:13:53 2021 +0100

    gnu: texlive-bin: Fix compilation on powerpc64le*.
    
    * gnu/packages/tex.scm (texlive-bin)[arguments]: Append "--disable-luajittex"
    and "--disable-mfluajit" to keyword argument "#:configure-flags" on
    powerpc64le* because LuaJIT is not ported to powerpc64le* yet. Also set
    "#:tests?" to "#f" on powerpc64le*.
    
    Signed-off-by: Chris Marusich <[email-masked]>
--8<---------------cut here---------------end--------------->8---

The attached patch fixes the issue.  However, I'm curious about a few
things, so I would welcome any input others might have:

- Is it a problem to disable LuaJIT-related things?  Based on what I've
  found on the Internet, I think it's fine to disable LuaJIT.  It looks
  like luatex and luatexhb are preferred in most cases.  It seems that
  luajittex and luajithbtex alternatives do essentially the same thing
  as their luatex and luahbtex counterparts, but they run Lua using
  LuaJIT (just-in-time compilation capability) instead of the regular
  Lua.  In their "Short report on the state of LuaTEX, 2020", Luigi
  Scarso wrote that luajittex and luajithbtex "should also be considered
  a research tool in digital typesetting" [1].  So I don't think we lose
  much by disabling it, especially if it isn't supported on powerpc64le.

- Will LuaJIT ever support the powerpc64le architecture?  Until it does,
  I guess we can't use LuaJIT on powerpc64le at all, not just for
  TeX-related stuff.

- Is it correct to add "mfluajit" to the disabled-formats list, like I
  do in my patch?  It sounds like "mfluajit" is a related to "metafont",
  but I don't yet really understand what that means.  Is it an engine
  like luajit?  Is it correct to include mfluajit in the list of formats
  to disable in fmtutil.cnf when running fmtutil-sys?  I am totally
  unfamiliar with these tools, so I have no idea.  Perhaps it makes no
  sense to include mfluajit here, even if maybe it is benign to do so.
  If any TeX wizards out there can clarify this for me, I'd be happy to
  adjust the patch as needed.

Footnotes:
[1]  https://www.tug.org/TUGboat/tb41-3/tb129scarso-luatex.pdf

-- 
Chris
From afdcba86e90a784e3857a27dccb1110165bd2ecd Mon Sep 17 00:00:00 2001
From: Chris Marusich <[email-masked]>
Date: Thu, 24 Jun 2021 21:39:39 -0700
Subject: [PATCH] gnu: Disable more LuaJIT components on powerpc64le systems.

* gnu/packages/tex.scm (texlive-bin)[#:configure-flags]: Add
"--disable-luajithbtex" on powerpc64le systems.
(texlive-latex-base)[#:phases][build]: Add "mfluajit" to the disabled-formats
list on powerpc64le systems.
---
 gnu/packages/tex.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 7a78563a75..0362067874 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -338,6 +338,7 @@ files from LOCATIONS with expected checksum HASH.  CODE is not currently in use.
          ,@(if (string-prefix? "powerpc64le" (or (%current-target-system)
                                                  (%current-system)))
                '("--disable-luajittex"
+                 "--disable-luajithbtex"
                  "--disable-mfluajit")
                '()))
 
@@ -2688,10 +2689,11 @@ formats.")
                           "platex-dev eptex" "uplatex-dev euptex"
                           "csplain pdftex" "mf mf-nowin" "mex pdftex" "pdfmex pdftex"
                           "luacsplain luatex" "optex luatex"
+                          ;; LuaJIT is not ported to powerpc64le* yet.
                           ,@(if (string-prefix? "powerpc64le"
                                                 (or (%current-target-system)
                                                     (%current-system)))
-                              '("luajittex") '())
+                              '("luajittex" "luajithbtex" "mfluajit") '())
                           "cont-en xetex" "cont-en pdftex" "pdfcsplain xetex"
                           "pdfcsplain pdftex" "pdfcsplain luatex" "cslatex pdftex"
                           "mptopdf pdftex" "uplatex euptex" "jadetex pdftex"
-- 
2.30.2