Link error: "Could not pack varying"

My vertex and fragment shaders compile correctly on WebGL running Chrome Canary build. But I got the following shader link error:

Could not pack varying _v_lifetime

With the following code snippets of my fragment shader

// If the normal is facing the light
if (NdotL > 0.0)
{
// Add the diffuse contribution
color += v_diffuse * NdotL;

  // Re-normalize the half vector
  vec3 HV = normalize(v_halfVector);
  float NdotHV = max(dot(N, HV), 0.0);
  
  // Add the specular contribution
  color += material_specular * light0.specular * pow(NdotHV, material_shininess);	

}

What does it mean?
Where can I get info that document typical linker error?

When I remove the following code snippets:

  // Re-normalize the half vector
  vec3 HV = normalize(v_halfVector);
  float NdotHV = max(dot(N, HV), 0.0);
  
  // Add the specular contribution
  color += material_specular * light0.specular * pow(NdotHV, material_shininess);

The error disappears.

Thanks in advance for your help.

I found the problem.

My vertex shader has the following code snippets:

varying vec3 v_halfVector;
...
vec3 v_halfVector;             // This is the problem due to the re-declaration of v_halfVector
....

I received the same error message again.

It seems that there is a limit as how many varying variables you could use. See the discussions on http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=237438

After reducing the number of varying variables, the error message disappears.

Yes - “varying” variables are interpolated between the vertices of the triangle, each varying requires a significant chunk of circuitry in the GPU and has to run for every pixel you draw - so there can’t be a really large number of them.

Most DirectX/OpenGL implementations limit you to 12 or 13 vec4’s…but on low end hardware, it’s possible that you might have a less. Since WebGL runs on top of the native DirectX/OpenGL right now, you’re going to hit that limit if you aren’t careful.

If you are using less than a vec4 (eg if you have two sets of vec2 texture coordinates) then you should try to pack them (so put one texture coordinate into the .xy part of the varying - and the other texture coordinate into the .zw part).

A clearer error message would have been nice though!

– Steve