brianmario / charlock_holmes

Character encoding detection, brought to you by ICU
MIT License
1.03k stars 140 forks source link

Alpine: `conflicting declaration of 'void* ruby_nonempty_memcpy` despite having `icu-dev` installed #166

Open Startouf opened 1 year ago

Startouf commented 1 year ago

I am installing this gemfile dependency on ruby:3.0.3-alpine and despite having installed the ICU dependency, I'm running into a "conflicting declaration" error while building native extensions

I have installed the following apk libs which should have settled the problem I believe

FROM ruby:3.0.3-alpine

RUN apk add --update --no-cache \
  [...]
  icu-dev \
  ruby-full

Backtrace:

#16 1761.3 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
#16 1761.3
#16 1761.3 current directory:
#16 1761.3 /usr/local/bundle/gems/charlock_holmes-0.7.7/ext/charlock_holmes
#16 1761.3 /usr/local/bin/ruby -I /usr/local/lib/ruby/3.0.0 -r
#16 1761.3 ./siteconf20230302-1-wqiwia.rb extconf.rb
#16 1761.3 checking for -licui18n... yes
#16 1761.3 checking for unicode/ucnv.h... yes
#16 1761.3 checking for -lz... yes
#16 1761.3 checking for -licuuc... yes
#16 1761.3 checking for -licudata... yes
#16 1761.3 creating Makefile
#16 1761.3
#16 1761.3 current directory:
#16 1761.3 /usr/local/bundle/gems/charlock_holmes-0.7.7/ext/charlock_holmes
#16 1761.3 make DESTDIR\= clean
#16 1761.3
#16 1761.3 current directory:
#16 1761.3 /usr/local/bundle/gems/charlock_holmes-0.7.7/ext/charlock_holmes
#16 1761.3 make DESTDIR\=
#16 1761.3 compiling converter.c
#16 1761.3 compiling encoding_detector.c
#16 1761.3 compiling ext.c
#16 1761.3 compiling transliterator.cpp
#16 1761.3 In file included from /usr/local/include/ruby-3.0.0/ruby/ruby.h:39,
#16 1761.3                  from /usr/local/include/ruby-3.0.0/ruby.h:38,
#16 1761.3                  from common.h:9,
#16 1761.3                  from transliterator.cpp:1:
#16 1761.3 /usr/local/include/ruby-3.0.0/ruby/internal/memory.h:276:16: error: conflicting
#16 1761.3 declaration of 'void* ruby_nonempty_memcpy(void*, const void*, size_t)' with 'C'
#16 1761.3 linkage
#16 1761.3   276 | #define memcpy ruby_nonempty_memcpy
#16 1761.3       |                ^~~~~~~~~~~~~~~~~~~~
#16 1761.3 /usr/local/include/ruby-3.0.0/ruby/internal/memory.h:266:1: note: previous
#16 1761.3 declaration with 'C++' linkage

Am I maybe missing some other OS dependency ?

Startouf commented 1 year ago

It seems to be a bug related to Ruby 3.0.x see https://bugs.ruby-lang.org/issues/17788 and https://github.com/ruby/ruby/pull/4429

Ruby version 3.0.5 does not seem to be affecter and installation was successful on that version

MuhittinTekin commented 9 months ago

168