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.
Created attachment 350024 [details] emerge --info
Created attachment 350026 [details] build-1.log
Created attachment 350028 [details] build-2.log
Created attachment 350030 [details, diff] lua-5.1.5.ebuild.CFLAGS.diff
Created attachment 350032 [details, diff] lua-5.1.5.ebuild-libtool.diff
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..
(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.
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 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).
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(+)