TLS definition section .tbss mismatches non-TLS reference

This is the nice message I get while trying to compile some stuff on CENTOS 5. I am not familiar with this distribution, and have not admin right on it, so I have to compile quite a lot of softwares myself. This error seems to come from the fact that for some reasons, when the linker links libz, it gets a really old (libc 5) libz, which is not binary compatible with the 6 (TLS refers to Thread Local Storage). The culprit is in ld configuration file, which contains the following line:


The only way I found to get the rights lib first was to put /usr/lib inĀ  LD_LIBRARY_PATH, which is ugly. But without it, I can not get most softwares to compile correctly…