Skip to content

Build fails on Windows: sh command not found during compilation (system cannot find the file specified) #16752

@Yakumo-Yukari

Description

@Yakumo-Yukari

I'm trying to compile a Crystal program on Windows using:
crystal build src/app.cr
The build fails with:

In crystal\share\crystal\src\openssl\lib_crypto.cr:24:27

 24 | {% from_libressl = (`sh -c 'hash pkg-config 2> /dev/null || printf %s false'` != "false") &&
                          ^
Error: error executing command: sh -c 'hash pkg-config 2> /dev/null || printf %s false': The system cannot find the file specified.

The compiler is trying to execute a shell command (sh -c ...) during the OpenSSL detection phase, but sh is not available on native Windows. This suggests that the build process relies on Unix tools.

My question: Does Crystal support native development on Windows without requiring a Unix-like environment (like WSL, MSYS2, or Cygwin)? If so, how can I resolve this issue? I'm looking for a solution that works on Windows natively, not by running Crystal in a Linux-like environment.

I'm using:

Windows 11 (64-bit)

Crystal 1.19.1

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions