Porting For The Sun: The Zlib Problem (ld.so.1: exe: fatal: relocation error: R_AMD64_32:)

With the recent update of the Sun Studio 12 compiler set I started seeing errors like this when compiling for example MySQL from source:

ld.so.1: exe: fatal: relocation error: R_AMD64_32:

Turns out that it was Zlib 1.2.5 causing the problem.

{openx:6}Both, Zlib and MySQL need to be compiled using the flag

-Kpic

in the compiler settings as well as in the linker flags.