CI: install ICU on Windows runners
The windows-2022 GitHub runner image ships no working ICU. ffi-icu’s Windows loader (Lib.find_lib) globs PATH for icuuc??.dll / icuin??.dll and finds c:\tools\php\icuuc77.dll from the runner’s Chocolatey PHP install, but its sibling icudt77.dll / icuin77.dll are missing so LoadLibrary fails with Windows error 126. The outer rescue in lib/ffi-icu/lib.rb re-raises it as “no idea how to load ICU on :windows”.
Fix by downloading the official Win64 MSVC2022 build from the unicode-org/icu release and copying its DLLs next to ruby.exe. Two things have to be true for the load to succeed:
find_lib must return an icuuc??.dll whose siblings exist. Copying into ruby.exe’s directory works because ruby/setup-ruby prepends that directory to PATH, so find_lib picks up the new icuuc78.dll ahead of the stale one in c:\tools\php.
Windows must be able to resolve the loaded DLL’s transitive dependencies (icudt78.dll, icuin78.dll, VC++ runtime). Modern Ruby on Windows calls SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS), which excludes PATH from that search — so simply putting C:\icu\bin64 on PATH is not enough. The application directory (where ruby.exe lives) is always searched first regardless of policy, so placing the sibling DLLs there guarantees resolution.
Naming (icuuc78.dll, icuin78.dll) already matches the loader’s existing {lib,}icuuc??.dll glob and the (\d\d).dll version-detection regex, so no gem code changes are needed.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
ffi-icu
FFI wrappers for International Components for Unicode (ICU). ICU provides comprehensive localization and security features. Majority personal computing devices, server operating systems and web browsers use ICU. ICU builds on top of Unicode’s Common Locale Data Repository (CLDR).
Gem
Rubygem
Dependencies
ICU.
If you get messages that the library or functions are not found, you can set some environment variables to tell ffi-icu where to find it, e.g.:
Features
Character Encoding Detection
Examples:
or
Locale Sensitive Collation
Examples:
or
Text Boundary Analysis
Examples:
Number/Currency Formatting
Examples:
Time Formatting/Parsing
Examples:
For skeleton formatting, visit the Unicode date field symbol table page to help find the pattern characters to use.
Duration Formatting
Transliteration
Example:
Locale
Examples: