1

I am trying to update our Ruby version from 2.7.4 to 3.0.2. If I bundle locally on my machine, I get this error:

rmimage.c:12960:1: error: implicit declaration of function 'C__Bool_to_R__Bool' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
DEF_ATTR_ACCESSOR(Image, start_loop, bool)
^
./rmagick.h:460:5: note: expanded from macro 'DEF_ATTR_ACCESSOR'
    DEF_ATTR_READER(class, attr, type)\
    ^
./rmagick.h:417:16: note: expanded from macro 'DEF_ATTR_READER'
        return C_##type##_to_R_##type(ptr->attr);\
               ^

If use Docker, I manage to build an image using ruby:3.0.2-alpine3.12, however I get this error if I try to load the project inside a container:

LoadError:
  Error relocating /app/vendor/bundle/ruby/3.0.0/gems/rmagick-3.2.0/lib/RMagick2.so: R__Bool_to_C__Bool: symbol not found - /app/vendor/bundle/ruby/3.0.0/gems/rmagick-3.2.0/lib/RMagick2.so

I have no clue what's wrong and how to proceed, so any help would be highly appreciated!

linkyndy
  • 17,038
  • 20
  • 114
  • 194

1 Answers1

0

If you use rmagick < 3, macOS and Homebrew, Try with the following command:

CFLAGS=‘-Wno-implicit-function-declaration’ gem i rmagick -v 2.16.0 -- --with-opt-dir=$(brew --prefix imagemagick@6)

The latest version of rmagick is resolved this issue. I recommend to update rmagick and ruby version.