Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lualatex can't find mysql.so #74

Open
vomus opened this issue Feb 29, 2024 · 4 comments
Open

Lualatex can't find mysql.so #74

vomus opened this issue Feb 29, 2024 · 4 comments

Comments

@vomus
Copy link

vomus commented Feb 29, 2024

Hi!
I just don't seem to be able to get DBI to work from lualatex although it works fine from a plain lua script. This is what I get on the console:

)) (/usr/share/texmf-dist/tex/luatex/luapackageloader/luapackageloader.sty)./DB
I.lua:53: Cannot load driver MySQL. Available drivers are: (None)
stack traceback:
        [C]: in function 'error'
        ./DBI.lua:53: in function 'DBI.Connect'

when there are only two lines of code:

\luadirect{
local DBI = require("DBI")
local dbh = assert(DBI.Connect("MySQL","serge", "serge", "serge", "localhost", 3306))
}

Lualatex stop yelling when I leave only the first line where it just requires DBI, so it seems there is something in DBI.lua it does not like. And that means there is something wrong with function available_drivers()...

@sparked435
Copy link
Collaborator

You are probably missing the MySQL driver. Drivers are typically seperate packages not included with the core DBI module. Look for something like luadbi-mysql, luadbi-dbd-mysql, dbd-mysql or similiar in your package manager.

@vomus
Copy link
Author

vomus commented Mar 1, 2024

Those are in place in /usr/lib64/lua/5.3/dbd/

[serge@yarilo 5.3]$ pwd
/usr/lib64/lua/5.3
[serge@yarilo 5.3]$ ls dbd/
total 72
24 mysql.so  24 postgresql.so  24 sqlite3.so
[serge@yarilo 5.3]$

I can also see that kpsewhich can find it

[serge@yarilo 5.3]$ kpsewhich mysql.so
/usr/lib64/lua/5.3/dbd/mysql.so
[serge@yarilo 5.3]$ kpsewhich DBI.lua
/usr/share/lua/5.3/DBI.lua
[serge@yarilo 5.3]$ 

How is that possible?

@vomus
Copy link
Author

vomus commented Mar 2, 2024

I looked what the correct cpath is

[serge@veles latex]$ lua5.3
Lua 5.3.6  Copyright (C) 1994-2020 Lua.org, PUC-Rio
> package.cpath
/usr/lib64/lua/5.3/?.so;/usr/lib64/lua/5.3/loadall.so;./?.so
> 

changed the code and explicitly told where to look for the drivers:

   \directlua{
     package.cpath = "/usr/lib64/lua/5.3/?.so;/usr/lib64/lua/5.3/loadall.so;./?.so"
     print(package.cpath)
     local DBI = require('DBI')
     local dbh = assert(DBI.Connect("MySQL","serge", "serge", "serge", "localhost", 3306))
   }

it shows the correct paths all right but still can not load the driver:

(/usr/share/texmf-dist/tex/latex/base/ts1cmr.fd)package.cpath:  /usr/lib64/lua/5.3/?;/usr/local/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/loadall.so;./?.so
./DBI.lua:53: Cannot load drive
r MySQL. Available drivers are: (None)
stack traceback:
        [C]: in function 'error'
        ./DBI.lua:53: in function 'DBI.Connect'
        [\directlua]:1: in main chunk.
l.10    }

@sparked435
Copy link
Collaborator

Possibly some other error is occuring and being masked by DBI.lua. From inside Latex, try "require 'dbd.mysql'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants