For a long time I had this problem where installing a Ruby through ruby-build or ruby-install would fail with an error saying "Undefined symbols for architecture x86_64".
linking static-library libruby-static.a
ar: `u' modifier ignored since `D' is the default (see `U')
verifying static-library libruby-static.a
ld: warning: ignoring file libruby-static.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture x86_64:
"_ruby_init", referenced from:
_main in main.o