Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 472230 - dev-lang/lua: add windows support
Summary: dev-lang/lua: add windows support
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords: PATCH, STABLE
Depends on:
Blocks: cross-compile
  Show dependency tree
 
Reported: 2013-06-03 22:29 UTC by Bertrand Jacquin
Modified: 2019-03-18 21:48 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (info.log,12.30 KB, text/x-log)
2013-06-03 22:30 UTC, Bertrand Jacquin
Details
build-1.log (build-1.log,3.09 KB, text/x-log)
2013-06-03 22:30 UTC, Bertrand Jacquin
Details
build-2.log (build-2.log,8.88 KB, text/x-log)
2013-06-03 22:30 UTC, Bertrand Jacquin
Details
lua-5.1.5.ebuild.CFLAGS.diff (lua-CFLAGS.diff,518 bytes, patch)
2013-06-03 22:31 UTC, Bertrand Jacquin
Details | Diff
lua-5.1.5.ebuild-libtool.diff (lua-5.1.5.ebuild-libtool.diff,1.09 KB, patch)
2013-06-03 22:33 UTC, Bertrand Jacquin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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).