LuaLanes and Snow Leopard OSX 10.6

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

LuaLanes and Snow Leopard OSX 10.6

Stefan Marr-2-3
Hi Asko,
Hi list:

I tried to experiment with LuaLanes, but have some problems on my Snow  
Leopard installation.

Every time I try to run one of the test I get an malloc error like this:

lanes-2.0.3$ LUA_CPATH=./src/?.so LUA_PATH="src/?.lua;./tests/?.lua"  
lua tests/recursive.lua
depth: 0 1 2 3 4 5 6 7 8 9 10 11
lua(61739,0x7fff71085be0) malloc: *** error for object 0x1000ad1a0:  
pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug


I tried to use luarocks from MacPorts to install lanes, but there is  
no rock spec. for the latest version, and for the 2.0 version, the  
download is gone, so it just failed installing.

Furthermore, I followed the hints in the README to compile Lua with  
LUA_USE_DLOPEN and LUA_USE_POSIX as well as using a dylib for the core  
and library code, as described.
However, I am still ending up with the error given above.

Any thoughts how this could be fixed?

Many thanks and best regards
Stefan

BTW: On an Ubuntu, it works fine...




--
Stefan Marr
Software Languages Lab
Former Programming Technology Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://prog.vub.ac.be/~smarr
Phone: +32 2 629 3956
Fax:   +32 2 629 3525

Reply | Threaded
Open this post in threaded view
|

Re: LuaLanes and Snow Leopard OSX 10.6

Asko Kauppi

My by-now standard disclaimer to why Lanes via LuaRocks is not working  
(it's actually great, this way I know people tried >:):

<<
I've essentially cleaned away my web sites since Lanes came out. That  
explains the missing links, though does not justify them. Sorry.

I'm not going to change anything, though. People who really need to  
reach me will - as you have.  :)

As to LuaRocks, I only intended to make the rock as a test on how easy/
hard making a rock feels. I did not and do not intend to be  
maintaining the rock as well as the library itself. Rocks, and other  
distributions, require a "second tier" view on the product and in my  
opinion are best done by someone else than the author.
<<

The error you got is indeed the same as I had with Fink Lua (which I'm  
the maintainer of) prior to tuning it for safe multithreading. I'll  
send you the Fink building rules, maybe there is something in there  
that will help.

Thanks for sending the bug report.

-asko



Stefan Marr kirjoitti 5.10.2009 kello 14:03:

> Hi Asko,
> Hi list:
>
> I tried to experiment with LuaLanes, but have some problems on my  
> Snow Leopard installation.
>
> Every time I try to run one of the test I get an malloc error like  
> this:
>
> lanes-2.0.3$ LUA_CPATH=./src/?.so LUA_PATH="src/?.lua;./tests/?.lua"  
> lua tests/recursive.lua
> depth: 0 1 2 3 4 5 6 7 8 9 10 11
> lua(61739,0x7fff71085be0) malloc: *** error for object 0x1000ad1a0:  
> pointer being freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
>
>
> I tried to use luarocks from MacPorts to install lanes, but there is  
> no rock spec. for the latest version, and for the 2.0 version, the  
> download is gone, so it just failed installing.
>
> Furthermore, I followed the hints in the README to compile Lua with  
> LUA_USE_DLOPEN and LUA_USE_POSIX as well as using a dylib for the  
> core and library code, as described.
> However, I am still ending up with the error given above.
>
> Any thoughts how this could be fixed?
>
> Many thanks and best regards
> Stefan
>
> BTW: On an Ubuntu, it works fine...
>
>
>
>
> --
> Stefan Marr
> Software Languages Lab
> Former Programming Technology Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://prog.vub.ac.be/~smarr
> Phone: +32 2 629 3956
> Fax:   +32 2 629 3525
>

Reply | Threaded
Open this post in threaded view
|

Re: LuaLanes and Snow Leopard OSX 10.6

Asko Kauppi
In reply to this post by Stefan Marr-2-3

Your problems should be due to having two separate copies of Lua core  
in the system.  Try to make sure lua the command line executable is  
really dynamically linked to the lua shared library that extension  
modules use.

There may also be other ways to guarantee this singularity of the Lua  
core. If you have two cores and you do multiple threads, OS X gets  
confused like you showed.

For users of Lua via the fink distribution, make sure your package is  
 >= 5.1.1-14. That has the necessary changes. Unstable has a recent  
one but stable still lags behind in 5.1.1-4 or so. Lanes does not work  
fine with that.

- Asko



Stefan Marr kirjoitti 5.10.2009 kello 14:03:

> Hi Asko,
> Hi list:
>
> I tried to experiment with LuaLanes, but have some problems on my  
> Snow Leopard installation.
>
> Every time I try to run one of the test I get an malloc error like  
> this:
>
> lanes-2.0.3$ LUA_CPATH=./src/?.so LUA_PATH="src/?.lua;./tests/?.lua"  
> lua tests/recursive.lua
> depth: 0 1 2 3 4 5 6 7 8 9 10 11
> lua(61739,0x7fff71085be0) malloc: *** error for object 0x1000ad1a0:  
> pointer being freed was not allocated
> *** set a breakpoint in malloc_error_break to debug
>
>
> I tried to use luarocks from MacPorts to install lanes, but there is  
> no rock spec. for the latest version, and for the 2.0 version, the  
> download is gone, so it just failed installing.
>
> Furthermore, I followed the hints in the README to compile Lua with  
> LUA_USE_DLOPEN and LUA_USE_POSIX as well as using a dylib for the  
> core and library code, as described.
> However, I am still ending up with the error given above.
>
> Any thoughts how this could be fixed?
>
> Many thanks and best regards
> Stefan
>
> BTW: On an Ubuntu, it works fine...
>
>
>
>
> --
> Stefan Marr
> Software Languages Lab
> Former Programming Technology Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://prog.vub.ac.be/~smarr
> Phone: +32 2 629 3956
> Fax:   +32 2 629 3525
>

Reply | Threaded
Open this post in threaded view
|

Re: LuaLanes and Snow Leopard OSX 10.6

Stefan Marr-2-3
Hi:

On 05 Oct 2009, at 21:09, Asko Kauppi wrote:
> Your problems should be due to having two separate copies of Lua  
> core in the system.  Try to make sure lua the command line  
> executable is really dynamically linked to the lua shared library  
> that extension modules use.
>
> There may also be other ways to guarantee this singularity of the  
> Lua core. If you have two cores and you do multiple threads, OS X  
> gets confused like you showed.
Well, looks like OS X tries to out-smart me...

After getting ride of all my different lua libs and executables I got  
it work.

I used adapted Makefiles as follows below.

Thanks and best regards
Stefan

=== modified file 'Makefile'
--- Makefile 2009-02-27 15:35:13 +0000
+++ Makefile 2009-10-05 21:59:46 +0000
@@ -43,7 +43,7 @@
  # What to install.
  TO_BIN= lua luac
  TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.5.1.4.dylib
  TO_MAN= lua.1 luac.1

  # Lua version and release.
@@ -64,6 +64,7 @@
  cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
  cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
  cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+ sudo ln -s $(INSTALL_LIB)/liblua.5.1.4.dylib $(INSTALL_LIB)/liblua.
5.1.dylib

  ranlib:
  cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)

=== modified file 'src/Makefile'
--- src/Makefile 2009-02-27 15:35:13 +0000
+++ src/Makefile 2009-10-05 21:44:27 +0000
@@ -22,7 +22,7 @@

  PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris

-LUA_A= liblua.a
+LUA_A= liblua.5.1.4.dylib
  CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o  
lmem.o \
  lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o  \
  lundump.o lvm.o lzio.o
@@ -48,11 +48,17 @@
  a: $(ALL_A)

  $(LUA_A): $(CORE_O) $(LIB_O)
- $(AR) $@ $?
- $(RANLIB) $@
+ $(CC) -dynamiclib -install_name /usr/local/lib/liblua.5.1.dylib \
+ -compatibility_version 5.1 -current_version 5.1.4 \
+ -o liblua.5.1.4.dylib $^

  $(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ $(CC) -fno-common -DLUA_USE_LINUX -lreadline -L. -llua.5.1.4 lua.c -
o lua

  $(LUAC_T): $(LUAC_O) $(LUA_A)
  $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
@@ -99,7 +105,7 @@
  $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline  
-lhistory -lncurses"

  macosx:
- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
+ $(MAKE) all MYCFLAGS="-fno-common -DLUA_USE_LINUX" MYLIBS="-lreadline"
  # use this on Mac OS X 10.3-
  # $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX









>
> For users of Lua via the fink distribution, make sure your package  
> is >= 5.1.1-14. That has the necessary changes. Unstable has a  
> recent one but stable still lags behind in 5.1.1-4 or so. Lanes does  
> not work fine with that.
>
> - Asko
>
>
>
> Stefan Marr kirjoitti 5.10.2009 kello 14:03:
>
>> Hi Asko,
>> Hi list:
>>
>> I tried to experiment with LuaLanes, but have some problems on my  
>> Snow Leopard installation.
>>
>> Every time I try to run one of the test I get an malloc error like  
>> this:
>>
>> lanes-2.0.3$ LUA_CPATH=./src/?.so LUA_PATH="src/?.lua;./
>> tests/?.lua" lua tests/recursive.lua
>> depth: 0 1 2 3 4 5 6 7 8 9 10 11
>> lua(61739,0x7fff71085be0) malloc: *** error for object 0x1000ad1a0:  
>> pointer being freed was not allocated
>> *** set a breakpoint in malloc_error_break to debug
>>
>>
>> I tried to use luarocks from MacPorts to install lanes, but there  
>> is no rock spec. for the latest version, and for the 2.0 version,  
>> the download is gone, so it just failed installing.
>>
>> Furthermore, I followed the hints in the README to compile Lua  
>> with  LUA_USE_DLOPEN and LUA_USE_POSIX as well as using a dylib for  
>> the core and library code, as described.
>> However, I am still ending up with the error given above.
>>
>> Any thoughts how this could be fixed?
>>
>> Many thanks and best regards
>> Stefan
>>
>> BTW: On an Ubuntu, it works fine...
>>
>>
>>
>>
>> --
>> Stefan Marr
>> Software Languages Lab
>> Former Programming Technology Lab
>> Vrije Universiteit Brussel
>> Pleinlaan 2 / B-1050 Brussels / Belgium
>> http://prog.vub.ac.be/~smarr
>> Phone: +32 2 629 3956
>> Fax:   +32 2 629 3525
>>
>

--
Stefan Marr
Software Languages Lab
Former Programming Technology Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://prog.vub.ac.be/~smarr
Phone: +32 2 629 3956
Fax:   +32 2 629 3525

Reply | Threaded
Open this post in threaded view
|

Re: LuaLanes and Snow Leopard OSX 10.6

Asko Kauppi
In reply to this post by Asko Kauppi

The fink Lua packages (lua51 and lua51-dev) are now up-to-date also in  
"stable".

http://pdb.finkproject.org/pdb/package.php/lua51

This means they are good for multithreading.

-asko


Asko Kauppi kirjoitti 5.10.2009 kello 22:09:

>
> Your problems should be due to having two separate copies of Lua  
> core in the system.  Try to make sure lua the command line  
> executable is really dynamically linked to the lua shared library  
> that extension modules use.
>
> There may also be other ways to guarantee this singularity of the  
> Lua core. If you have two cores and you do multiple threads, OS X  
> gets confused like you showed.
>
> For users of Lua via the fink distribution, make sure your package  
> is >= 5.1.1-14. That has the necessary changes. Unstable has a  
> recent one but stable still lags behind in 5.1.1-4 or so. Lanes does  
> not work fine with that.
>
> - Asko
>
>
>
> Stefan Marr kirjoitti 5.10.2009 kello 14:03:
>
>> Hi Asko,
>> Hi list:
>>
>> I tried to experiment with LuaLanes, but have some problems on my  
>> Snow Leopard installation.
>>
>> Every time I try to run one of the test I get an malloc error like  
>> this:
>>
>> lanes-2.0.3$ LUA_CPATH=./src/?.so LUA_PATH="src/?.lua;./
>> tests/?.lua" lua tests/recursive.lua
>> depth: 0 1 2 3 4 5 6 7 8 9 10 11
>> lua(61739,0x7fff71085be0) malloc: *** error for object 0x1000ad1a0:  
>> pointer being freed was not allocated
>> *** set a breakpoint in malloc_error_break to debug
>>
>>
>> I tried to use luarocks from MacPorts to install lanes, but there  
>> is no rock spec. for the latest version, and for the 2.0 version,  
>> the download is gone, so it just failed installing.
>>
>> Furthermore, I followed the hints in the README to compile Lua  
>> with  LUA_USE_DLOPEN and LUA_USE_POSIX as well as using a dylib for  
>> the core and library code, as described.
>> However, I am still ending up with the error given above.
>>
>> Any thoughts how this could be fixed?
>>
>> Many thanks and best regards
>> Stefan
>>
>> BTW: On an Ubuntu, it works fine...
>>
>>
>>
>>
>> --
>> Stefan Marr
>> Software Languages Lab
>> Former Programming Technology Lab
>> Vrije Universiteit Brussel
>> Pleinlaan 2 / B-1050 Brussels / Belgium
>> http://prog.vub.ac.be/~smarr
>> Phone: +32 2 629 3956
>> Fax:   +32 2 629 3525
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: LuaLanes and Snow Leopard OSX 10.6

Hisham Muhammad
In reply to this post by Asko Kauppi
On Mon, Oct 5, 2009 at 4:16 PM, Asko Kauppi <[hidden email]> wrote:

>
> My by-now standard disclaimer to why Lanes via LuaRocks is not working (it's
> actually great, this way I know people tried >:):
>
> <<
> I've essentially cleaned away my web sites since Lanes came out. That
> explains the missing links, though does not justify them. Sorry.
>
> I'm not going to change anything, though. People who really need to reach me
> will - as you have.  :)
>
> As to LuaRocks, I only intended to make the rock as a test on how easy/hard
> making a rock feels. I did not and do not intend to be maintaining the rock
> as well as the library itself. Rocks, and other distributions, require a
> "second tier" view on the product and in my opinion are best done by someone
> else than the author.
> <<
>
> The error you got is indeed the same as I had with Fink Lua (which I'm the
> maintainer of) prior to tuning it for safe multithreading. I'll send you the
> Fink building rules, maybe there is something in there that will help.
>
> Thanks for sending the bug report.

Sorry about the late response -- I updated the Lanes rockspec to
version 2.0.3 (and uploaded a .src.rock file as well, so the
repository is resistant to future URL changes). Tested on Linux --
please let me know if there are any problems on other platforms.

-- Hisham