Skip to content

Installation failure on Windows due to json gem native extension build error (Ruby 3.4,Ruby 3.3, no DevKit detected) #476

@InsPekToP

Description

@InsPekToP

I'm unable to install Jekyll on Windows due to a recurring failure when building the native extension for the json gem (version 2.18.0 is being pulled).
Environment:

OS: Windows 10/11 (x64)
Ruby version: 3.3.x (installed via RubyInstaller without DevKit / or with incomplete toolchain)
Ruby path: E:/Проги/Ruby/Ruby33-x64 (note: contains non-ASCII characters in user profile path C:\Users\МИХАИЛ)
Gem environment: RubyGems uses user install directory C:/Users/МИХАИЛ/.local/share/gem/ruby/3.3.0

Steps to reproduce:

gem install jekyll bundler
Or even gem install json --platform=ruby

Actual behavior:
Fails with:
The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.

checking for whether -std=c99 is accepted as CFLAGS... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. ... mkmf.rb:480:in try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.`

Also earlier attempts (with json 2.18.0) showed SIMD-related load errors due to кириллица (Cyrillic) in username path.
Expected behavior:
Jekyll installs successfully (or at least json gem installs in pure-ruby mode without requiring compilation).
Additional notes:

Windows is not officially supported by Jekyll (as per https://jekyllrb.com/docs/support/), but many users still use it.
Problem is very common on Windows when DevKit/MSYS2 is missing or incomplete.
Even --platform=ruby does not prevent json gem from trying to build native extension in recent versions.
Workarounds that help many people:
Install Ruby+DevKit from https://rubyinstaller.org/
Use WSL2 + Ubuntu
Force old json version: gem install json -v 2.6.3

Would it be possible to:

Make json gem more reliably fall back to pure-ruby mode on Windows when native build fails?
Or update documentation to strongly recommend Ruby+DevKit or WSL for Windows users?

Thanks for the great tool — Jekyll is awesome when it works!
Logs to attach (optional but very helpful):

Output of gem env
Full install log
mkmf.log from the path in error message

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions