Windows / Lua packages

Post Reply
Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Windows / Lua packages

Post by Nyyrazzilyss »

I'm trying to get the required lua packages to install on Windows 10. While I poke at it and try figuring out where i'm erroring out, i've included the messages i'm getting from attempted install of the various packages (following the win7 compile instructions). Among other things, it appears that it's attempting to use msvc lib files, rather then the mingw generated files. Anything obvious stand out? I do recall comments about LuaZip in the other thread, I haven't really looked at that yet (mostly been trying to get sqlite3 to link properly)

Results:

Installed LuaRocks 2.0.12 (win32)

luarocks install LuaFileSystem

luafilesystem 1.6.3-2 is now built and installed in c:\LuaRocks/ (license: MIT/X11)

luarocks install LuaZip

Error: Could not find expected file zzip.h, or zzip.h for ZZIP -- you may have to install
ZZIP in your system and/or pass ZZIP_DIR or ZZIP_INCDIR to the luarocks command.
Example: luarocks install luazip ZZIP_DIR=/usr/local

luarocks install LuaSQL-SQLite3 SQLITE_INCDIR="c:\mingw32\include"

gcc -shared -o luasql/sqlite3.dll src/luasql.o src/ls_sqlite3.o -Lc:/external/lib sqlite3.lib c:/LuaRocks/2.0/lua5.1.lib -lmsvcr80
gcc: error: sqlite3.lib: No such file or directory
cp: cannot stat `luasql/sqlite3.dll': No such file or directory

Error: Build error: Failed installing luasql/sqlite3.dll in c:\LuaRocks/lib/luarocks/rocks/luasql-sqlite3/2.3.0-1/lib/luasql

Directory of C:\mingw32\lib

04/15/2016 10:42 PM 5,125,522 libsqlite3.a
04/15/2016 10:42 PM 149,648 libsqlite3.dll.a
04/15/2016 10:42 PM 912 libsqlite3.la

luarocks install lrexlib-pcre PCRE_LIBDIR="c:\mingw32\lib" PCRE_INCDIR="c:\mingw32\include"

Error: Could not find expected file pcre.lib, or pcre.dll, or libpcre.dll for PCRE -- you may have to install PCRE in your system and/or pass PCRE_DIR or PCRE_LIBDIR to the luarocks command. Example: luarocks install lrexlib-pcre PCRE_DIR=/usr/local

Directory of C:\mingw32\lib

04/15/2016 01:57 PM 394,716 libpcre.a
04/15/2016 01:57 PM 28,188 libpcre.dll.a
04/15/2016 01:57 PM 898 libpcre.la
04/15/2016 01:57 PM 36,066 libpcrecpp.a
04/15/2016 01:57 PM 67,630 libpcrecpp.dll.a
04/15/2016 01:57 PM 939 libpcrecpp.la
04/15/2016 01:57 PM 11,624 libpcreposix.a
04/15/2016 01:57 PM 3,238 libpcreposix.dll.a
04/15/2016 01:57 PM 949 libpcreposix.la

(edit)

Switched to luarocks-2.3.0-win32

install.bat /F /L /P c:\LuaRocks /MW

Edited lua.cfg changing minw32-gcc to gcc

luarocks install LuaFileSystem
luafilesystem 1.6.3-2 is now built and installed in c:\LuaRocks\systree (license: MIT/X11)

luarocks install LuaSQL-SQLite3 SQLITE_INCDIR="c:\mingw32\include"
luasql-sqlite3 2.3.0-1 is now built and installed in c:\LuaRocks\systree (license: MIT/X11)

luarocks install lrexlib-pcre PCRE_LIBDIR="c:\mingw32\lib" PCRE_INCDIR="c:\mingw32\include"
lrexlib-pcre 2.8.0-1 is now built and installed in c:\LuaRocks\systree (license: MIT/X11)

luarocks install LuaZip
-- still erroring, i've seen mention about that previously i'll take a look

They are building, though loading them is another issue -

[ ERROR ] - Cannot find Lua module rex_pcre.
Some functions may not be available.
Lua error:error loading module 'rex_pcre' from file '.\rex_pcre.dll':
The specified module could not be found.
[ ERROR ] - Cannot find Lua module zip.
Lua error:[string "require "zip""]:1: module 'zip' not found:
no field package.preload['zip']
no file '.\zip.lua'
no file 'C:\release\lua\zip.lua'
no file 'C:\release\lua\zip\init.lua'
no file 'C:\release\zip.lua'
no file 'C:\release\zip\init.lua'
no file '.\zip.dll'
no file 'C:\release\zip.dll'
no file 'C:\release\loadall.dll'
[ ERROR ] - Cannot find Lua module lfs (Lua File System).
Probably will not be able to access Mudlet Lua code.
Lua error:error loading module 'lfs' from file '.\lfs.dll':
The specified module could not be found.
[ ERROR ] - Cannot find Lua module luasql.sqlite3.
Database support will not be available.
Lua error:error loading module 'luasql.sqlite3' from file '.\luasql\sqlite3.dll':
The specified module could not be found.
[ ERROR ] - LuaGlobal.lua compile error - please report!
Error from Lua: cannot open /LuaGlobal.lua: No such file or directory

I'm re-reading an older post about Win7 compilation where various people were having issues with lua/versions.
http://forums.mudlet.org/viewtopic.php?f=7&t=3556

Judging from the below message when luarocks installs, i'm likely having issues with it recognizing 5.1.5

Could not find Lua. Will install its own copy.

(edit2)

Luarocks is looking for lua51.dll, which the lua 5.1.5 Makefile wasn't creating. I changed TO_LIB to create it

TO_LIB= liblua.a lua51.dll

The file was created now in /mingw32/lib, and a binary compare against the version shipped with Mudlet only had a 10 byte difference (filesize however was indentical).

Luarocks however would crash on install attempt, I needed to add c:\mingw32\lib into path. It now installed successfully, and I rebuilt everything (except LuaZip, which I really haven't looked at yet)

I've recompiled/rebuilt everything, but now when I attempt to connect to a profile mudlet crashes :(

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Windows / Lua packages

Post by Nyyrazzilyss »

I wiped out everything, and reinstalled from ground up making sure I didn't have anything extra left behind/installed (Especially multiple versions of lua!). Getting there!

Error locating Lua files from LuaGlobal - we're looking from 'C:\release'.
[ OK ] - Lua module rex_pcre loaded.
[ ERROR ] - Cannot find Lua module zip.
Lua error:[string "require "zip""]:1: module 'zip' not found:
no field package.preload['zip']
no file '.\zip.lua'
no file 'C:\release\lua\zip.lua'
no file 'C:\release\lua\zip\init.lua'
no file 'C:\release\zip.lua'
no file 'C:\release\zip\init.lua'
no file '.\zip.dll'
no file 'C:\release\zip.dll'
no file 'C:\release\loadall.dll'
[ OK ] - Lua module lfs loaded
[ OK ] - Lua module sqlite3 loaded
[ OK ] - Mudlet-lua API & Geyser Layout manager loaded.

Now time to address the luazip thing

(edit 2)

Got zzip to compile following the below instructions - Installing LuaZip still not quite working.

http://itsacleanmachine.blogspot.ca/201 ... mingw.html

(edit 3) :(

luarocks install LuaZip ZZIP_DIR="c:\mingw32"

gcc -O2 -c -o src/luazip.o -IC:/mingw32/include/ src/luazip.c -Ic:\mingw32/include
gcc -shared -o zip.dll src/luazip.o -Lc:\mingw32/lib -lzzip C:/mingw32/lib/lua51.dll -lm
c:\mingw32/lib/libzzip.a(file.o):file.c:(.text+0x22b): undefined reference to `inflateEnd'
c:\mingw32/lib/libzzip.a(file.o):file.c:(.text+0x5ac): undefined reference to `inflateInit2_'
c:\mingw32/lib/libzzip.a(file.o):file.c:(.text+0x771): undefined reference to `inflate'
c:\mingw32/lib/libzzip.a(file.o):file.c:(.text+0xfc7): undefined reference to `inflateReset'
c:/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.1/../../../../i686-w64-mingw32/bin/ld.exe: c:\mingw32/lib/libzzip.a(file.o): bad reloc address 0xc in section `.rdata'
collect2.exe: error: ld returned 1 exit status

Error: Build error: Failed compiling module zip.dll

dicene
Posts: 47
Joined: Thu Sep 25, 2014 7:36 am

Re: Windows / Lua packages

Post by dicene »

Me too. :?:

Image


edit 1: Also, to the person that was having issues with their mudlet just crashing without telling you why, if your OS has an event viewer, see if you can find anything out from that? On Win10 I can open the start menu and search for event viewer, open that program, and looking in the following place, I was able to see that mudlet.exe was crashing due to something in lua51.dll, although i couldn't get any more information than that. I don't have the same crash pulled up, but this is close to what it looked like, except line P4: said lua51.dll or something.

Image

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Windows / Lua packages

Post by Nyyrazzilyss »

I did a search on the errors we're getting, and it appears to be from zlib (-lz) not being linked. Not sure how i'll force that, though (i'm not really familiar with luarocks)

Still not linking properly (on windows) but I found a somewhat more recent copy of the LuaZip source code at https://github.com/rjpcomputing/luazip

Searching the forum here, i'm not really finding much other then people having difficulties with building it (LuaZip), and old talk of replacing it with a different package that is easy to assemble in windows. There's more then a few threads where it looks like people reached LuaZip (in Windows) and gave up. In my 'trinity' of bugs I was concerned with, one of them had to do with the lack of error message when running into problems unzipping/installing packages. Would LuaZip also be where the lack of error messages was coming from? If so - LuaZip seems to be an abandoned package. Why not fork it into mudlet? Or perhaps revisit the idea of replacing it with QuaZip (on Windows, at least)

https://bugs.launchpad.net/mudlet/+bug/1090112

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Windows / Lua packages

Post by Nyyrazzilyss »

Oh just as an aside - Not really directly related, however after retrieving all the individual source packages - A much easier way to untar all of them in the directory at once is

for a in `ls -1 *.tar.gz`; do tar -zxvf $a; done

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Windows / Lua packages

Post by SlySven »

No, the lack of runtime error messages in handling zip files is less than perfect coding in the C++ (to a C libzip library).

One thing about those zip error messages might be the version of libzip - the current code is using some calls to that library that are now obsoleted (in the 1.x versions) whereas they were correct in the 0.10-0.12 that was current up to around 18 months ago - if people or their system install the latest version I wonder whether there will be issues in the future when/if they get to a 2.x and complete remove some obsolete calls...

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Windows / Lua packages

Post by Nyyrazzilyss »

Woot! I got LuaZip to compile/load successfully in Mudlet! I'll probably have to redo for exact instructions, however -

I downloaded/extracted LuaZip from the above rjpcomputing link.

The commands to build the dll (from inside the luazip-master directory) were

gcc -O2 -c -o src/luazip.o -IC:/mingw32/include/ src/luazip.c -Ic:\mingw32\include
gcc -shared -o zip.dll src/luazip.o -Lc:\mingw32\lib -lzzip -lz c:\mingw32\lib\lua51.dll -lm

This created a zip.dll file that worked successfully when I copied it to my release directory :) It worked, though also looks like i'm including \mingw32\include twice

Almost there... Just need to figure out the LuaGlobal thing now.

Error locating Lua files from LuaGlobal - we're looking from 'C:\release'.
[ OK ] - Lua module rex_pcre loaded.
[ OK ] - Lua module zip loaded.
[ OK ] - Lua module lfs loaded
[ OK ] - Lua module sqlite3 loaded
[ OK ] - Mudlet-lua API & Geyser Layout manager loaded.
[ INFO ] - Looking up the IP address of server:torilmud.com:9999 ...
[ INFO ] - The IP address of torilmud.com has been found. It is: 104.236.2.214
[ INFO ] - Trying to connect to 104.236.2.214:9999 ...
[ INFO ] - A connection has been established successfully.

(edit)

It looks like the LuaGlobal.lua I placed in the home directory (c:\release) isn't being loaded. The one located in mudlet-lua\lua however is.

(edit 2)

I was using the wrong mudlet-lua folder. I copied it over again, and everything is working properly.

I'm currently running a full compile of the recent posting of the new mapping structure, with an extremely large custom lua package. Everything appears to be working properly/no errors/etc, i'll leave it running overnight.

Post Reply