ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* require("module.so") on cygwin
@ 2010-07-15  8:49 Peter Münster
  2010-07-15  9:04 ` luigi scarso
  2010-07-15 11:01 ` Taco Hoekwater
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Münster @ 2010-07-15  8:49 UTC (permalink / raw)
  To: ConTeXt list

Hello,

How can I load a lua-lib in cygwin?

Example:

file test.tex:

\startluacode
  package.cpath = "?.so"
  require("testmod")
\stopluacode
\starttext
bla
\stoptext


file testmod.c:

#include "lua.h"
#include "lauxlib.h"
static int l_test(lua_State *L)
{
		int n = luaL_checknumber(L, 1) * 100;
		lua_pushnumber(L, n);
		return 1;
}
static const struct luaL_Reg mylib[] = {{"test100", l_test}, {NULL, NULL}};
int luaopen_testmod(lua_State *L)
{
		luaL_register(L, "testmod", mylib);
		return 1;
}

file testmod.so generated under cygwin with:
gcc -shared -o testmod.so testmod.c /usr/lib/liblua.dll.a


The problem:

"context test" hanges after "language en is active".

TIA for any help!
Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: require("module.so") on cygwin
  2010-07-15  8:49 require("module.so") on cygwin Peter Münster
@ 2010-07-15  9:04 ` luigi scarso
  2010-07-15 10:11   ` Peter Münster
  2010-07-15 11:01 ` Taco Hoekwater
  1 sibling, 1 reply; 8+ messages in thread
From: luigi scarso @ 2010-07-15  9:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1731 bytes --]

On Thu, Jul 15, 2010 at 10:49 AM, Peter Münster <pmlists@free.fr> wrote:

> Hello,
>
> How can I load a lua-lib in cygwin?
>
> Example:
>
> file test.tex:
>
> \startluacode
>  package.cpath = "?.so"
>  require("testmod")
> \stopluacode
> \starttext
> bla
> \stoptext
>
>
> file testmod.c:
>
> #include "lua.h"
> #include "lauxlib.h"
> static int l_test(lua_State *L)
> {
>                int n = luaL_checknumber(L, 1) * 100;
>                lua_pushnumber(L, n);
>                return 1;
> }
> static const struct luaL_Reg mylib[] = {{"test100", l_test}, {NULL, NULL}};
> int luaopen_testmod(lua_State *L)
> {
>                luaL_register(L, "testmod", mylib);
>                return 1;
> }
>
> file testmod.so generated under cygwin with:
> gcc -shared -o testmod.so testmod.c /usr/lib/liblua.dll.a
>
>
> The problem:
>
> "context test" hanges after "language en is active".
>
> TIA for any help!
> Cheers, Peter
>
> --
> Contact information: http://pmrb.free.fr/contact/
>
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>

I dont't have the answer , but
what is the message ?


1) Why don't you use mingw (luatex is compiled with mingw)?

2) Does it work under Linux ?


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 2696 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: require("module.so") on cygwin
  2010-07-15  9:04 ` luigi scarso
@ 2010-07-15 10:11   ` Peter Münster
  2010-07-15 10:41     ` Taco Hoekwater
  2010-07-15 11:00     ` Peter Münster
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Münster @ 2010-07-15 10:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Jul 15 2010, luigi scarso wrote:

> I dont't have the answer , but
> what is the message ?

Hello Luigi,

There is no message, luatex just hangs... (no cpu usage).


> 1) Why don't you use mingw (luatex is compiled with mingw)?

I switched from mingw to cygwin some time ago for several reasons.
The one I remember: a lot of packages are easily available for cygwin but not
for mingw.


> 2) Does it work under Linux ?

Yes.


New results:

I've built luatex under cygwin and replaced luatex.exe in my windows
installation. Now it creates a pdf, but there is a stack-dump in the end:

mkiv luv stats : runtime                   - 41.469 seconds, 1 processed
pages, 1 shipped pages, 0.024 pages/second
      3 [sig] luatex 3940 open_stackdumpfile: Dumping stack trace to
	  luatex.exe.stackdump

MTXrun | fatal error: return code: 34304


This is file luatex.exe.stackdump:

Stack trace:
Frame     Function  Args
0022C828  7C802542  (00000600, 0000EA60, 000000A4, 0022C91C)
0022C938  610C26D3  (00000000, 7C802600, 7C802542, 00000000)
0022CA18  610BF387  (00000000, 00000000, 00000000, 00000000)
0022CA68  610BF79B  (00000F64, 0022CA90, 0022CA78, 67F0A00C)
0022CB28  610BF8C1  (00000F64, 00000006, 0022CB58, 610BF965)
0022CB38  610BF8FC  (00000006, 0022CE80, 00000000, 00000000)
0022CB58  610BF965  (67F0A00C, 00000000, 6115B10C, 006BB4D8)
0022CB78  67F05531  (00810000, 67F05550, 0022CB98, 61004C69)
0022CB88  00401119  (00000000, 00000001, 0022CBC8, 6113AEE7)
0022CB98  61004C69  (6115DD10, 00000000, 00000000, 00000000)
0022CBC8  6113AEE7  (00000000, 00000000, 0022CBF8, 0042FB36)
0022CBE8  61112E0A  (00000000, 00E47588, 0022CC08, 610BC8B6)
0022CBF8  61004EA1  (00000000, 00000000, 0022CC18, 0042E6D1)
0022CC08  610BC8B6  (00000000, 00E47588, 0022CC38, 00401934)
0022CC18  0042E6D1  (00000005, 00E47588, 0022CC48, 0022CC50)
0022CC38  00401934  (0022CC73, 6116CFFF, 0022CD98, 61006E73)
End of stack trace (more stack frames may be present)


Here a new example file for easy testing:

\startbuffer[testmod.c]
#include "lua.h"
#include "lauxlib.h"
static int l_test(lua_State *L)
{
		int n = luaL_checknumber(L, 1) * 100;
		lua_pushnumber(L, n);
		return 1;
}
static const struct luaL_Reg mylib[] = {{"test100", l_test}, {NULL, NULL}};
int luaopen_testmod(lua_State *L)
{
		luaL_register(L, "testmod", mylib);
		return 1;
}
\stopbuffer
\startbuffer[Makefile]
testmod.so: testmod.c
			gcc -shared -o $@ $< /usr/lib/liblua.dll.a
\stopbuffer
\savebuffer[testmod.c][testmod.c]
\savebuffer[Makefile][Makefile]
\executesystemcommand{make testmod.so}
\startluacode
package.cpath = "?.so"
require("testmod")
\stopluacode
\starttext
bla
\stoptext

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: require("module.so") on cygwin
  2010-07-15 10:11   ` Peter Münster
@ 2010-07-15 10:41     ` Taco Hoekwater
  2010-07-15 10:52       ` Peter Münster
  2010-07-15 11:00     ` Peter Münster
  1 sibling, 1 reply; 8+ messages in thread
From: Taco Hoekwater @ 2010-07-15 10:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users



Peter Münster wrote:
> On Thu, Jul 15 2010, luigi scarso wrote:
> 
>> I dont't have the answer , but
>> what is the message ?
> 
> Hello Luigi,
> 
> There is no message, luatex just hangs... (no cpu usage).

You could try with just a lua file, without the context wrapper:


  package.cpath = "?.so"
  require("testmod")
  print (testmod.test100(10))

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: require("module.so") on cygwin
  2010-07-15 10:41     ` Taco Hoekwater
@ 2010-07-15 10:52       ` Peter Münster
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Münster @ 2010-07-15 10:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Jul 15 2010, Taco Hoekwater wrote:
> 
> Peter Münster wrote:
> > On Thu, Jul 15 2010, luigi scarso wrote:
> > 
> >> I dont't have the answer , but
> >> what is the message ?
> > 
> > Hello Luigi,
> > 
> > There is no message, luatex just hangs... (no cpu usage).
> 
> You could try with just a lua file, without the context wrapper:
> 
> 
>   package.cpath = "?.so"
>   require("testmod")
>   print (testmod.test100(10))

"luatex test.lua" hangs too: no output.

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: require("module.so") on cygwin
  2010-07-15 10:11   ` Peter Münster
  2010-07-15 10:41     ` Taco Hoekwater
@ 2010-07-15 11:00     ` Peter Münster
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Münster @ 2010-07-15 11:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Jul 15 2010, Peter Münster wrote:

> New results:
> 
> I've built luatex under cygwin and replaced luatex.exe in my windows
> installation. Now it creates a pdf, but there is a stack-dump in the end:
> 
> mkiv luv stats : runtime                   - 41.469 seconds, 1 processed
> pages, 1 shipped pages, 0.024 pages/second
>       3 [sig] luatex 3940 open_stackdumpfile: Dumping stack trace to
> 	  luatex.exe.stackdump
> 
> MTXrun | fatal error: return code: 34304


Ok, the problem was, that I compiled the trunk-version...

Now I've tried version 0.60.2, and there is no more problem! :)))


So, when I'll have some time, I could update build-binaries/bin_build.sh
and first-setup.sh to support cygwin.

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: require("module.so") on cygwin
  2010-07-15  8:49 require("module.so") on cygwin Peter Münster
  2010-07-15  9:04 ` luigi scarso
@ 2010-07-15 11:01 ` Taco Hoekwater
  2010-07-15 11:18   ` Peter Münster
  1 sibling, 1 reply; 8+ messages in thread
From: Taco Hoekwater @ 2010-07-15 11:01 UTC (permalink / raw)
  To: ConTeXt list

Hi,

Peter Münster wrote:
> 
> file testmod.so generated under cygwin with:
> gcc -shared -o testmod.so testmod.c /usr/lib/liblua.dll.a

On Linux, the .so does not need a liblua dependency.
The test works fine with just

  gcc -shared -o testmod.so testmod.c

I tried to reproduce what you did in mingw32-cross + wine,
and that worked as well (but with .dll instead of .so).

I have no idea what is wrong with cygwin, and no way to test it.


Best wishes,
Taco
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: require("module.so") on cygwin
  2010-07-15 11:01 ` Taco Hoekwater
@ 2010-07-15 11:18   ` Peter Münster
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Münster @ 2010-07-15 11:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Jul 15 2010, Taco Hoekwater wrote:

> > gcc -shared -o testmod.so testmod.c /usr/lib/liblua.dll.a
> 
> On Linux, the .so does not need a liblua dependency.

Indeed, I only need it on cygwin.


> The test works fine with just
> 
>   gcc -shared -o testmod.so testmod.c
> 
> I tried to reproduce what you did in mingw32-cross + wine,
> and that worked as well (but with .dll instead of .so).
> 
> I have no idea what is wrong with cygwin, and no way to test it.

I suppose, that the testmod.so has some dependency on cygwin libraries, and
this causes trouble because luatex is not cygwin aware.

But see my other message for the solution: luatex compiles without problems
under cygwin.

Thanks for your efforts!
Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-15 11:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-15  8:49 require("module.so") on cygwin Peter Münster
2010-07-15  9:04 ` luigi scarso
2010-07-15 10:11   ` Peter Münster
2010-07-15 10:41     ` Taco Hoekwater
2010-07-15 10:52       ` Peter Münster
2010-07-15 11:00     ` Peter Münster
2010-07-15 11:01 ` Taco Hoekwater
2010-07-15 11:18   ` Peter Münster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).