Consider the following class.cls:
\LoadClass{article}
\RequirePackage{tikz}
and the following test.tex:
\documentclass{class}
\begin{document}
Test
\end{document}
With pdftex (TeXLive 2016), I do:
pdftex -ini -jobname="test-fmt-pdftex" "&pdflatex" mylatexformat.ltx """test.tex"""
pdftex -fmt=test-fmt-pdftex.fmt test.tex
It works with no problem.
With luatex (TeXLive 2016), I do:
luatex -ini -jobname="test-fmt-luatex" "&lualatex" mylatexformat.ltx """test.tex"""
luatex -fmt=test-fmt-luatex.fmt test.tex
The second line ends up with an error:
! error: (pdf backend): referenced object has wrong type others; should be obj ! ==> Fatal error occurred, no output PDF file produced!
I know that I cannot dump in a luatex format lua code or opentype fonts but I think that tikz does not do that. There must be an other reason. Do you have any ideas?
I investigated a bit.
As far as I understand, there has been an updated version of pgfsys-luatex.def to comply with the changes made in luatex related to \pdf... primitives. This is one hint I can think of.
There is also this in the luatex manual:
One change involves the so called xforms and ximages. In pdfTEX these are implemented as so called whatsits. But contrary to other whatsits they have dimensions that need to be taken into account when for instance calculating optimal line breaks. In LuaTEX these are now promoted to normal nodes, which simplifies code that needs those dimensions.
But I must admit I don't really understand all that.
pdftexcmds. Do you no longer think that's true? – cfr Aug 27 '16 at 12:42directluain various places, includingpgfutil-common, which I'm guessing gets loaded bytikzalthough I didn't trace all this through. – cfr Aug 27 '16 at 12:59directluaand the code for TikZ comments that\usepgflibraryis provided bypgfutil-common. So TikZ definitely relies on\directluaand the Lua code it loads. – cfr Aug 27 '16 at 13:02\pgfutil@setuppdfresourcesand\pgfutil@addpdfresource@colorspaces. If you remove these calls your example works. The commands call the code in\pgf@sys@setuppdfresources@plainand this set up pdf objects: disabling the obj in\pgfutil@everybyavoids the error too. I don't know why the similar code doesn't give an error with pdflatex but I would avoid to move the creation of objects to the format with pdflatex too. – Ulrike Fischer Aug 27 '16 at 17:21