I'm not sure about whether this flag is actually used to build ruby or just to detect features during the ./configure run...

The configure script attempts to auto-detect what debug flag to use, and chooses "-ggdb3" on SmartOS which isn't supported. "-ggdb" is. Without this, the configure script fails.