Macの開発環境でcld3-rubyがコンパイルできない時の対処法

Mastodonでは、 cld3-rubyをがっつり使っているために、これがないとまともに動かない。
実はこの対処方法、公式に載っている。

"pkg-config --exists protobuf"
| pkg-config --libs protobuf
=> "-L/usr/local/Cellar/protobuf/3.6.1/lib -lprotobuf -pthread\n"
"clang -o conftest -I/Users/user/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-darwin17 -I/Users/user/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/Users/user/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/Users/user/.rbenv/versions/2.5.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L. -L/Users/user/.rbenv/versions/2.5.1/lib -L. -L/Users/user/.rbenv/versions/2.5.1/lib -fstack-protector -L/usr/local/lib -lruby.2.5.1-static -framework Foundation -lpthread -ldl -lobjc "
ld: warning: text-based stub file /System/Library/Frameworks//Foundation.framework/Foundation.tbd and library file /System/Library/Frameworks//Foundation.framework/Foundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/Versions/A/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/Versions/A/CoreFoundation are out of sync. Falling back to library file for linking.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"clang -o conftest -I/Users/user/.rbenv/versions/2.5.1/include/ruby-2.5.0/x86_64-darwin17 -I/Users/user/.rbenv/versions/2.5.1/include/ruby-2.5.0/ruby/backward -I/Users/user/.rbenv/versions/2.5.1/include/ruby-2.5.0 -I. -I/Users/user/.rbenv/versions/2.5.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe conftest.c -L. -L/Users/user/.rbenv/versions/2.5.1/lib -L. -L/Users/user/.rbenv/versions/2.5.1/lib -fstack-protector -L/usr/local/lib -lruby.2.5.1-static -framework Foundation -L/usr/local/Cellar/protobuf/3.6.1/lib -lprotobuf -pthread -lpthread -ldl -lobjc "
ld: warning: text-based stub file /System/Library/Frameworks//Foundation.framework/Foundation.tbd and library file /System/Library/Frameworks//Foundation.framework/Foundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/Versions/A/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/Versions/A/CoreFoundation are out of sync. Falling back to library file for linking.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
| pkg-config --cflags-only-I protobuf
=> "-I/usr/local/Cellar/protobuf/3.6.1/include\n"
| pkg-config --cflags-only-other protobuf
=> "-pthread\n"
| pkg-config --libs-only-l protobuf
=> "-lprotobuf\n"
package configuration for protobuf
cflags: -pthread
ldflags: -L/usr/local/Cellar/protobuf/3.6.1/lib -pthread
libs: -lprotobuf

公式リポジトリに書いてあった

これをやるだけでした。