[cfe-dev] Building Lua with Clang on Windows 10

Russell Haley via cfe-dev cfe-dev at lists.llvm.org
Fri Jan 10 22:01:48 PST 2020


Hi,

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.

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:
https://pastebin.com/BXGvrPiD)

clang:
$(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \
"AR=lib" \
"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
$(MAKE) "LUAC_T=luac.exe" luac.exe

mingw:
$(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \
"AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
"SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
$(MAKE) "LUAC_T=luac.exe" luac.exe

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:

C:\Users\russh\lua\lua-5.3.5\src> make clang
make "LUA_A=lua53.dll" "LUA_T=lua.exe" \
        "AR=clang -std=gnu99 -shared -o" \
        "AR=lib -shared -o" \
        "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
make[1]: Entering directory `C:/Users/russh/lua/lua-5.3.5/src'
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
Microsoft (R) Library Manager Version 14.16.27024.1
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : warning LNK4044: unrecognized option '/shared'; ignored
LINK : warning LNK4044: unrecognized option '/o'; ignored
LINK : fatal error LNK1181: cannot open input file 'lua53.dll'
make[1]: *** [lua53.dll] Error 1181
make[1]: Leaving directory `C:/Users/russh/lua/lua-5.3.5/src'
make: *** [clang] Error 2

It seems to me to be missing the compile step and going straight to the
link step?

Any input would be appreciated.

Regards,
Russell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200110/13db1907/attachment.html>


More information about the cfe-dev mailing list