Issue #22184 has been updated by byroot (Jean Boussier). Potential fix: https://github.com/ruby/ruby/pull/17701 ---------------------------------------- Bug #22184: error: conflicting types for ‘OnigUChar’; have ‘char16_t’ {aka ‘short unsigned int’} since https://bugs.ruby-lang.org/issues/22184#change-117913 * Author: yahonda (Yasuo Honda) * Status: Open * Assignee: byroot (Jean Boussier) * ruby -v: ruby 4.1.0dev (2026-07-07T04:45:34Z master 86a6b79e5d) +PRISM [x86_64-linux] * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- This issue was found at Rails Nightly CI https://buildkite.com/rails/rails-nightly/builds/4522#019f393b-4212-453f-8f4... ### Steps to reproduce 1. Install these packages (this repro uses Ubuntu 26.04) ``` sudo apt-get install -y gcc make libicu-dev ``` 2. Create extconf.rb and repro.c - extconf.rb ``` require "mkmf" create_makefile("repro") ``` - repro.c ``` #include <ruby.h> #include <unicode/uchar.h> ``` 3. Run `ruby.extconf & make` ``` ruby extconf make ``` ### Expected behavior It should pass like: ``` $ ruby extconf.rb && make creating Makefile linking shared-object repro.so ``` ### Actual behavior It raises the ` error: conflicting types for ‘OnigUChar’; have ‘char16_t’ {aka ‘short unsigned int’}` ``` $ ruby extconf.rb creating Makefile $ make compiling repro.c In file included from /home/yahonda/.local/share/mise/installs/ruby/trunk/include/ruby-4.1.0+4/ruby/internal/core/rregexp.h:30, from /home/yahonda/.local/share/mise/installs/ruby/trunk/include/ruby-4.1.0+4/ruby/internal/core.h:31, from /home/yahonda/.local/share/mise/installs/ruby/trunk/include/ruby-4.1.0+4/ruby/ruby.h:29, from /home/yahonda/.local/share/mise/installs/ruby/trunk/include/ruby-4.1.0+4/ruby.h:38, from repro.c:1: /home/yahonda/.local/share/mise/installs/ruby/trunk/include/ruby-4.1.0+4/ruby/onigmo.h:76:16: error: conflicting types for ‘OnigUChar’; have ‘char16_t’ {aka ‘short unsigned int’} 76 | # define UChar OnigUChar | ^~~~~~~~~ /home/yahonda/.local/share/mise/installs/ruby/trunk/include/ruby-4.1.0+4/ruby/onigmo.h:79:24: note: previous declaration of ‘OnigUChar’ with type ‘OnigUChar’ {aka ‘unsigned char’} 79 | typedef unsigned char OnigUChar; | ^~~~~~~~~ make: *** [Makefile:251: repro.o] Error 1 $ ``` ### Workaround Setting `CPPFLAGS=-DONIG_ESCAPE_UCHAR_COLLISION` workarounds this error. ```ruby $ ruby -v ruby 4.1.0dev (2026-07-07T04:45:34Z master 86a6b79e5d) +PRISM [x86_64-linux] yahonda@myubuntu:~/src/github.com/yahonda/ruby-head-uchar-repro$ ruby extconf.rb creating Makefile $ make CPPFLAGS=-DONIG_ESCAPE_UCHAR_COLLISION compiling repro.c linking shared-object repro.so $ ``` Reference https://github.com/rails/buildkite-config/pull/187 -- https://bugs.ruby-lang.org/