Top Related Projects
An LLVM/Clang/LLD based mingw-w64 toolchain
Quick Overview
w64devkit is a portable C and C++ development kit for Windows 64-bit systems. It provides a complete, self-contained toolchain for building native Windows applications, including a compiler, debugger, and various Unix-like tools, all packaged in a single, easy-to-use distribution.
Pros
- Portable and self-contained, requiring no installation or system modifications
- Includes a comprehensive set of development tools (GCC, GDB, Make, etc.)
- Regularly updated with the latest versions of included tools
- Lightweight and fast, with minimal overhead
Cons
- Limited to 64-bit Windows systems
- May lack some features found in full-fledged IDEs
- Requires command-line proficiency for optimal use
- Some users may prefer more graphical interfaces for development
Getting Started
- Download the latest release from the GitHub repository.
- Extract the ZIP file to a location of your choice.
- Add the extracted
w64devkit/bin
directory to your system's PATH environment variable. - Open a command prompt and verify the installation by running:
gcc --version
make --version
gdb --version
- Create a simple C program (e.g.,
hello.c
) and compile it using:
gcc hello.c -o hello.exe
- Run the compiled program:
hello.exe
You're now ready to start developing with w64devkit!
Competitor Comparisons
An LLVM/Clang/LLD based mingw-w64 toolchain
Pros of llvm-mingw
- Uses LLVM toolchain, potentially offering better optimization and newer language features
- Supports cross-compilation for multiple architectures (x86, ARM, ARM64)
- Provides both GCC and Clang frontends, offering more flexibility
Cons of llvm-mingw
- Larger download size and installation footprint
- May have compatibility issues with some GCC-specific code
- Potentially slower compile times compared to GCC-based toolchains
Code comparison
w64devkit:
#include <stdio.h>
int main() {
printf("Hello from w64devkit!\n");
return 0;
}
llvm-mingw:
#include <stdio.h>
int main() {
printf("Hello from llvm-mingw!\n");
return 0;
}
The code itself is identical for both toolchains, as they both support standard C. The main differences would be in compilation flags and toolchain-specific optimizations. For example:
w64devkit:
gcc -O2 hello.c -o hello.exe
llvm-mingw:
clang -O2 hello.c -o hello.exe
Both toolchains provide capable development environments for Windows, with w64devkit focusing on simplicity and small size, while llvm-mingw offers more features and flexibility at the cost of increased complexity and size.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Portable C, C++, and Fortran Development Kit for x64 and x86 Windows
w64devkit is a Dockerfile that builds from source a small, portable development suite for creating C and C++ applications on and for x86 and x64 Windows. See "Releases" for pre-built, ready-to-use kits.
Included tools:
- Mingw-w64 GCC : compilers, linker, assembler
- GDB : debugger
- GNU Make : standard build tool
- busybox-w32 : standard unix utilities, including sh
- Vim : powerful text editor
- Universal Ctags : source navigation
It is an MSVCRT toolchain with pthreads, C++11 threads, and OpenMP. All included runtime components are static. Docker/Podman is not required to use the development kit. It's merely a reliable, clean environment for building the kit itself.
Build
Build the image, then run it to produce a self-extracting 7z archive:
docker build -t w64devkit .
docker run --rm w64devkit >w64devkit-x64.exe
This takes about 15 minutes on modern systems. You will need an internet connection during the first few minutes of the build. Note: Do not use PowerShell because it lacks file redirection.
Usage
The self-extracting 7z archive contains tools in a typical unix-like
configuration. Extract wherever is convenient. Inside is w64devkit.exe
,
which 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. It also sets two extra environment variables:
W64DEVKIT_HOME
to the installation root and W64DEVKIT
to the version.
Alternatively, add the bin/
directory to your path. For example, inside
a cmd.exe
console or batch script:
set PATH=c:\path\to\w64devkit\bin;%PATH%
Then to start an interactive unix shell:
sh -l
Main features
-
No installation required. Run it anywhere as any user. Simply delete when no longer needed.
-
Fully offline. No internet access is ever required or attempted.
-
A focus on static linking all runtime components. The runtime is optimized for size.
-
Trivial to build from source, meaning it's easy to tweak and adjust any part of the kit for your own requirements.
-
Complements Go for cgo and bootstrapping.
Optimized for size
Runtime components are optimized for size, leading to smaller application
executables. Unique to w64devkit, libmemory.a
is a library of memset
,
memcpy
, memmove
, memcmp
, and strlen
implemented as x86 string
instructions. When not linking a CRT, linking -lmemory
provides
tiny definitions, particularly when GCC requires them.
Also unique to w64devkit, libchkstk.a
has a leaner, faster definition of
___chkstk_ms
than GCC (-lgcc
), as well as __chkstk
, sometimes needed
when linking MSVC artifacts. Both are in the public domain and so, unlike
default implementations, do not involve complex licensing. When required
in a -nostdlib
build, link -lchkstk
.
Unlike traditional toolchains, import tables are not populated with junk
ordinal hints. If an explicit hint is not provided (i.e. via a DEF file),
then the hint is zeroed: "no data." Eliminating this random data makes
binaries more compressible and theoretically faster loading. See also:
peports
.
Recommended downloadable, offline documentation
With a few exceptions, such as Vim's built-in documentation (:help
),
w64devkit does not include documentation. However, you need not forgo
offline documentation alongside your offline development tools. This is a
list of recommended, no-cost, downloadable documentation complementing
w64devkit's capabilities. In rough order of importance:
-
cppreference (HTML), friendly documentation for the C and C++ standard libraries.
-
GCC manuals (PDF, HTML), to reference GCC features, especially built-ins, intrinsics, and command line switches.
-
Win32 Help File (CHM) is old, but official, Windows API documentation. Unfortunately much is missing, such as Winsock. (Offline Windows documentation has always been very hard to come by.)
-
C and C++ Standards (drafts) (PDF), for figuring out how corner cases are intended to work.
-
Intel Intrinsics Guide (interactive HTML), a great resource when working with SIMD intrinsics. (Search for "Download" on the left.)
-
GNU Make manual (PDF, HTML)
-
GNU Binutils manuals (PDF, HTML), particularly
ld
andas
. -
GDB manual (PDF)
-
BusyBox man pages (TXT), though everything here is also available via
-h
option inside w64devkit. -
Intel Software Developer Manuals (PDF), for referencing x86 instructions, when either studying compiler output with
objdump
or writing assembly.
Library installation
Except for the standard libraries and Win32 import libraries, w64devkit does not include libraries, but you can install additional libraries such that the toolchain can find them naturally. There are three options:
-
Install it under the sysroot at
w64devkit/$ARCH/
. The easiest option, but will require re-installation after upgrading w64devkit. If it defines.pc
files, thepkg-config
command will automatically find and use them. -
Append its installation directory to your
CPATH
andLIBRARY_PATH
environment variables. Use;
to delimit directories. You would likely do this in your.profile
. -
If it exists, append its
pkgconfig
directory to thePKG_CONFIG_PATH
environment variable, then use thepkg-config
command as usual. Use;
to delimit directories
Both (1) and (3) are designed to work correctly even if w64devkit or the libraries have paths containing spaces.
Unique command-line programs
-
peports
: displays export and import tables of EXEs and DLLs. Like MSVCdumpbin
options/exports
and/imports
; narrower and more precise than Binutilsobjdump -p
. Useful for checking if exports and imports match your expectations. Complemented byc++filt
andvc++filt
, i.e. in a pipeline. Pronounced like purports. -
vc++filt
: ac++filt
for Visual C++ name decorations. Used to examine GCC-incompatible binaries, potentially to make some use of them anyway. -
debugbreak
: causes all debugee processes to break in the debugger, like using Windows' F12 debugger hotkey. Especially useful for console subsystem programs.
Notes
$HOME
can be set through the adjacent w64devkit.ini
configuration, and
may even be relative to the w64devkit/
directory. This is useful for
encapsulating the entire development environment, with home directory, on
removable, even read-only, media. Use a .profile
in the home directory
to configure the environment further.
Neither Address Sanitizer (ASan) nor Thread Sanitizer (TSan) has been
ported to Mingw-w64 (also), but Undefined Behavior Sanitizer
(UBSan) works perfectly under GDB. With both -fsanitize=undefined
and
-fsanitize-trap
, GDB will break precisely on undefined
behavior, and it does not require linking with libsanitizer.
GCC does not fully support AVX on Windows and may use aligned moves
on unaligned addresses. When targeting AVX, consider disabling all aligned
moves in the assembler: -Wa,-muse-unaligned-vector-move
.
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.
Top Related Projects
An LLVM/Clang/LLD based mingw-w64 toolchain
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot