I am trying to generate and compile LuaLaTeX programmatically in order to generate a report for some numerical analysis program because the end-users cannot (be expected to) install a LaTeX distribution themselves. The target group uses Windows exclusively.
I use Linux. I used mkjobtexmf with the --strace option and recursively resolved all symlinks in order to obtain a portable texmf-tree. In order to test the setup, I generated the following directory layout
root
- texmf: a dump of the generated .mjt texmf-tree
- bin
- win32: contains the lualatex.exe and relevant DLLs as not to throw an error
- report.tex: A test file that should print a string
Loosely following the Github example by Deepak Jois for plain LuaTeX, based on the series of blog posts by Graham Douglas, I set up the texmf.cnf in the web2c directory as
TEXMF=Z:/rhdhv-koploper-tool/src/latex/texmf
WEB2C=$TEXMF/web2c
TEXINPUTS=.:$TEXMF/tex//
TEXFONTMAPS=$TEXMF/fonts/map
TEXFORMATS=$TEXMF/web2c
TFMFONTS=$TEXMF/fonts/tfm//
T1FONTS=$TEXMF/fonts/type1//
ENCFONTS=$TEXMF/fonts/enc
Upon running
bin/win32/lualatex --fmt=texmf/web2c/lualatex.fmt ./report.tex
the following error is thrown:
This is LuaTeX, Version 1.10.0 (TeX Live 2019/W32TeX)
(./report.tex[\directlua]:1: module 'lualatexquotejobname.lua' not found:
no field package.preload['lualatexquotejobname.lua']
[kpse lua searcher] file not found: 'lualatexquotejobname.lua'
[kpse C searcher] file not found: 'lualatexquotejobname.lua'
no file 'Z:\rhdhv-koploper-tool\src\latex\bin\win32\lualatexquotejobname.dll'
no file 'Z:\rhdhv-koploper-tool\src\latex\bin\win32\..\lib\lua\5.3\lualatexquo
tejobname.dll'
no file 'Z:\rhdhv-koploper-tool\src\latex\bin\win32\loadall.dll'
no file '.\lualatexquotejobname.dll'
stack traceback:
[C]: in function 'require'
[\directlua]:1: in main chunk.
<everyjob> \directlua {require("lualatexquotejobname.lua")}
\typeout {\fmtname \space <\fmt
l.1
% This document has been generated automatically by rhdhv-koploper-tool
?
! Emergency stop.
<everyjob> \directlua {require("lualatexquotejobname.lua")}
\typeout {\fmtname \space <\fmt
l.1
% This document has been generated automatically by rhdhv-koploper-tool
275 words of node memory still in use:
1 hlist, 1 dir, 39 glue_spec nodes
avail lists: 2:12,3:1,4:1,5:2
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on report.log.
Attempting to regenerate the .fmt file with
bin/win32/luatex -ini "&lualatex" ./report.tex
reports that lualatex.fmt could not be found. Dumping the contents of texlive\bin\win32\ into root\bin\win32 does not alter anything.
I have stumbled upon "lualatex on Mac module 'lualatexquotejobname.lua' not found error" on SE, which has lead me to believe that this is an issue with inappropriately set environment variables, but has not given me any ideas as to how to resolve this. If I use C:\texlive\bin\win32\lualatex instead, the test file compiles flawlessly, albeit without using the .sty files from the portable texmf-tree. Setting the TEXMFDIST variable with
$Env:TEXMFDIST="Z:\rhdhv-koploper-tool\src\latex\texmf"
leads to the same error.
texmf-dist/tex/latex/latexconfig/lualatexquotejobname.luabut your paths are wrong, or do you not have it? – David Carlisle Apr 05 '20 at 16:41mkjobtexmf. – user169291 Apr 05 '20 at 16:45[kpse lua searcher] file not found: 'lualatexquotejobname.lua'(the later errors are spurious, this one is supposed to have worked, so either the file is not in your lua input path or it is but you have not run mktexlsr or .... – David Carlisle Apr 05 '20 at 16:49TEXMFDISTis set to the appropriate place and changing this intexmf.cnfdoes nothing. I will try to set all relevant environment variables (TEXMF,WEB2C,TEXINPUTS, andTEXFORMATS, right?) in PowerShell and report back. – user169291 Apr 05 '20 at 16:55LUAINPUTSthat was set incorrectly. Now I just have to resolve the other errors that arose from having fixed this. If it is not too much: could you please explain whyLUAINPUTSis not inferred directly from having set theTEXMFand/or dist/local environment variables, as you alluded to in your previous comment? – user169291 Apr 05 '20 at 19:08LUAINPUTS.lualatex = $TEXMFDOTDIR;$TEXMF/scripts/{$progname,$engine,}/{lua,}//;$TEXMF/tex/{lualatex,latex,luatex,generic,}//whereas TEXMFDIST defaults toTEXMFDIST = $TEXMFROOT/texmf-disthere you have reset TEXMFDIST but not TEXMFROOT so LUAINPUTS won't have changed. – David Carlisle Apr 05 '20 at 20:05