Actions
Bug #22184
closederror: conflicting types for ‘OnigUChar’; have ‘char16_t’ {aka ‘short unsigned int’} since
Bug #22184:
error: conflicting types for ‘OnigUChar’; have ‘char16_t’ {aka ‘short unsigned int’} since
ruby -v:
ruby 4.1.0dev (2026-07-07T04:45:34Z master 86a6b79e5d) +PRISM [x86_64-linux]
Description
This issue was found at Rails Nightly CI https://buildkite.com/rails/rails-nightly/builds/4522#019f393b-4212-453f-8f4f-c1a538af23e5/L3911
Steps to reproduce¶
- Install these packages (this repro uses Ubuntu 26.04)
- Create extconf.rb and repro.c
- extconf.rb
- repro.c
- Run
ruby.extconf & make
Expected behavior¶
It should pass like:
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 -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
Actions