mysql - LuaLaTeX with LuaSQL on Archlinux -
i working on lualatex file take data database using luasql. 003-v1.tex , 003-v1.lua files came with:
003-v1.tex file:
\documentclass{article} \usepackage{luacode} % lua kodo vpišemo v ločeno datoteko zaradi syntax highlithing \directlua{dofile('003-v1.lua')} \newcommand{\stranke}{\luadirect{stranke()}} \begin{document} \begin{tabular}{ll} \hline id stranke & ime \\ \hline \stranke \hline \end{tabular} \end{document} 003-v1.lua file:
function stranke () package.cpath = package.cpath .. ";/usr/lib/i386-linux-gnu/lua/5.1/?.so" luasql = require "luasql.mysql" env = assert (luasql.mysql()) con = assert (env:connect("linux_krozki","root","mypassword")) cur = assert (con:execute("select * stranke")) vnos = cur:fetch ({}, "a") while vnos print( string.format([[%s & %s \\]], vnos.id_stranke, vnos.ime) ) vnos = cur:fetch (vnos, "a") end end this files ought work when try compile using lualatex 003-v1.tex error:
this luatex, version 1.0.4 (tex live 2017/arch linux) restricted system commands enabled. (./003-v1.tex latex2e <2017-04-15> (using write cache: /home/ziga/.texlive/texmf-var/luatex-cache/generic)(using r ead cache: /var/lib/texmf/luatex-cache/generic /home/ziga/.texlive/texmf-var/lu atex-cache/generic) luaotfload | main : initialization completed in 0.144 seconds babel <3.12> , hyphenation patterns 1 language(s) loaded. (/usr/share/texmf-dist/tex/latex/base/article.cls document class: article 2014/09/29 v1.4h standard latex document class (/usr/share/texmf-dist/tex/latex/base/size10.clo(load luc: /home/ziga/.texlive/ texmf-var/luatex-cache/generic/fonts/otl/lmroman10-regular.luc))) (/usr/share/texmf-dist/tex/lualatex/luacode/luacode.sty (/usr/share/texmf-dist/tex/generic/oberdiek/ifluatex.sty) (/usr/share/texmf-dist/tex/luatex/luatexbase/luatexbase.sty (/usr/share/texmf-dist/tex/luatex/ctablestack/ctablestack.sty))) (./003-v1.aux) 003-v1.lua:8: module 'luasql.mysql' not found: no field package.preload['luasql.mysql'] [kpse lua searcher] file not found: 'luasql.mysql' [kpse c searcher] file not found: 'luasql.mysql' no file '/usr/local/lib/lua/5.2/luasql.so' no file '/usr/local/lib/lua/5.2/loadall.so' no file './luasql.so' no file '/usr/lib/i386-linux-gnu/lua/5.1/luasql.so' stack traceback: [c]: in function 'require' 003-v1.lua:8: in function 'stranke' [\directlua]:1: in main chunk. \luadirect ... { \luacode@maybe@printdbg {#1} #1 } l.14 \stranke and according this topic error arrizes because lualatex can't load module luasql.mysql while lua can on own. how know this? if comment out first line (function stranke ()) , last line (end) 003-v1.lua before compiling lua 003-v1.lua output fine:
1 & Žiga \\ 2 & ranja \\ 3 & romana \\ so question is, how make sure module luasql.mysql loads when lualatex called? on archlinux , using texlive. heard people compile texlive again support luasql, can't find step step guide... awesome! better if there compiled it.
here info texlive version:
[ziga@laptop ~]$ pacman -qs tex | grep live local/texlive-bibtexextra 2017.44915-1 (texlive-most) local/texlive-bin 2017.44590-2 local/texlive-core 2017.44918-1 (texlive-most) local/texlive-fontsextra 2017.44818-1 (texlive-most) local/texlive-formatsextra 2017.44177-2 (texlive-most) local/texlive-games 2017.44131-1 (texlive-most) local/texlive-humanities 2017.44833-1 (texlive-most) local/texlive-langchinese 2017.44333-1 (texlive-lang) local/texlive-langcyrillic 2017.44895-1 (texlive-lang) local/texlive-langextra 2017.44908-1 (texlive-lang) local/texlive-langgreek 2017.44917-1 (texlive-lang) local/texlive-langjapanese 2017.44914-1 (texlive-lang) local/texlive-langkorean 2017.44467-1 (texlive-lang) local/texlive-latexextra 2017.44907-1 (texlive-most) local/texlive-music 2017.44885-1 (texlive-most) local/texlive-pictures 2017.44899-1 (texlive-most) local/texlive-pstricks 2017.44742-1 (texlive-most) local/texlive-publishers 2017.44916-1 (texlive-most) local/texlive-science 2017.44906-1 (texlive-most)
we found answer on archlinux forums after thread posted. looks there internal problems lua language - package.cpath wasn't able reckognize questionmark, ?.so had changed mysql.so. can explain why happened?
Comments
Post a Comment