Murga-Projects Forums
Adding a Package - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: Adding a Package (/showthread.php?tid=311)


Adding a Package - asafp - 04-01-2008 05:47 AM

I found the lua documentation on adding a package to be confusing. luarocks got me even more confused. Adding mysql support to murgalua on windows turned out to be simple.

Downloaded the binary package http://luaforge.net/frs/download.php/2683/luasql-2.1.1-mysql50-win32-lua51.zip
and extracted the mysql.dll to subdirectory \luasql. I also had to find and download libmysql.dll and put it into my current directory.

Then used

Code:
require("luasql.mysql")


to load the module.

It would be a good idea to include a few examples of this kind of thing in the murgalua documentation. It would also cut down on the number of requests to have additional packages added to the standard murgalua distribution.


RE: Adding a Package - JohnMurga - 04-01-2008 07:22 AM

Hi,

Thanks for the post.

It is funny you should say that ...

I was thinking about this as I put the finishing touches on 0.6.8 (which justifies a higher version number).

0.6.8 includes the "luacom" module for Windows with examplea of this kind of use of an external module.

And I'll push the Wiki out this week to allow people put up such examples.

Cheers
John de Murga


RE: Adding a Package - asafp - 04-01-2008 08:43 AM

Thanks John. One of the nice things about PuppyLinux is how people can easily package their own flavor. It'd be really cool if there was a murgalua installer program that would ask a few simple questions then fetch what's needed, unzip it and put it all in the right place.


RE: Adding a Package - mikshaw - 04-01-2008 11:04 AM

Unfortunately such a feature would probably be useful only to Windows users. I have yet to find a precompiled Lua module for Linux (at least one that would work for a decent number of distros...not just the one for which it was compiled).


RE: Adding a Package - asafp - 04-01-2008 01:21 PM

Sometimes I wonder why people use Windows when Linux is free and has to some degree all of the same features. Then someone like mikshaw comes along and straightens me out.

The lua all in one project (luaaio) would seem to have some synergies with a murgalua packaging project. They recently released their first linux package which has mysql.so and a bunch of other xxxxx.so modules. I guess you'd still need to make sure there is a compatible libmysql.so.xx.


RE: Adding a Package - briss - 09-03-2008 05:35 PM

Quote:
Adding mysql support to murgalua on windows turned out to be simple.

Downloaded the binary package and extracted the mysql.dll to subdirectory \luasql. I also had to find and download libmysql.dll and put it into my current directory.

Then used require("luasql.mysql")

to load the module


trying this with murgalua v 0.6.4 on my winXP PC, i also had to put lua5.1.dll and msvcr80.dll in the bin directory. the first lua5.1.dll downloaded was not the good one and launching lua script with require("luasql.mysql") gave me the error message here attached. using lua5.1.dll and msvcr80.dll from luabinaries solved this problem:
lua binaries


RE: Adding a Package - asafp - 10-16-2008 03:44 AM

briss Wrote:

Quote:
Adding mysql support to murgalua on windows turned out to be simple.

Downloaded the binary package and extracted the mysql.dll to subdirectory \luasql. I also had to find and download libmysql.dll and put it into my current directory.

Then used require("luasql.mysql")

to load the module


trying this with murgalua v 0.6.4 on my winXP PC, i also had to put lua5.1.dll and msvcr80.dll in the bin directory. the first lua5.1.dll downloaded was not the good one and launching lua script with require("luasql.mysql") gave me the error message here attached. using lua5.1.dll and msvcr80.dll from luabinaries solved this problem:
lua binaries


I am getting this same error. I believe I had luasql working correctly with murgalua prior to installing the latest 0.6.8 murgalua. I've got lua5.1.dll and msvcr80.dll out there.


RE: Adding a Package - art - 11-21-2008 10:38 AM

I think you just copy lua5.1.dll in your directory without msvcr80.dll,
But make sure lua5.1.dll from lua-5.1.2 version.

It work with any murgaLua version, but i don't know why if i have more than one callback, example in button1 and button2 both have callback, causing problem (error in murgaLua.exe).

This is my script and error message in attachment, test.lua=
=====================================================
require "luasql.mysql"

function connection()
env = assert(luasql.mysql())
con = assert(env:connect ("mydb","root","superuseradmin","localhost","3306"))
str = "select 1 from dual"
q = assert(con:execute (str))
num = q:numrows()
msg:label(num)
q:close()
con:close()
env:close()
end

window = fltk:Fl_Double_Window(100, 100, 800, 600, "Test")
button1 = fltk:Fl_Button(10, 10, 150, 25, "Test Connection")
button1:callback(connection) -- <= callback 1
msg = fltk:Fl_Box(20, 10, 600, 25)
button2 = fltk:Fl_Button(10, 40, 150, 25, "Test Connection2")
button2:callback(connection) -- <= callback 2 cause error, if i remove this callback not causing error

window:show()
Fl:scheme("plastic")
Fl:run()
=====================================================

JohnM or everyone can help?


RE: Adding a Package - mikshaw - 11-24-2008 02:25 AM

The screenshot is just a generic Windows error message and isn't very useful in diagnosing the specific trouble. The error report could have been more useful. If not, try running the application from within a cmd window and look at the output.

There should not be an issue with assigning the same callback to two different buttons. The only thing I can think of at the moment is that maybe you tested by pressing button1 and then pressing button2 while the callback was still running. That might cause a problem trying to open a file that is already opened. If button1 by itself works, button2 by itself should too.

I don't know diddly about the assert fuction, so for all know that might have something to do with it too.


RE: Adding a Package - asafp - 11-25-2008 07:31 AM

I had a bitch of a time getting mysql to work with murgaLua. Scrounging around the internet, I finally found a DLL that seems to work. It dates back to early in 2006. You can download it here http://asafp.com/luamysql.dll

On Linux, I'm getting the following message:

error loading module 'mysql' from file './mysql.so':
./mysql.so: undefined symbol: lua_pushnil


RE: Adding a Package - Juergen - 11-25-2008 09:00 AM

Quote:
error loading module 'mysql' from file './mysql.so':
./mysql.so: undefined symbol: lua_pushnil

Did you link it explicitly against liblua? You can also try to preload the lua library.

But I guess it would be a better idea to use a maintained binding like LuaSQL

Juergen


RE: Adding a Package - asafp - 11-25-2008 09:33 AM

mysql.so is part of the luasql package. I got the binary from the precompiled LuaAIO package. It works ok if I use the lua command interpreter that comes with LuaAIO, but doesn't work with 0.6.8 murgaLua.


RE: Adding a Package - Juergen - 11-25-2008 09:54 AM

Did you copy the lua51.dll (or whatever it is named) from luaAIO into the directory where your luamysql.dll resides?

Juergen


RE: Adding a Package - asafp - 11-25-2008 11:22 AM

I ran murgaLua from a directory containing all the LuaAIO .so files including lua.so and liblua5.1.so

When I run murgaLua and require'something'

I get a message like

./mysql.so: undefined symbol: lua_pushnil
./rexlib.so: undefined symbol: lua_getfield
./lxp.so: undefined symbol: lua_newuserdata