I'm trying to add Karafka to an existing Ruby project and running into Architecture issues while trying to install the gems on my M1 Mac. I've faced this issue with other gems in the past but my current configurations resolved all of those. I'm at a loss why Karafka is running into these issues now. Looking at their Repo and Issues I don't see a solution for this. Has anyone else run into it?
Running
gem install karafka
Using:
Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Ruby 3.1.4
rbenv 1.3.2
-I/usr/local/Cellar/openssl@3/3.3.2
Errors
g++ -MD -MP -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/libpq/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -I/opt/homebrew/opt/libpq/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wno-non-virtual-dtor -c RdKafka.cpp -o RdKafka.o
RdKafka.cpp:29:10: fatal error: 'string' file not found
29 | #include <string>
| ^~~~~~~~
1 error generated.
make[1]: *** [RdKafka.o] Error 1
make: *** [libs] Error 2
----- end of file -----
Karafka author here. Please see this thread: https://github.com/karafka/karafka-rdkafka/issues/126
I am actively working to provide a systematic solution that covers all the MacOS versions, meanwhile please put this in your zshrc
:
export CPPFLAGS="-I/Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr/include/c++/v1/"