I am trying to compile an application which links to the system’s libz library but the compilation process requires the use of the -fPIC option to create a position independent code. So, when the linker attempts to link all the components together it reports the following error:
/usr/bin/ld: /usr/lib64/libz.a(deflate.o): warning: relocation against `z_errmsg' in read-only section `.text' /usr/bin/ld: /usr/lib64/libz.a(zutil.o): relocation R_X86_64_PC32 against symbol `z_errmsg' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value
which indicates that system’s libz library is compiled without this option and therefore it cannot be used. So here are my questions:
Why is it that the system’s libz is not compiled with the -fPIC option?
Can I produce another modified rpm package for libz, based on the original one, which contains an updated version of this library compiled with the -fPIC option? Is this going to create problems with other system components?
Thanks in advance