Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 472230

Summary: dev-lang/lua: add windows support
Product: Gentoo Linux Reporter: Bertrand Jacquin <bertrand>
Component: Current packagesAssignee: William Hubbs <williamh>
Status: UNCONFIRMED ---    
Severity: normal CC: bertrand, jstein, robbat2
Priority: Normal Keywords: PATCH, STABLE
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 662714    
Attachments: emerge --info
build-1.log
build-2.log
lua-5.1.5.ebuild.CFLAGS.diff
lua-5.1.5.ebuild-libtool.diff

Description Bertrand Jacquin 2013-06-03 22:29:46 UTC
First, the build failed in all case on non Linux system as ebuild force the CFLAGS -DLUA_USE_LINUX. Which lead to error reported on build-1.log

ldo.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
ldo.c: In function 'luaD_rawrunprotected':
ldo.c:116:3: error: too few arguments to function '_setjmp'
/usr/i686-w64-mingw32/mingw/include/setjmp.h:164:63: note: declared here

LUA_USE_LINUX define LUA_USE_POSIX (src/luaconf.h)
LUA_USE_POSIX define LUA_USE_ULONGJMP (src/luaconf.h)
LUA_USE_ULONGJMP define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }

_setjmp is not the same type, use two args on mingw:

/usr/i686-w64-mingw32/mingw/include/setjmp.h:164
  int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) _setjmp(jmp_buf _Buf, void *_Ctx);

Add conditional -DLUA_USE_LINUX fix this, also attached patch proposal lua-CFLAGS.diff do this base on ${CHOST} environnement variable to not applying this for *-mingw*. Maybe better to use flag-o-matic ?

When this is fixed, the build process is trying to cross-compile dev-lang/lua-5.1.5, CBUILD libtool is used which lead to a wrong linking. All objects are builded to CHOST, when linking is done to CBUILD. This lead error reported on build-2.log 

# cd /usr/i686-w64-mingw32/tmp/portage/dev-lang/lua-5.1.5/work/lua-5.1.5/src
# # libtool -v --tag=CC --mode=link i686-w64-mingw32-gcc -version-info 6:5:1             -rpath /usr/lib/  -o liblua.la lapi.lo lcode.lo ldebug.lo ldo.lo ldump.lo lfunc.lo lgc.lo llex.lo lmem.lo lobject.lo lopcodes.lo lparser.lo lstate.lo lstring.lo ltable.lo ltm.lo lundump.lo lvm.lo lzio.lo lauxlib.lo lbaselib.lo ldblib.lo liolib.lo lmathlib.lo loslib.lo ltablib.lo lstrlib.lo loadlib.lo
linit.lo -lm
libtool: link: x86_64-pc-linux-gnu-gcc -shared  -fPIC -DPIC  .libs/lapi.o .libs/lcode.o .libs/ldebug.o .libs/ldo.o .libs/ldump.o .libs/lfunc.o .libs/lgc.o .libs/llex.o .libs/lmem.o .libs/lobject.o .libs/lopcodes.o .libs/lparser.o .libs/lstate.o .libs/lstring.o .libs/ltable.o .libs/ltm.o .libs/lundump.o .libs/lvm.o .libs/lzio.o .libs/lauxlib.o .libs/lbaselib.o .libs/ldblib.o .libs/liolib.o .libs/lmathlib.o .libs/loslib.o .libs/ltablib.o .libs/lstrlib.o .libs/loadlib.o .libs/linit.o   -lm    -Wl,-soname -Wl,liblua.so.5 -o .libs/liblua.so.5.1.5
.libs/lapi.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

# file .libs/ldebug.o
.libs/ldebug.o: 80386 COFF executable not stripped - version 30821

Using CHOST libtool fix this issue.

Attaced emerge --info and a proposal patch

Reproducible: Always

Steps to Reproduce:
1. crossdev -t i686-w64-mingw32
2. i686-w64-mingw32-emerge -vt lua
3.
Comment 1 Bertrand Jacquin 2013-06-03 22:30:02 UTC
Created attachment 350024 [details]
emerge --info
Comment 2 Bertrand Jacquin 2013-06-03 22:30:15 UTC
Created attachment 350026 [details]
build-1.log
Comment 3 Bertrand Jacquin 2013-06-03 22:30:27 UTC
Created attachment 350028 [details]
build-2.log
Comment 4 Bertrand Jacquin 2013-06-03 22:31:17 UTC
Created attachment 350030 [details, diff]
lua-5.1.5.ebuild.CFLAGS.diff
Comment 5 Bertrand Jacquin 2013-06-03 22:33:31 UTC
Created attachment 350032 [details, diff]
lua-5.1.5.ebuild-libtool.diff
Comment 6 Matti Bickel (RETIRED) gentoo-dev 2014-01-11 10:41:20 UTC
Thanks for the thorough investigation! One question: you're NOT using -DLUA_WIN intentionally?

I'm trying to integrate this in the upcoming lua-5.2 release..
Comment 7 Bertrand Jacquin 2014-01-11 11:33:31 UTC
(In reply to Matti Bickel from comment #6)
> Thanks for the thorough investigation! One question: you're NOT using
> -DLUA_WIN intentionally?
> 
> I'm trying to integrate this in the upcoming lua-5.2 release..

No this is not intentional at all.
Comment 8 SpanKY gentoo-dev 2015-12-18 19:27:30 UTC
the libtool issue is handled in bug 515554.  let's keep this one just about windows support (i.e. the current ebuild hardcodes -DLUA_USE_LINUX all the time).
Comment 9 SpanKY gentoo-dev 2015-12-18 19:28:05 UTC
Comment on attachment 350032 [details, diff]
lua-5.1.5.ebuild-libtool.diff

you can't use ROOT here.  a local copy of libtool should be generated & used (see bug 515554 for more).
Comment 10 Larry the Git Cow gentoo-dev 2022-09-05 08:20:10 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=678e40a0f28403a4e6ef76695e33429fe6cefe00

commit 678e40a0f28403a4e6ef76695e33429fe6cefe00
Author:     David Seifert <soap@gentoo.org>
AuthorDate: 2022-09-05 08:20:00 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2022-09-05 08:20:00 +0000

    dev-lang/lua: update EAPI 7 -> 8
    
    Closes: https://github.com/gentoo/gentoo/pull/27061
    Bug: https://bugs.gentoo.org/472230
    Bug: https://bugs.gentoo.org/627330
    Bug: https://bugs.gentoo.org/689598
    Bug: https://bugs.gentoo.org/706378
    Bug: https://bugs.gentoo.org/765712
    Bug: https://bugs.gentoo.org/791451
    Bug: https://bugs.gentoo.org/834911
    Signed-off-by: David Seifert <soap@gentoo.org>

 dev-lang/lua/Manifest              |  1 +
 dev-lang/lua/lua-5.4.4-r100.ebuild | 39 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=818a17909877d016c6baa9ab04ea875e98fd80bb

commit 818a17909877d016c6baa9ab04ea875e98fd80bb
Author:     David Seifert <soap@gentoo.org>
AuthorDate: 2022-09-05 08:19:59 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2022-09-05 08:19:59 +0000

    dev-lang/lua: update EAPI 7 -> 8
    
    Bug: https://bugs.gentoo.org/472230
    Bug: https://bugs.gentoo.org/627330
    Bug: https://bugs.gentoo.org/689598
    Bug: https://bugs.gentoo.org/706378
    Bug: https://bugs.gentoo.org/765712
    Bug: https://bugs.gentoo.org/791451
    Bug: https://bugs.gentoo.org/834911
    Signed-off-by: David Seifert <soap@gentoo.org>

 dev-lang/lua/Manifest              |  1 +
 dev-lang/lua/lua-5.3.6-r100.ebuild | 39 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fab25cc8ac44fa73bb14821560ac1ba1829447df

commit fab25cc8ac44fa73bb14821560ac1ba1829447df
Author:     David Seifert <soap@gentoo.org>
AuthorDate: 2022-09-05 08:19:58 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2022-09-05 08:19:58 +0000

    dev-lang/lua: add 5.1.6
    
    * add two patches from Debian
    
    Bug: https://bugs.gentoo.org/472230
    Bug: https://bugs.gentoo.org/627330
    Bug: https://bugs.gentoo.org/689598
    Bug: https://bugs.gentoo.org/706378
    Bug: https://bugs.gentoo.org/765712
    Bug: https://bugs.gentoo.org/791451
    Bug: https://bugs.gentoo.org/834911
    Signed-off-by: David Seifert <soap@gentoo.org>

 dev-lang/lua/Manifest                              |  1 +
 dev-lang/lua/files/5.1/0001-extern_C.patch         | 20 +++++++++
 ...02-Fix-stack-overflow-in-vararg-functions.patch | 17 ++++++++
 dev-lang/lua/lua-5.1.6.ebuild                      | 49 ++++++++++++++++++++++
 4 files changed, 87 insertions(+)