[cfe-dev] Hello CLang World!

Eric Astor via cfe-dev cfe-dev at lists.llvm.org
Fri Jan 10 03:13:45 PST 2020


As a rule, if you're trying to use clang-on-Windows tools in place of
Visual Studio's, you should keep this correspondence in mind:

clang-cl is equivalent to cl.exe (the C/C++ compiler)
lld-link is equivalent to link.exe (the linker)
llvm-lib is equivalent to lib.exe (the static library archiver)
llvm-rc is (sort of) equivalent to rc.exe (the Windows resource compiler) -
though you may need to run clang-cl /P on any .rc files first, since
llvm-rc doesn't include the preprocessor.

... on the other hand, I'm seeing a few guides online already to building
Lua on Windows with gcc and mingw (e.g., [1], though I can't confirm its
quality). You may well be able to use clang in place of gcc without much
difficulty!

    [1]: http://lua-users.org/wiki/BuildingLuaInWindowsForNewbies

On Fri, Jan 10, 2020 at 1:42 AM Zachary Turner via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> On Windows lib files are typically made with a tool called lib which ships
> with Visual Studio.  Unlike ar, which outputs .a files, lib outputs .lib
> files.
>
> It sounds like perhaps you need to modify the Makefile to not try to use
> ar on Windows, but to use lib instead.
>
> On Thu, Jan 9, 2020 at 10:27 PM Russell Haley via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hi,
>>
>> Er. Hello, I don't feel like I have any business being on a compiler
>> mailing list but I've been driven here by desperation. Not that I don't
>> want to be here, I just suck at C so it feels weird.
>>
>> Anywho, I like Lua. It's  a fun little language. The neat part is it's so
>> small and customizable. On FreeBSD it's *super* easy to build. In fact,
>> it's so easy a nicompoop like me has become the port maintainer for Lua
>> (albeit with great heaps of help from someone else).
>>
>> Alas, on Windows, Lua is not so easy to build. I need to download a 20 GB
>> Visual Studio or tear my hair out getting mingw set up. I have sometimes
>> resorted to the Free VC++ Build Tools, but that's still 4GB to build Lua,
>> which is.. er.. 402 KB. I also still need to do everything in DOS to get
>> all the environment variables, or go through backflips trying to set up
>> powershell to work with VC++.
>>
>> So, many years ago I downloaded LLVM (clang 5.01) and tried to build Lua
>> only to be stymied and then waylaid by life. I recently became interested
>> in compilers on Windows again, spurred on by the discovery of the
>> Embarcadero and Keil compilers, both built on clang. However, both licenses
>> *explicitly* forbids my use case.
>>
>> So, here I am. I just want to be able to build Lua easily on Windows, so
>> I'm going to make my own compiler toolchain using clang and I'm going to
>> include it in my binary Windows distribution of Lua. PERFECTLY logical.
>>
>> Anyway, you know how I said I suck at C? Well the thing that stymied me
>> so many years ago - and has stymied me this very night and driven me insane
>> enough to swear to almighty God that I'mna learn how to make a compiler -
>> is that the Lua Makefile uses `ar` and there is no `ar` on Windows. Do I
>> need ar (an archiver to build lib files) when I'm compiling on Windows with
>> clang? Could someone help me build Lua on Windows with clang so I can start
>> my lunatic journey into LLVM?
>>
>> Thanks, and nice meeting you all.
>>
>> Russell Haley
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200110/0247b229/attachment-0001.html>


More information about the cfe-dev mailing list