nvidia-glx installs the 3 opengl includes (GL/<gl,glx,glxtokens>.h) in /opt/nvidia/include. It doesn't install any symlinks to them from any std include dir (should be /usr/inculde as we already have some GL/*.h stuff there). So ebuilds can't find the includes. For exmaple media-libs/plib doesn't compile. I'm not sure about the policy (where the symlinks should go), so i'm not fixing this myself.
You should have a /usr/include/GL symlink pointing to /usr/X11R6/include/GL, and this dir should contain MesaGL includes that should be functionally equivalent. Do you have those includes?
I have the symlink, and the meas includes. However these includes have different filenames form the 3 I mentioned above. All this started when media-libs/plib didn't compile because of a missing GL/gl.h. Should it be using a different include? What's the mapping between the nvidia-glx includes and the mesa ones? And why don't we install symlinks to the nvidia includes, if the mesa includes have diferent names and there are no conlicts? I assumed this was an nvidia header issue; other opengl apps compile ok though, so if you feel things are working as they should, please tell me what changes should be made to the plib compile (what should it use instead of gl.h) and Il'l try to fix that myself.
Arcady: I thought that xfree installed functional GL includes with its mesa install, so I'm not sure why this problem is happening. Do you have any suggestions on how it could be resolved cleanly?
Just looked and xfree-4.2.0 installs /usr/X11R6/include/GL/gl.h and friends.
I think that the reported problem resulted from unmerging the old nvidia package, and not restoring the files that it messed up. Like Daniel says, vanilla Xfree comes with gl.h, glx.h, and glxtokens.h in /usr/X11R6/include/GL. The include files, the come with the nvidia-glx package have been (on purpose) placed in a different location. If someone wants (for some reason) to compile any code against those headers, rather than the ones that come with XFree, he should pass the compiler "-I/opt/nvidia/include" (and make sure that it precedes /usr/X11R6/inlcude). :( So, to sum it up, make sure that after you unmerge the old nvidia package, you re-merge xfree to restore the original files.
Sorry - this was mostly my mistake. The proposed fix worked. At least part of the trouble was probably caused by the fact that I had xfree-4.2.0-r6 emered (it's maske) not r5. It's from back when everything beyond r2 was masked and we were asked to test the ebuilds. Well, it's not important now.