I figured out that if you put the uniform block as the last declaration, it will work. The source below will give the error stated above. If you change this and put the UBO declaration just above main() (the last delcaration), it will compile.
#version 330
#extension GL_AB_uniform_buffer_object : enable
uniform MaterialBlock
{
vec4 Kd;
vec4 Ka;
vec4 Ks;
vec4 Ke;
float shininess;
};
uniform sampler2D src1;
in vec2 tex0;
out vec4 out_color;
void main()
{
out_color = texture(src1, tex0);
}