Ralph Hempel | 7 Oct 17:06

Cygwin Target in Lua makefile

Is there any desire (or benefit) to having a Cygwin target in
the main Lua makefiles?

There are just enough differences between Cygwin, linux, generic
and mingw to make it seem worthwhile...

Ralph

Brian Macherone | 7 Oct 18:00

RE: Cygwin Target in Lua makefile

> Subject: Cygwin Target in Lua makefile
>
> Is there any desire (or benefit) to having a Cygwin target in
> the main Lua makefiles?
> 
> There are just enough differences between Cygwin, linux, generic
> and mingw to make it seem worthwhile...

We would like to try something like that so we can submit lua jobs to
our windows based pc condor research pool. We currently have a mechanism
for packaging python and lua could be done the same way. We can't
install lua (or python) on the machines because they have a locked down,
standardized image across the campus. Until we came up with the
packaging / caching system for python the only jobs we could run had to
be Cygwin compiled apps.

Brian

Ben Kelly | 7 Oct 20:26

Re: Cygwin Target in Lua makefile

Ralph Hempel wrote:
> Is there any desire (or benefit) to having a Cygwin target in
> the main Lua makefiles?
> 
> There are just enough differences between Cygwin, linux, generic
> and mingw to make it seem worthwhile...
> 
> Ralph

In my experience, "make generic", "make ansi", "make posix" and "make
linux" all work without modification on cygwin (although for "linux"
you'll need to have readline and whatnot installed - they're in the
cygwin packages but I forget if they're installed by default).

How would a cygwin target differ from these?
	Ben

Ralph Hempel | 7 Oct 20:34

Re: Cygwin Target in Lua makefile

Ben Kelly wrote:
> Ralph Hempel wrote:
>> Is there any desire (or benefit) to having a Cygwin target in
>> the main Lua makefiles?
>>
>> There are just enough differences between Cygwin, linux, generic
>> and mingw to make it seem worthwhile...
>>
>> Ralph
> 
> In my experience, "make generic", "make ansi", "make posix" and "make
> linux" all work without modification on cygwin (although for "linux"
> you'll need to have readline and whatnot installed - they're in the
> cygwin packages but I forget if they're installed by default).
> 
> How would a cygwin target differ from these?

I'm not sure that they build lua as a dll that can be used for
linking against other libraries such as LuaFilesystem, LuaSQL, and
LuaSocket.

The make install does not handle the dll correctly, as far as I can
tell under cygwin.

I really don't want to reinvent the wheel, but I've been fighting
with a consistent build structure for a Lua development environment
for a while now and I'm not entirely satisfied with anything.

At this point, I think the right approach (for me anyways) is to
build from source under cygwin using slightly modified makefiles
(Continue reading)

David Manura | 7 Oct 21:53
Favicon

Re: Cygwin Target in Lua makefile

>> Ralph Hempel wrote:
>>>
>>> Is there any desire (or benefit) to having a Cygwin target in
>>> the main Lua makefiles?...
> I'm not sure that they build lua as a dll that can be used for
> linking against other libraries...

Some notes on plain Cygwin builds are now collected in[1].

On the same topic, it would be nice if someone were to maintain a
Cygwin package for Lua.  There are Cygwin packages for Perl, Python,
Ruby, OCaml, Guile/clisp, Prolog, gcc, etc., but not Lua.  Though it's
easy enough to build from source, the same reasons apply as for the
Debian packages of Lua[3].

There's a couple of ways to build Lua under Cygwin, as described
above.  Readline support is preferred.  You'd generally want shared
library support.  You will want to by default link against the Cygwin
DLL/CRT.  Ideally, this distribution would include LuaRocks for
building modules against the Cygwin DLL/CRT.

It might also be nice for such a package to provide an alternative
build against MinGW (msvcrt.dll) like "gcc -mno-cygwin" (e.g. maybe
/usr/bin/lua and /usr/bin/lua-mingw)' as also noted in [1], or
possibly even the MSVC++2005/2008 CRT to support LuaBinaries modules.
  A framework for building modules for all three CRT's under Cygwin
with LuaRocks is discussed in the links in [2].  There were concerns
with the original design, but I haven't gotten around to it recently
to propose any alternative.

(Continue reading)

Ralph Hempel | 8 Oct 00:39

Re: Cygwin Target in Lua makefile

David Manura wrote:

> Some notes on plain Cygwin builds are now collected in[1].
> 
> On the same topic, it would be nice if someone were to maintain a
> Cygwin package for Lua.  There are Cygwin packages for Perl, Python,
> Ruby, OCaml, Guile/clisp, Prolog, gcc, etc., but not Lua.  Though it's
> easy enough to build from source, the same reasons apply as for the
> Debian packages of Lua[3].

That's precisely why I'm asking this. I don't have a formal request
in yet to maintain Lua for them, but I want to be prepared to
know how much work it is and also to have a build framework
that I can live with.

? There's a couple of ways to build Lua under Cygwin, as described
> above.  Readline support is preferred.  You'd generally want shared
> library support.  You will want to by default link against the Cygwin
> DLL/CRT.  Ideally, this distribution would include LuaRocks for
> building modules against the Cygwin DLL/CRT.

That would mean fixing up a lot of the LuaRocks rockspecs...

> It might also be nice for such a package to provide an alternative
> build against MinGW (msvcrt.dll) like "gcc -mno-cygwin" (e.g. maybe
> /usr/bin/lua and /usr/bin/lua-mingw)' as also noted in [1], or
> possibly even the MSVC++2005/2008 CRT to support LuaBinaries modules.

-mno-cygwin is going away with Cygwin 1.7 - they will release a separate
build of gcc for mingw builds.
(Continue reading)

Brian Macherone | 9 Oct 20:41

RE: Cygwin Target in Lua makefile


I'm trying to build the Lua random library under Cygwin and get the
following errors. Any pointers for this novice? (Makefile included below
compilation / linking results)

$ make
gcc -I/cygdrive/j/bsmlab/LuaWindows/Lua-5.1.4/lua-5.1.4/src -ansi
-pedantic -Wal
l -O2    -c -o lrandom.o lrandom.c
gcc -o random.so -shared lrandom.o
lrandom.o:lrandom.c:(.text+0x197): undefined reference to
`_luaL_checkudata'
lrandom.o:lrandom.c:(.text+0x1bb): undefined reference to
`_lua_newuserdata'
lrandom.o:lrandom.c:(.text+0x1d7): undefined reference to
`_lua_getfield'
lrandom.o:lrandom.c:(.text+0x1e8): undefined reference to
`_lua_setmetatable'
lrandom.o:lrandom.c:(.text+0x225): undefined reference to
`_luaL_optinteger'
lrandom.o:lrandom.c:(.text+0x2d3): undefined reference to
`_luaL_optinteger'
lrandom.o:lrandom.c:(.text+0x34b): undefined reference to `_lua_gettop'
lrandom.o:lrandom.c:(.text+0x366): undefined reference to
`_luaL_checkinteger'
lrandom.o:lrandom.c:(.text+0x379): undefined reference to
`_luaL_checkinteger'
lrandom.o:lrandom.c:(.text+0x3a8): undefined reference to
`_lua_pushnumber'
lrandom.o:lrandom.c:(.text+0x3cd): undefined reference to
(Continue reading)

Thomas Harning | 9 Oct 20:45
Gravatar

Re: Cygwin Target in Lua makefile

On Oct 9, 2008, at 2:41 PM, Brian Macherone wrote:

>
> I'm trying to build the Lua random library under Cygwin and get the
> following errors. Any pointers for this novice? (Makefile included  
> below
> compilation / linking results)
>
> $ make
> gcc -I/cygdrive/j/bsmlab/LuaWindows/Lua-5.1.4/lua-5.1.4/src -ansi
> -pedantic -Wal
> l -O2    -c -o lrandom.o lrandom.c
> gcc -o random.so -shared lrandom.o
> lrandom.o:lrandom.c:(.text+0x197): undefined reference to
> `_luaL_checkudata'
Windows (sadly) requires that all references be known at link-time...  
no useful auto-resolve that ld.so does.

You'll have to add the appropriate -llua ONLY for cygwin/mingw builds...

Ralph Hempel | 9 Oct 21:32

Re: Cygwin Target in Lua makefile

Thomas Harning wrote:
> On Oct 9, 2008, at 2:41 PM, Brian Macherone wrote:
> 
>>
>> I'm trying to build the Lua random library under Cygwin and get the
>> following errors. Any pointers for this novice? (Makefile included below
>> compilation / linking results)
>>
>> $ make
>> gcc -I/cygdrive/j/bsmlab/LuaWindows/Lua-5.1.4/lua-5.1.4/src -ansi
>> -pedantic -Wal
>> l -O2    -c -o lrandom.o lrandom.c
>> gcc -o random.so -shared lrandom.o
>> lrandom.o:lrandom.c:(.text+0x197): undefined reference to
>> `_luaL_checkudata'
> Windows (sadly) requires that all references be known at link-time... no 
> useful auto-resolve that ld.so does.
> 
> You'll have to add the appropriate -llua ONLY for cygwin/mingw builds...

Yep. The cygwin target is annoying in that it's not WIN32 and yet it's
not quite *nix either.

I ended up having to make a minor change in luaconf.h to look for
.dll instead of .so - cygwin does not really care if the suffix is
.dll or .so but all of their libraries are dlls.

Also, you have to put the lua51.dll in the same dir as the lua
executable.

(Continue reading)


Gmane