madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.71k stars 2.45k forks source link

Fix the problem of using static library linking #883

Closed xengine-qyt closed 7 months ago

Neustradamus commented 10 months ago

@madler: What do you think?

xengine-qyt commented 10 months ago

Cross-compiling to static libraries on Android platforms requires this option for linking and compiling. ndk-android ./configure --static

Neustradamus commented 9 months ago

@madler: Can you look this PR?

xengine-qyt commented 7 months ago

fixed this:https://github.com/madler/zlib/issues/882

madler commented 7 months ago

Thanks. Applied, though avoiding double -fPIC's.

raphaelts3 commented 4 months ago

This actually resolved an issue I was having for days, it was very similar to the one referenced on #882: lib/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

I don't know much about the double -fPIC but it surely did some trick.

PS: I've tried configure with CHOST, --static, tried to build with cmake and a bunch of other things, but this was the actual solution.

PSS: Sorry for commenting in a closed PR, but this was such a relief to find, that I felt that was going to be worth sharing my experience.