Git Product home page Git Product logo

w64devkit's Introduction

Portable C and C++ Development Kit for x64 Windows

w64devkit is a Dockerfile that builds from source a small, portable development suite for creating C and C++ applications on and for x64 Windows. It is the highest quality native toolchain for C and C++ currently available on Windows.

Included tools:

The compilers support pthreads, C++11 threads, and OpenMP. All included libraries are static. Docker is not required to use the development kit. It's merely a reliable, clean environment for building the kit itself.

Build

First build the image, then run it to produce a distribution .zip file:

docker build -t w64devkit .
docker run --rm w64devkit >w64devkit.zip

This takes about half an hour on modern systems. You will need an internet connection during the first couple minutes of the build.

Usage

The final .zip file contains tools in a typical unix-like configuration. Unzip the contents anywhere. Inside is w64devkit.exe (or activate.bat) that launches a console window with the environment configured and ready to go. It is the easiest way to enter the development environment, and requires no system changes.

Alternatively, add the bin/ directory to your path. For example, while inside a console or batch script:

set PATH=c:\path\to\w64devkit\bin;%PATH%

To start an interactive unix shell:

sh -l

Best of class

What makes w64devkit the best? It is the only production-grade, native toolchain for Windows which:

  • Does not require installation. Run it anywhere as any user.

  • Does not require internet access during installation. The installers for other toolchains are actually downloaders, or otherwise call home, and so must be online for at least part of their installation process.

It's one of a few that:

  • Supports C99 by default. Most others have incomplete support or require esoteric configurations in order to enable it.

  • It's one of the few that supports static linking for the entire runtime.

Finally it's by far the easiest toolchain to bootstrap, meaning it's the easiest to tweak and adjust for your own requirements.

Optimized for size

The language runtimes in w64devkit are optimized for size, so it produces particularly small binaries when programs are also optimized for size (-Os) during compilation. If your program only uses the printf family of functions with MSVC-compatable directivies (i.e. limited to C89), and you want even smaller binaries, you can avoid embdedding the Mingw-w64's improved implementation by setting __USE_MINGW_ANSI_STDIO to 0 before including any headers.

$ cc -Os -D__USE_MINGW_ANSI_STDIO=0 ...

Notes

Since the development kit is intended to be flexible, light, and portable โ€” i.e. run from anywhere, in place, and no installation is necessary โ€” the binaries are all optimized for size, not speed.

Due to an old GCC bug, we must build a cross-compiler to cross-compile GCC itself because, due to host contamination, GCC can only be correctly and safely cross-compiled by a matching version.

I'd love to include Git, but unfortunately Git's build system doesn't quite support cross-compilation, and it's hostile to installation-free .zip distribution (lots of symlinks). A decent backup solution would be Quilt, but it's written in Bash and Perl.

What about sanitizer support? That would be fantastic, but unfortunately libsanitizer has not yet been ported from MSVC to Mingw-w64 (also).

Since the build environment is so stable and predicable, it would be great for the .zip to be reproducible, i.e. builds by different people are bit-for-bit identical. There are multiple reasons why this is not currently the case, the least of which are timestamps in the .zip file.

Licenses

When distributing binaries built using w64devkit, your .exe will include parts of this distribution. For the GCC runtime, including OpenMP, you're covered by the GCC Runtime Library Exception so you do not need to do anything. However the Mingw-w64 runtime has the usual software license headaches and you may need to comply with various BSD-style licenses depending on the functionality used by your program: MinGW-w64 runtime licensing and winpthreads license. To make this easy, w64devkit includes the concatenated set of all licenses in the file COPYING.MinGW-w64-runtime.txt, which should be distributed with your binaries.

w64devkit's People

Contributors

skeeto avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.