lunarmodules / luasql

LuaSQL is a simple interface from Lua to a DBMS.
http://lunarmodules.github.io/luasql
535 stars 192 forks source link

DLL problems with luasql.sqlite3 under Windows 10 Pro x64 #89

Open CheshireCat44 opened 6 years ago

CheshireCat44 commented 6 years ago

===== Short version: Using require("luasql.sqlite3")

on its own doesn't work: [ all PS consoles shown are normal not administrative]

PS C:\Windows\system32> lua
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> require("luasql.sqlite3")
error loading module 'luasql.sqlite3' from file 'c:\puc\lua\lib\lua\5.3\luasql\sqlite3.dll':
        The specified procedure could not be found.

stack traceback:
        [C]: in ?
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: in ?
>

If the same require statement is run from Scite, an error box appears as well as the usual error message:

lua.exe - Entry Point Not Found
The procedure entry point sqlite3_busy_timeout could not be located in the dynamic link library 
C:\puc\lua\lib\lua\5.3\luasql\sqlite3.dll

If lsqlite3 is invoked first, luasql.sqlite3 works:

PS C:\Users\Philip> lua
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
> require("lsqlite3")
table: 02d5e9f8
> require("luasql.sqlite3")
table: 02ba1678
>

The code above also works when invoked from Scite.

Knowing that, luasql.sqlite3 is now usable.

===== Long version: Platform: Windows 10 Pro, x64 Build 16299 Lua 5.3.4 and luarocks 2.4.3 installed using Thijs Schreier's luawinmulti from https://github.com/Tieske/luawinmulti

sqlite3.exe and .dll in C:\sqlite3 and on the PATH

PS C:\WINDOWS\system32> get-command sqlite3.dll -all | select-object -property source, version, @{N='Size';E={(get-item
$_.source).length}} | format-table

Source                 Version    Size
------                 -------    ----
C:\sqlite3\sqlite3.dll 3.21.0.0 852754

PS C:\WINDOWS\system32>

Installed rocks:

PS C:\WINDOWS\system32> luarocks list

Installed rocks:
----------------

lsqlite3
   0.9.4-2 (installed) - c:/puc/zips/luawinmulti-master/../../lua/lib/luarocks/rocks-5.3

lsqlite3complete
   0.9.4-2 (installed) - c:/puc/zips/luawinmulti-master/../../lua/lib/luarocks/rocks-5.3

luafilesystem
   1.7.0-2 (installed) - c:/puc/zips/luawinmulti-master/../../lua/lib/luarocks/rocks-5.3

luasql-sqlite3
   2.3.5-1 (installed) - c:/puc/zips/luawinmulti-master/../../lua/lib/luarocks/rocks-5.3

luaxml
   scm-0 (installed) - c:/puc/zips/luawinmulti-master/../../lua/lib/luarocks/rocks-5.3

PS C:\WINDOWS\system32>

luasql-sqlite3 comes from https://luarocks.org/modules/tomasguisasola/luasql-sqlite3/2.3.5-1

PATH variables are:

PS C:\WINDOWS\system32> $env:path
C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_144\bin;C:\Program Files (x86)\PDFtk\bin\;C:\Program Files\PuTTY\;C:\sqlite3;C:\PUC\lua\bin;C:\PUC\lua\LuaRocks;C:\PUC\cd;C:\PUC\im;C:\PUC\iup;C:\MinGW\bin;C:\Program Files\Git\cmd;C:\Android\android-sdk\tools;C:\Android\android-sdk\platform-tools;C:\Users\Philip\AppData\Local\Microsoft\WindowsApps;C:\tools\mysql\current\bin;C:\Program Files\Oracle\VirtualBox
PS C:\WINDOWS\system32> $env:lua_path_5_3
C:\PUC\lua\LuaRocks\lua\?.lua;C:\PUC\lua\LuaRocks\lua\?\init.lua;C:\puc\lua\share\lua\5.3\?.lua;C:\puc\lua\share\lua\5.3\?\init.lua;;
PS C:\WINDOWS\system32> $env:lua_cpath_5_3
C:\puc\lua\lib\lua\5.3\?.dll;C:\PUC\lua\lib\lua\5.3\?53.dll;;
PS C:\WINDOWS\system32>

As preliminary invocation of lsqlite3 gets round the problem, the short term issue has disappeared. It would, however, be good to know: a) if there is a fault in my setup that can be corrected; b) if something is not working as it should in the installation or execution of luasql.sqlite3.

Advice would be very welcome.

Philip