This fixes the issue described in #32 - inability to build the gem on MacOS and Ruby 3.1. I tested it on both Intel and M1 Macs and it works.
Details
Between Ruby 3.0 and 3.1 the behaviour of have_library has changed. Now it does not use RbConfig::CONFIG['CPP'], but RbConfig::CONFIG['CC']. To allow the extension to compile on MacOS, the latter needs to be adjusted as well.
This also uses RbConfig::CONFIG['CXX'] instead of hard-coded g++, as using g++ caused me some troubles with unknown flags on MacOS as well (I have gcc installed along clang for reasons).
This fixes the issue described in #32 - inability to build the gem on MacOS and Ruby 3.1. I tested it on both Intel and M1 Macs and it works.
Details
Between Ruby 3.0 and 3.1 the behaviour of
have_library
has changed. Now it does not useRbConfig::CONFIG['CPP']
, butRbConfig::CONFIG['CC']
. To allow the extension to compile on MacOS, the latter needs to be adjusted as well.This also uses
RbConfig::CONFIG['CXX']
instead of hard-codedg++
, as usingg++
caused me some troubles with unknown flags on MacOS as well (I havegcc
installed along clang for reasons).