The problem was that the configure script was not using spack's compiler wrappers. We now pass the proper compiler wrapper using the CC argument explicitly. Fixes #5892.