Can I compile on Windows using nothing but the LLVM toolchain?

Most of this conversation is MS Build tools vs MingW, but what about the Clang/LLVM build tools? I have been using nim for windows and their use of LLVM works fine.

6 Likes

That would be great. Visual Studio is huge and takes a while to download and install, so it's an inconvenience for new or casual Rust users.

AFAIK Rust now ships with LLVM's linker and linker-flavor flag exists, so it might be able to actually produce an executable on its own.

I'm not sure if it still needs some libraries from the Windows SDK to run.

6 Likes

Currently Rust relies on import libraries to link to symbols from system libraries. In order to not rely on them RFC 2627 would need to be implemented and stabilized. Once that is done it's just a matter of updating winapi to use it (and updating std to use winapi), and creating a new pure Rust target without any CRT dependence. So while this cannot really be done yet, it's something that may be possible in the future.

5 Likes

I'm really looking forward to do that. As far as I know msvc build tools do have the same licensing conditions as Visual Studio has. So you could have issues if you where to create a commercial application with this. Correct me if I am mistaken here.

That... may be true. I'm not (currently) going to go looking for the msvc linker's license, but I suspect it's the same as the rest of the package, as you suggest.

However, simply releasing commercial software is permitted with the community edition. You have to have more than 5 developers, or revenue exceeding 1M USD to require the professional license, as of the last time I read the license terms. There is also a specific clause allowing development of open-source (or free? I don't remember the specifics) software with the community edition.

I don't think those terms are very onerous, generally.

I am not sure if I understand correctly, but you can download only the MSVC build tools without Visual Studio, the IDE, here: Download Visual Studio Tools - Install Free for Windows, Mac, Linux

Scroll down to the expandable Tools for Visual Studio 2019 section and download the Build Tools for VS2019.

Sorry if you knew that already / this wasn't what you meant.

Thank you! I knew that though :slight_smile: . I was refering to the licensing terms. As @Zarenor was stating there are certain rules applying if you are creating commercial products with MSVC build tools. I was asking for those licensing conditions. I'd rather give the money to the rust community :smiley:

Not to beat the circular dead horse here, but LLVM integration would solve the issue around needing the commercially binding MS Build Tools.

I realize it may take work to get there, and lord knows I don't have the time to help (wish I did). However, some of the other new languages do provide their own linker/integrate with LLVM so that the MS Build Tools are not necessary.

At this point its just an extra hurdle to adoption for people interested in a licenses free cross platform experience which you get with Nim, Go, or D.

1 Like

Is this a thing yet? I already am able to do C++ on Windows using Clang. I'd love to not have to use MSVC or setup GNU stuff just to be able to have Rust bindings. :frowning:

No, RFC 2627 is not implemented yet, so Rust applications cannot be built on Windows without import libraries. Check back on that issue if you want to keep track of progress.