It seems that gl_Position doesn't let the shader link when inside a loop that uses a uniform variable as a end condition.

int current_level = 0;
uniform int lod_level = 1;
while(current_level < lod_level)
{
current_level++;
gl_Position = pos;
EmitVertex();
}


This isn't all the code, but commenting out gl_positon or changing the while loop to;

while(current_level < 2)


will then work

Hope someone can shed some light on this. Thanks.