This fixes the build for sun2, and also builds with LDSTATIC=-static, since archive libraries don't record inter-library dependencies.