GCC compiler required to build Hugo from source on Windows

When building the extended flavor of Hugo from source on Windows, you will need Git, Go and the GCC compiler.

To install the GCC compiler:

  1. Download and install 7-Zip.

  2. Download Mingw-w64. You want the file with “posix-seh-msvcrt” in its name.

  3. Extract the archive with 7-Zip, then move the mingw64 directory into C:\Program Files.

    C:\Program Files\mingw64
  4. Update the PATH environment variable

    • Right click on the Start menu icon, choose Run, then paste:

      rundll32.exe sysdm.cpl,EditEnvironmentVariables

    • Under “User variables” select PATH, press Edit, press New, then paste:

      C:\Program Files\mingw64\bin

  5. Verify that gcc is installed and in your PATH. Open a cmd window then type:

    gcc --version

  6. Now compile the extended version of Hugo. Change to the directory containing the Hugo codebase, then type:

    CGO_ENABLED=1 go install -tags extended

    Be patient; it will take a while.

  7. Verify the location of the executable by typing where hugo. This should display something like:


  8. Verify the version by typing hugo version. This should display something like:

    hugo v0.116.0-DEV-be8e2de59786327a83a1b41bb9f9608a49b5f7a0+extended windows/amd64 BuildDate=2023-07-30T19:12:33Z


Yea, the difference between Go and C/C++ compile time is … big … some say that they drafted the first version of Go while waiting for their C++ builds to complete inside Google. But it caches pretty well, so repeated builds will go faster.

Also, the title of this thread is also true for Linux, MacOS etc., but there (esp. on Linux) it’s more common to have these installed out of the box.

Also, I’m pretty sure the mingw contains both GCC and g++.

And you can also install it via Chokolatey:

1 Like