<div><div dir="auto">If you’re trying to build a 32-bit lua, pass -m32 for all clang invocations.  If you’re trying to build a 64-bit lua, pass -m64 instead.  That should hopefully fix it.</div></div><div dir="auto"><br></div><div dir="auto">Also, cross posting between Lia and clang mailing lists... This is a new one :)</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 10, 2020 at 10:22 PM Russell Haley via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div></div><br><div class="gmail_quote"></div></div><div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 10, 2020 at 10:01 PM Russell Haley <<a href="mailto:russ.haley@gmail.com" target="_blank">russ.haley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<br><div><br></div><div>I'm taking a shot at building Lua with Clang on Windows and I'm stalled out on modifying the standard Lua makefile. I've tried both the GNU Win32 Make (3.8.1) and Digital Mars Make (It came with DLang). All the below work is with GNU Make.</div><div><br></div><div>To modify the Makefile for Windows, I changed CC = clang. Then I've replaced *.o with *.obj in the file and created a new target called clang which looks like this (full modified makefile here: <a href="https://pastebin.com/BXGvrPiD" target="_blank">https://pastebin.com/BXGvrPiD</a>)</div><div><br></div>clang:<br>     $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \<br>       "AR=lib" \<br>  "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe<br><div>$(MAKE) "LUAC_T=luac.exe" luac.exe </div><div><br></div><div>mingw:<br>      $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \<br>       "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \<br>   "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe<br>       $(MAKE) "LUAC_T=luac.exe" luac.exe<br></div><div><br></div><div>The above is my attempt to modify the mingw target which I have also included for reference. I've tried the clang target with -shared and -o left in and removed, both with no success. This is the result of my latest attempt with -shared and -o left in: </div><div><br></div><div>C:\Users\russh\lua\lua-5.3.5\src> make clang<br>make "LUA_A=lua53.dll" "LUA_T=lua.exe" \<br>        "AR=clang -std=gnu99 -shared -o" \<br>        "AR=lib -shared -o" \<br>        "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe<br>make[1]: Entering directory `C:/Users/russh/lua/lua-5.3.5/src'<br>lib -shared -o lua53.dll lapi.obj lcode.obj lctype.obj ldebug.obj ldo.obj ldump.obj lfunc.obj lgc.obj llex.obj lmem.obj lobject.obj lopcodes.obj lparser.obj lstate.obj lstring.obj ltable.obj ltm.obj lundump.obj lvm.obj lzio.obj lauxlib.obj lbaselib.obj lbitlib.obj lcorolib.obj ldblib.obj liolib.obj lmathlib.obj loslib.obj lstrlib.obj ltablib.obj lutf8lib.obj loadlib.obj linit.obj<br>Microsoft (R) Library Manager Version 14.16.27024.1<br>Copyright (C) Microsoft Corporation.  All rights reserved.<br><br>LINK : warning LNK4044: unrecognized option '/shared'; ignored<br>LINK : warning LNK4044: unrecognized option '/o'; ignored<br>LINK : fatal error LNK1181: cannot open input file 'lua53.dll'<br>make[1]: *** [lua53.dll] Error 1181<br>make[1]: Leaving directory `C:/Users/russh/lua/lua-5.3.5/src'<br>make: *** [clang] Error 2<br></div><div><br></div><div>It seems to me to be missing the compile step and going straight to the link step?</div><div><br></div><div>Any input would be appreciated. </div><div><br></div><div>Regards,</div><div>Russell</div></div></blockquote><div><br></div></div></div><div dir="ltr"><div class="gmail_quote">Ugh. I spent hours tonight trying things then finally spend the time to write up that last email and fire it off. Three seconds later I thought of a new path and it turned out to solve the issue. I reverted back to the original makefile and started again. I change CC=clang and set MAKE= make (to fix the spaces in the installed path).<div><br></div><div>Anyway, Now I'm stuck with an architecture mis-match:</div><div><br></div><div> make clang<br>make "LUA_A=lua53.dll" "LUA_T=lua.exe" \<br>        "AR=clang -std=gnu99 -shared -o" "RANLIB=strip --strip-unneeded" \<br>        "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe<br>make[1]: Entering directory `C:/Users/russh/lua/lua-5.3.5/src'<br>clang -std=gnu99 -shared -o lua53.dll lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o<br>libcmt.lib(chkstk.obj) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'<br>clang: error: linker command failed with exit code 1112 (use -v to see invocation)<br>make[1]: *** [lua53.dll] Error 1112<br>make[1]: Leaving directory `C:/Users/russh/lua/lua-5.3.5/src'<br>make: *** [clang] Error 2<br></div><div></div><div> </div><div>Regards,</div><div>Russell</div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>