Project

General

Profile

Actions

Bug #22184

closed

error: 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

Added by yahonda (Yasuo Honda) 19 days ago. Updated 19 days ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-07-07T04:45:34Z master 86a6b79e5d) +PRISM [x86_64-linux]
[ruby-core:125944]

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

  1. Install these packages (this repro uses Ubuntu 26.04)
sudo apt-get install -y gcc make libicu-dev
  1. Create extconf.rb and repro.c
  • extconf.rb
require "mkmf"
create_makefile("repro")
  • repro.c
#include <ruby.h>
#include <unicode/uchar.h>
  1. 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 -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

Also available in: PDF Atom